Search in sources :

Example 21 with Configuration

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration in project so by onap.

the class BBInputSetup method mapConfiguration.

protected Configuration mapConfiguration(AAIResourceUri aaiResourceUri) {
    AAIResultWrapper aaiConfigurationWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri);
    Optional<org.onap.aai.domain.yang.Configuration> aaiConfigurationOp = aaiConfigurationWrapper.asBean(org.onap.aai.domain.yang.Configuration.class);
    if (!aaiConfigurationOp.isPresent()) {
        return null;
    }
    return this.mapperLayer.mapAAIConfiguration(aaiConfigurationOp.get());
}
Also used : CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper)

Example 22 with Configuration

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration in project so by onap.

the class BBInputSetup method populateConfiguration.

protected void populateConfiguration(BBInputSetupParameter parameter) {
    Configuration configuration = null;
    String replaceVnfModelCustomizationUUID = "";
    if (parameter.getRelatedInstanceList() != null) {
        for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
            RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
            if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
                if (parameter.getIsReplace()) {
                    replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
                }
            }
        }
    }
    for (Configuration configurationTemp : parameter.getServiceInstance().getConfigurations()) {
        if (parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId().equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID))) {
            configuration = configurationTemp;
            org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
            if (aaiConfiguration != null) {
                parameter.getModelInfo().setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
            }
        }
    }
    if (configuration == null && (parameter.getBbName().equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString()) || parameter.getBbName().equalsIgnoreCase(AssignFlows.VRF_CONFIGURATION.toString()))) {
        configuration = this.createConfiguration(parameter.getLookupKeyMap(), parameter.getInstanceName(), parameter.getResourceId());
        parameter.getServiceInstance().getConfigurations().add(configuration);
    }
    if (configuration != null && parameter.getBbName().contains("Fabric")) {
        Vnfc vnfc = getVnfcToConfiguration(parameter.getConfigurationResourceKeys().getVnfcName());
        configuration.setVnfc(vnfc);
        if (!parameter.getBbName().contains("Delete")) {
            if (parameter.getIsReplace()) {
                parameter.getConfigurationResourceKeys().setVnfResourceCustomizationUUID(replaceVnfModelCustomizationUUID);
                mapCatalogConfiguration(configuration, parameter.getModelInfo(), parameter.getServiceModel().getNewService(), parameter.getConfigurationResourceKeys());
            } else {
                mapCatalogConfiguration(configuration, parameter.getModelInfo(), parameter.getServiceModel().getCurrentService(), parameter.getConfigurationResourceKeys());
            }
        }
    } else if (configuration != null && parameter.getBbName().contains("Vrf")) {
        configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration(findConfigurationResourceCustomization(parameter.getModelInfo(), parameter.getService()), null));
        configuration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType());
        configuration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
    }
}
Also used : CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) RelatedInstanceList(org.onap.so.serviceinstancebeans.RelatedInstanceList) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) Vnfc(org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc)

Example 23 with Configuration

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration in project so by onap.

the class GeneralTopologyObjectMapperTest method buildConfigurationInformationTest_excludesOnapModelInfo.

@Test
public void buildConfigurationInformationTest_excludesOnapModelInfo() {
    Configuration configuration = new Configuration();
    configuration.setConfigurationId("testConfigurationId");
    configuration.setConfigurationType("VNR");
    configuration.setConfigurationName("VNRCONF");
    GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = genObjMapper.buildConfigurationInformation(configuration, false);
    assertEquals(configuration.getConfigurationId(), configurationInformation.getConfigurationId());
    assertEquals(configuration.getConfigurationType(), configurationInformation.getConfigurationType());
    assertEquals(configuration.getConfigurationName(), configurationInformation.getConfigurationName());
    assertNull(configurationInformation.getOnapModelInformation());
}
Also used : GenericResourceApiConfigurationinformationConfigurationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) Test(org.junit.Test)

Example 24 with Configuration

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration in project so by onap.

the class GeneralTopologyObjectMapperTest method buildConfigurationInformationTest_includesOnapModelInfo.

@Test
public void buildConfigurationInformationTest_includesOnapModelInfo() {
    Configuration configuration = new Configuration();
    configuration.setConfigurationId("testConfigurationId");
    configuration.setConfigurationType("VNR");
    configuration.setConfigurationName("VNRCONF");
    ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
    modelInfoConfiguration.setModelVersionId("modelVersionId");
    modelInfoConfiguration.setModelInvariantId("modelInvariantId");
    modelInfoConfiguration.setModelCustomizationId("modelCustomizationId");
    configuration.setModelInfoConfiguration(modelInfoConfiguration);
    GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = genObjMapper.buildConfigurationInformation(configuration, true);
    assertEquals(configuration.getConfigurationId(), configurationInformation.getConfigurationId());
    assertEquals(configuration.getConfigurationType(), configurationInformation.getConfigurationType());
    assertEquals(configuration.getConfigurationName(), configurationInformation.getConfigurationName());
    assertNotNull(configurationInformation.getOnapModelInformation());
    assertEquals(configuration.getModelInfoConfiguration().getModelVersionId(), configurationInformation.getOnapModelInformation().getModelUuid());
    assertEquals(configuration.getModelInfoConfiguration().getModelInvariantId(), configurationInformation.getOnapModelInformation().getModelInvariantUuid());
    assertEquals(configuration.getModelInfoConfiguration().getModelCustomizationId(), configurationInformation.getOnapModelInformation().getModelCustomizationUuid());
}
Also used : ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) GenericResourceApiConfigurationinformationConfigurationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) Test(org.junit.Test)

Example 25 with Configuration

use of org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration in project so by onap.

the class AAIDeleteTasks method deleteConfiguration.

/**
 * BPMN access method to delete the Configuration from A&AI.
 *
 * It will extract the configuration from the BBObject.
 *
 * Then it will delete from A&AI.
 *
 * @param execution
 */
public void deleteConfiguration(BuildingBlockExecution execution) {
    try {
        Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
        aaiConfigurationResources.deleteConfiguration(configuration);
    } catch (Exception ex) {
        logger.error("Exception occurred in AAIDeleteTasks deleteConfiguration process", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration)

Aggregations

Configuration (org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration)41 Test (org.junit.Test)23 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)13 ArrayList (java.util.ArrayList)11 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)11 ModelInfoConfiguration (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration)10 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)9 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)8 Service (org.onap.so.db.catalog.beans.Service)8 File (java.io.File)7 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)7 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)7 Relationships (org.onap.aaiclient.client.aai.entities.Relationships)6 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)6 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)6 BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys)6 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)6 GenericVnf (org.onap.aai.domain.yang.GenericVnf)5 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)5 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)5