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());
}
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());
}
}
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());
}
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());
}
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);
}
}
Aggregations