Do not use RpcService in algo-impl 98/108398/4
authorlubos-cicut <lubos.cicut@pantheon.tech>
Fri, 13 Oct 2023 13:04:21 +0000 (15:04 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 19 Oct 2023 11:05:14 +0000 (11:05 +0000)
Migrate usage of RpcService to Rpc<?,?> for algo-impl. There is only a
single RPC, so this is simple.

JIRA: BGPCEP-1027
Change-Id: I570a7dd448ff66ffccf81c961d5630df5d6c479c
Signed-off-by: lubos-cicut <lubos.cicut@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
algo/algo-impl/pom.xml
algo/algo-impl/src/main/java/org/opendaylight/algo/impl/PathComputationServer.java

index f14ffc11ed9c576d1264679fe308a0654f1864d7..650779f053a81aadf5d92480d658967c2554f4b1 100644 (file)
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-binding-api</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.mdsal</groupId>
-            <artifactId>yang-binding</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId>
             <artifactId>rfc6991-ietf-inet-types</artifactId>
index f5707883ebad641eac5f45021d415de3d922e557..ca6a89498c4d55fe314371e53ab3888cf75fd215 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.algo.impl;
 
 import static java.util.Objects.requireNonNull;
 
+import com.google.common.collect.ImmutableClassToInstanceMap;
 import com.google.common.util.concurrent.ListenableFuture;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
@@ -22,10 +23,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.graph.re
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.AlgorithmType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.ComputationStatus;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.ConstrainedPath;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.GetConstrainedPath;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.GetConstrainedPathInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.GetConstrainedPathOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.GetConstrainedPathOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.path.computation.rev220324.PathComputationService;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -44,7 +45,7 @@ import org.slf4j.LoggerFactory;
  */
 @Singleton
 @Component(immediate = true, service = PathComputationProvider.class)
-public final class PathComputationServer implements AutoCloseable, PathComputationService, PathComputationProvider {
+public final class PathComputationServer implements AutoCloseable, PathComputationProvider {
     private static final Logger LOG = LoggerFactory.getLogger(PathComputationServer.class);
 
     private final ConnectedGraphProvider graphProvider;
@@ -55,11 +56,11 @@ public final class PathComputationServer implements AutoCloseable, PathComputati
     public PathComputationServer(@Reference final RpcProviderService rpcService,
             @Reference final ConnectedGraphProvider graphProvider) {
         this.graphProvider = requireNonNull(graphProvider);
-        registration = rpcService.registerRpcImplementation(PathComputationService.class, this);
+        registration = rpcService.registerRpcImplementations(
+            ImmutableClassToInstanceMap.of(GetConstrainedPath.class, this::getConstrainedPath));
     }
 
-    @Override
-    public ListenableFuture<RpcResult<GetConstrainedPathOutput>> getConstrainedPath(
+    private ListenableFuture<RpcResult<GetConstrainedPathOutput>> getConstrainedPath(
             final GetConstrainedPathInput input) {
         final GetConstrainedPathOutputBuilder output = new GetConstrainedPathOutputBuilder();