+ dmaapConsumerConfig = parseDmaapConfig(json);
+ }
+
+ List<RicConfig> ricConfigs = parseRics(agentConfigJson);
+ Map<String, ControllerConfig> controllerConfigs = parseControllerConfigs(agentConfigJson);
+ checkConfigurationConsistency(ricConfigs, controllerConfigs);
+
+ return ImmutableConfigParserResult.builder() //
+ .dmaapConsumerConfig(dmaapConsumerConfig) //
+ .dmaapPublisherConfig(dmaapPublisherConfig) //
+ .ricConfigs(ricConfigs) //
+ .controllerConfigs(controllerConfigs) //
+ .build();
+ }
+
+ private void checkConfigurationConsistency(List<RicConfig> ricConfigs,
+ Map<String, ControllerConfig> controllerConfigs) throws ServiceException {
+ Set<String> ricUrls = new HashSet<>();
+ Set<String> ricNames = new HashSet<>();
+ for (RicConfig ric : ricConfigs) {
+ if (!ricUrls.add(ric.baseUrl())) {
+ throw new ServiceException("Configuration error, more than one RIC URL: " + ric.baseUrl());
+ }
+ if (!ricNames.add(ric.name())) {
+ throw new ServiceException("Configuration error, more than one RIC with name: " + ric.name());
+ }
+ if (!ric.controllerName().isEmpty() && controllerConfigs.get(ric.controllerName()) == null) {
+ throw new ServiceException(
+ "Configuration error, controller configuration not found: " + ric.controllerName());
+ }
+