X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=policy-agent%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fpolicyagent%2Fclients%2FA1ClientFactory.java;h=d9069303992f5895360a48e0c2b080efecae3940;hb=842b9d220588fba7fc17df0cf9c094f91005118b;hp=e340e6026128305cbb1c63af258ee34ecb4dcc41;hpb=86b589317c67eb2350870c9c57c35eac3e9056f6;p=nonrtric.git diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java index e340e602..d9069303 100644 --- a/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java +++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java @@ -2,7 +2,7 @@ * ========================LICENSE_START================================= * O-RAN-SC * %% - * Copyright (C) 2019 Nordix Foundation + * Copyright (C) 2020 Nordix Foundation * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,10 +45,12 @@ public class A1ClientFactory { /** * Creates an A1 client with the correct A1 protocol for the provided Ric. * - *

It detects the protocol version by trial and error, since there is no getVersion method specified in the A1 + *

+ * It detects the protocol version by trial and error, since there is no getVersion method specified in the A1 * api yet. * - *

As a side effect it also sets the protocol version in the provided Ric. This means that after the first + *

+ * As a side effect it also sets the protocol version in the provided Ric. This means that after the first * successful creation it won't have to try which protocol to use, but can create the client directly. * * @param ric The Ric to get a client for. @@ -75,12 +77,12 @@ public class A1ClientFactory { private Mono getProtocolVersion(Ric ric) { if (ric.getProtocolVersion() == A1ProtocolType.UNKNOWN) { return fetchVersion(createSdnrOnapA1Client(ric)) // - .onErrorResume(err -> fetchVersion(createSdncOscA1Client(ric))) // - .onErrorResume(err -> fetchVersion(createOscA1Client(ric))) // - .onErrorResume(err -> fetchVersion(createStdA1ClientImpl(ric))) // - .doOnNext(version -> ric.setProtocolVersion(version)) + .onErrorResume(notUsed -> fetchVersion(createSdncOscA1Client(ric))) // + .onErrorResume(notUsed -> fetchVersion(createOscA1Client(ric))) // + .onErrorResume(notUsed -> fetchVersion(createStdA1ClientImpl(ric))) // + .doOnNext(ric::setProtocolVersion) .doOnNext(version -> logger.debug("Recover ric: {}, protocol version:{}", ric.name(), version)) // - .doOnError(t -> logger.warn("Could not get protocol version from RIC: {}", ric.name())); // + .doOnError(notUsed -> logger.warn("Could not get protocol version from RIC: {}", ric.name())); // } else { return Mono.just(ric.getProtocolVersion()); } @@ -100,7 +102,7 @@ public class A1ClientFactory { } protected A1Client createSdnrOnapA1Client(Ric ric) { - return new SdnrOnapA1Client(ric.getConfig(), appConfig.getA1ControllerBaseUrl(), + return new SdncOnapA1Client(ric.getConfig(), appConfig.getA1ControllerBaseUrl(), appConfig.getA1ControllerUsername(), appConfig.getA1ControllerPassword()); }