use of org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException in project so by onap.
the class ServiceEBBLoader method getExistingAAIVrfConfiguration.
protected String getExistingAAIVrfConfiguration(RelatedInstance relatedVpnBinding, org.onap.aai.domain.yang.L3Network aaiLocalNetwork) throws JsonProcessingException, VrfBondingServiceException {
Optional<Relationships> relationshipsOp = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships();
if (relationshipsOp.isPresent()) {
List<AAIResultWrapper> configurationsRelatedToLocalNetwork = relationshipsOp.get().getByType(AAIFluentTypeBuilder.Types.CONFIGURATION);
if (configurationsRelatedToLocalNetwork.size() > 1) {
throw new VrfBondingServiceException("Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it");
}
if (configurationsRelatedToLocalNetwork.size() == 1) {
AAIResultWrapper configWrapper = configurationsRelatedToLocalNetwork.get(0);
Optional<Configuration> relatedConfiguration = configWrapper.asBean(Configuration.class);
if (relatedConfiguration.isPresent() && vrfConfigurationAlreadyExists(relatedVpnBinding, relatedConfiguration.get(), configWrapper)) {
return relatedConfiguration.get().getConfigurationId();
}
}
}
return null;
}
Aggregations