+ assertNoControllerConfig(ric, version);
+ return new OscA1Client(ric.getConfig());
+ } else if (version == A1ProtocolType.SDNC_OSC_STD_V1_1 || version == A1ProtocolType.SDNC_OSC_OSC_V1) {
+ return new SdncOscA1Client(version, ric.getConfig(), getControllerConfig(ric));
+ } else if (version == A1ProtocolType.SDNC_ONAP) {
+ return new SdncOnapA1Client(ric.getConfig(), getControllerConfig(ric));
+ } else {
+ logger.error("Unhandled protocol: {}", version);
+ throw new ServiceException("Unhandled protocol");
+ }
+ }
+
+ private ControllerConfig getControllerConfig(Ric ric) throws ServiceException {
+ String controllerName = ric.getConfig().controllerName();
+ if (controllerName.isEmpty()) {
+ throw new ServiceException("No controller configured for RIC: " + ric.name());
+ }
+ return this.appConfig.getControllerConfig(controllerName);
+ }
+
+ private void assertNoControllerConfig(Ric ric, A1ProtocolType version) throws ServiceException {
+ if (!ric.getConfig().controllerName().isEmpty()) {
+ throw new ServiceException(
+ "Controller config should be empty, ric: " + ric.name() + " when using protocol version: " + version);
+ }
+ }
+
+ private Mono<A1Client> createA1ClientMono(Ric ric, A1ProtocolType version) {
+ try {
+ return Mono.just(createClient(ric, version));
+ } catch (ServiceException e) {
+ return Mono.error(e);