Search in sources :

Example 6 with ConfigurationResourceCustomization

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

the class BBInputSetup method mapCatalogConfiguration.

protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, ConfigurationResourceKeys configurationResourceKeys) {
    ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service);
    CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(), configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization);
    if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) {
        configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, vnfVfmoduleCvnfcConfigurationCustomization));
    } else {
        logger.debug("for Fabric configuration mapping by VF MODULE CUST UUID: " + configurationResourceKeys.getVfModuleCustomizationUUID());
        vnfVfmoduleCvnfcConfigurationCustomization = findVnfVfmoduleCvnfcConfigurationCustomization(service.getModelUUID(), configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getVfModuleCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID());
        if (vnfVfmoduleCvnfcConfigurationCustomization != null) {
            configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(vnfVfmoduleCvnfcConfigurationCustomization));
        }
    }
}
Also used : CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization)

Example 7 with ConfigurationResourceCustomization

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

the class ServiceEBBLoaderTest method traverseVrfConfigurationTest.

@Test
public void traverseVrfConfigurationTest() throws VrfBondingServiceException, JsonProcessingException {
    List<Resource> resource = new ArrayList<>();
    List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
    Service service = new Service();
    List<ConfigurationResourceCustomization> resourceCustomizations = new ArrayList<>();
    ConfigurationResourceCustomization configuration = new ConfigurationResourceCustomization();
    configuration.setModelCustomizationUUID("123");
    resourceCustomizations.add(configuration);
    service.setConfigurationCustomizations(resourceCustomizations);
    Relationship relationship = new Relationship();
    relationship.setRelatedTo("vpn-binding");
    RelationshipList relationshipList = new RelationshipList();
    relationshipList.getRelationship().add(relationship);
    org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
    aaiLocalNetwork.setNetworkId("localNetworkId");
    aaiLocalNetwork.setRelationshipList(relationshipList);
    RelatedInstance relatedVpnBinding = new RelatedInstance();
    relatedVpnBinding.setInstanceId("vpnBindingInstanceId");
    RelatedInstance relatedLocalNetwork = new RelatedInstance();
    relatedLocalNetwork.setInstanceId("localNetworkInstanceId");
    doReturn(aaiLocalNetwork).when(mockBbInputSetupUtils).getAAIL3Network("localNetworkInstanceId");
    Resource serviceResource = new Resource(WorkflowType.SERVICE, "1", false, null);
    serviceEBBLoader.traverseVrfConfiguration(aaiResourceIds, resource, serviceResource, service, relatedVpnBinding, relatedLocalNetwork);
    assertEquals(resource.size(), 1);
    assertEquals(aaiResourceIds.size(), 0);
}
Also used : RelationshipList(org.onap.aai.domain.yang.RelationshipList) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) Relationship(org.onap.aai.domain.yang.Relationship) Pair(org.javatuples.Pair) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 8 with ConfigurationResourceCustomization

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

the class VrfValidationTest method testVrfCatalogDbChecks.

@Test
public void testVrfCatalogDbChecks() throws VrfBondingServiceException {
    Service service = new Service();
    service.setModelName("modelName");
    ConfigurationResourceCustomization configuration = new ConfigurationResourceCustomization();
    service.setConfigurationCustomizations(new ArrayList<>());
    service.getConfigurationCustomizations().add(configuration);
    ServiceProxyResourceCustomization serviceProxy = new ServiceProxyResourceCustomization();
    configuration.setServiceProxyResourceCustomization(serviceProxy);
    service.setServiceProxyCustomizations(new ArrayList<>());
    service.getServiceProxyCustomizations().add(serviceProxy);
    Service sourceService = new Service();
    sourceService.setServiceType("TRANSPORT");
    serviceProxy.setSourceService(sourceService);
    configuration.setType("VRF-ENTRY");
    configuration.setRole("INFRASTRUCTURE-CLOUD-VPN");
    ExpectedException.none();
    vrfValidation.vrfCatalogDbChecks(service);
}
Also used : ServiceProxyResourceCustomization(org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization) Service(org.onap.so.db.catalog.beans.Service) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 9 with ConfigurationResourceCustomization

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

the class BBInputSetupTest method testGBBMacroNoUserParamsVrfConfiguration.

@Test
public void testGBBMacroNoUserParamsVrfConfiguration() throws Exception {
    String resourceId = "123";
    String vnfType = "vnfType";
    String requestAction = "createInstance";
    Service service = Mockito.mock(Service.class);
    GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), GeneralBuildingBlock.class);
    ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class);
    RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacroVrf.json"), RequestDetails.class);
    Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
    ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
    executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
    BuildingBlock buildingBlock = executeBB.getBuildingBlock();
    buildingBlock.setBpmnFlowName("AssignVrfConfigurationBB");
    buildingBlock.setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
    doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
    doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
    RelatedInstance relatedVpnBinding = new RelatedInstance();
    relatedVpnBinding.setInstanceId("vpnBindingInstanceId");
    RelatedInstance relatedLocalNetwork = new RelatedInstance();
    relatedLocalNetwork.setInstanceId("localNetworkInstanceId");
    org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
    aaiVpnBinding.setVpnId("vpnBindingId");
    org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
    aaiLocalNetwork.setNetworkId("localNetworkId");
    Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp = Optional.of(new org.onap.aai.domain.yang.VpnBinding());
    aaiAICVpnBindingOp.get().setVpnId("AICVpnBindingId");
    ServiceProxy proxy = new ServiceProxy();
    proxy.setType("transport");
    proxy.setServiceInstance(new ServiceInstance());
    proxy.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
    proxy.getServiceInstance().getModelInfoServiceInstance().setModelUuid("sourceServiceModelUUID");
    doReturn(relatedVpnBinding).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails, ModelType.vpnBinding);
    doReturn(relatedLocalNetwork).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails, ModelType.network);
    doReturn(aaiVpnBinding).when(SPY_bbInputSetupUtils).getAAIVpnBinding(relatedVpnBinding.getInstanceId());
    doReturn(aaiLocalNetwork).when(SPY_bbInputSetupUtils).getAAIL3Network(relatedLocalNetwork.getInstanceId());
    doReturn(aaiAICVpnBindingOp).when(SPY_bbInputSetupUtils).getAICVpnBindingFromNetwork(aaiLocalNetwork);
    doReturn(proxy).when(SPY_bbInputSetup).getServiceProxy(service);
    Configuration configuration = new Configuration();
    configuration.setConfigurationId("configurationId");
    gBB.getServiceInstance().getConfigurations().add(configuration);
    List<ConfigurationResourceCustomization> configurationCustList = new ArrayList<>();
    ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
    configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
    configurationCustList.add(configurationCust);
    doNothing().when(SPY_bbInputSetup).populateConfiguration(any(BBInputSetupParameter.class));
    gBB = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
    verify(SPY_bbInputSetup, times(1)).populateConfiguration(any(BBInputSetupParameter.class));
    assertEquals(gBB.getCustomer().getVpnBindings().get(0).getVpnId(), "vpnBindingId");
    assertEquals(gBB.getServiceInstance().getNetworks().get(0).getNetworkId(), "localNetworkId");
    assertEquals(gBB.getServiceInstance().getNetworks().get(0).getVpnBindings().get(0).getVpnId(), "AICVpnBindingId");
    assertEquals(gBB.getServiceInstance().getServiceProxies().get(0).getType(), "transport");
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ArrayList(java.util.ArrayList) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) Service(org.onap.so.db.catalog.beans.Service) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ModelInfoServiceProxy(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy) ServiceProxy(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy) ConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys) BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys) File(java.io.File) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) Test(org.junit.Test)

Example 10 with ConfigurationResourceCustomization

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

the class BBInputSetupMapperLayerTest method testmapCatalogConfigurationToConfiguration.

@Test
public void testmapCatalogConfigurationToConfiguration() {
    String modelCustUUID = "modelCustomizationUUID";
    String modelInvariantUUID = "modelInvariantUUID";
    String modelVersionUUID = "modelUUID";
    String policyName = "policyName";
    ModelInfoConfiguration expected = new ModelInfoConfiguration();
    expected.setModelCustomizationId(modelCustUUID);
    expected.setModelInvariantId(modelInvariantUUID);
    expected.setModelVersionId(modelVersionUUID);
    expected.setPolicyName(policyName);
    ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
    configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
    configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
    configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
    configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
    CvnfcConfigurationCustomization policyNameTable = new CvnfcConfigurationCustomization();
    policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
    policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
    policyNameTable.setPolicyName(policyName);
    ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
    assertThat(actual, sameBeanAs(expected));
}
Also used : ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) VnfcCustomization(org.onap.so.db.catalog.beans.VnfcCustomization) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) Test(org.junit.Test)

Aggregations

ConfigurationResourceCustomization (org.onap.so.db.catalog.beans.ConfigurationResourceCustomization)13 Service (org.onap.so.db.catalog.beans.Service)8 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)5 Configuration (org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration)5 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)5 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)5 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)5 File (java.io.File)4 HashMap (java.util.HashMap)4 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)4 BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys)4 ConfigurationResource (org.onap.so.db.catalog.beans.ConfigurationResource)4 CvnfcConfigurationCustomization (org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization)4 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)4 Vnfc (org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc)3 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)3 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)3 ServiceModel (org.onap.so.bpmn.servicedecomposition.entities.ServiceModel)3 CollectionResource (org.onap.so.db.catalog.beans.CollectionResource)3