Update transportpce-pce YANG
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / impl / PceServiceRPCImpl.java
old mode 100755 (executable)
new mode 100644 (file)
index 824550d..af68f19
@@ -8,17 +8,15 @@
 package org.opendaylight.transportpce.pce.impl;
 
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PceService;
-/*
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.service.path.rpc.result.PathDescriptionBuilder;
-///// check well PathDescriptionBuilder import
-//---------------------------------------------
-*/
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.TransportpcePceService;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
@@ -27,7 +25,7 @@ import org.slf4j.LoggerFactory;
 /**
  * PceService implementation.
  */
-public class PceServiceRPCImpl implements PceService {
+public class PceServiceRPCImpl implements TransportpcePceService {
 
     private static final Logger LOG = LoggerFactory.getLogger(PceServiceRPCImpl.class);
 
@@ -38,16 +36,37 @@ public class PceServiceRPCImpl implements PceService {
     }
 
     @Override
-    public ListenableFuture<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
+    public ListenableFuture<RpcResult<CancelResourceReserveOutput>>
+            cancelResourceReserve(CancelResourceReserveInput input) {
         LOG.info("RPC cancelResourceReserve request received");
-        return RpcResultBuilder.success(this.pathComputationService.cancelResourceReserve(input)).buildFuture();
+        CancelResourceReserveOutput output = null;
+        try {
+            output = this.pathComputationService.cancelResourceReserve(input).get();
+        } catch (InterruptedException | ExecutionException e) {
+            LOG.error("RPC cancelResourceReserve failed !", e);
+        }
+        return RpcResultBuilder.success(output).buildFuture();
     }
 
-
     @Override
-    public ListenableFuture<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
+    public ListenableFuture<RpcResult<PathComputationRequestOutput>>
+            pathComputationRequest(PathComputationRequestInput input) {
         LOG.info("RPC path computation request received");
-        return RpcResultBuilder.success(this.pathComputationService.pathComputationRequest(input)).buildFuture();
+        LOG.debug("input parameters are : input = {}", input);
+        PathComputationRequestOutput output = null;
+        try {
+            output = this.pathComputationService.pathComputationRequest(input).get();
+        } catch (InterruptedException | ExecutionException e) {
+            LOG.error("RPC path computation request failed !", e);
+        }
+        return RpcResultBuilder.success(output).buildFuture();
     }
 
+    @Override
+    public ListenableFuture<RpcResult<PathComputationRerouteRequestOutput>>
+           pathComputationRerouteRequest(PathComputationRerouteRequestInput input) {
+        LOG.info("RPC path computation reroute request received");
+        LOG.debug("input parameters are : input = {}", input);
+        return null;
+    }
 }