Merge "REST error codes"
authorHenrik Andersson <henrik.b.andersson@est.tech>
Wed, 11 Mar 2020 12:05:01 +0000 (12:05 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Wed, 11 Mar 2020 12:05:01 +0000 (12:05 +0000)
1  2 
policy-agent/src/main/java/org/oransc/policyagent/clients/A1ClientFactory.java

@@@ -29,7 -29,8 +29,8 @@@ import org.springframework.beans.factor
  import reactor.core.publisher.Mono;
  
  /**
-  * Factory for A1 clients that supports four different protocol versions of the A1 api.
+  * Factory for A1 clients that supports four different protocol versions of the
+  * A1 api.
   */
  public class A1ClientFactory {
  
       * Creates an A1 client with the correct A1 protocol for the provided Ric.
       *
       * <p>
-      * It detects the protocol version by trial and error, since there is no getVersion method specified in the A1
-      * api yet.
+      * It detects the protocol version by trial and error, since there is no
+      * getVersion method specified in the A1 api yet.
       *
       * <p>
-      * 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.
+      * 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.
-      * @return a client with the correct protocol, or a ServiceException if none of the protocols are supported by the
-      *         Ric.
+      * @param ric The RIC to get a client for.
+      * @return a client with the correct protocol, or a ServiceException if none of
+      *         the protocols are supported by the Ric.
       */
      public Mono<A1Client> createA1Client(Ric ric) {
          return getProtocolVersion(ric) //
              return Mono.just(createOscA1Client(ric));
          } else if (version == A1ProtocolType.SDNC_OSC) {
              return Mono.just(createSdncOscA1Client(ric));
 -        } else { // A1ProtocolType.SDNR_ONAP
 -            return Mono.just(createSdnrOnapA1Client(ric));
 +        } else { // A1ProtocolType.SDNC_ONAP
 +            return Mono.just(createSdncOnapA1Client(ric));
          }
      }
  
      private Mono<A1Client.A1ProtocolType> getProtocolVersion(Ric ric) {
          if (ric.getProtocolVersion() == A1ProtocolType.UNKNOWN) {
 -            return fetchVersion(createSdnrOnapA1Client(ric)) //
 +            return fetchVersion(createSdncOnapA1Client(ric)) //
                  .onErrorResume(notUsed -> fetchVersion(createSdncOscA1Client(ric))) //
                  .onErrorResume(notUsed -> fetchVersion(createOscA1Client(ric))) //
                  .onErrorResume(notUsed -> fetchVersion(createStdA1ClientImpl(ric))) //
              appConfig.getA1ControllerUsername(), appConfig.getA1ControllerPassword());
      }
  
 -    protected A1Client createSdnrOnapA1Client(Ric ric) {
 +    protected A1Client createSdncOnapA1Client(Ric ric) {
          return new SdncOnapA1Client(ric.getConfig(), appConfig.getA1ControllerBaseUrl(),
              appConfig.getA1ControllerUsername(), appConfig.getA1ControllerPassword());
      }