package org.opendaylight.transportpce.renderer.rpcs;
import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.transportpce.renderer.ModelMappingUtils;
import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceDeleteInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceDeleteOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceImplementationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.ServiceImplementationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev200520.TransportpceRendererService;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TransportPCEServicePathRPCImpl implements TransportpceServicepathService {
+public class TransportPCEServicePathRPCImpl implements TransportpceRendererService {
private static final Logger LOG = LoggerFactory.getLogger(TransportPCEServicePathRPCImpl.class);
this.rendererServiceOperations = rendererServiceOperations;
}
- @Override
- public ListenableFuture<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(
- CancelResourceReserveInput input) {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
- // TODO Auto-generated method stub
- return null;
+ String serviceName = input.getServiceName();
+ LOG.info("Calling RPC service delete request {}", serviceName);
+ ServiceDeleteOutput output = null;
+ try {
+ output = this.rendererServiceOperations.serviceDelete(input).get();
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("RPC service delete failed !", e);
+ }
+ return ModelMappingUtils.createServiceDeleteRpcResponse(output);
}
@Override
public ListenableFuture<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
ServiceImplementationRequestInput input) {
String serviceName = input.getServiceName();
- LOG.info("Calling RPC service impl request {} {}", serviceName);
- return ModelMappingUtils.createRpcResponse(this.rendererServiceOperations.serviceImplementation(input));
- }
-
- @Override
- public ListenableFuture<RpcResult<PathComputationRequestOutput>> pathComputationRequest(
- PathComputationRequestInput input) {
- // TODO Auto-generated method stub
- return null;
+ LOG.info("Calling RPC service impl request {}", serviceName);
+ ServiceImplementationRequestOutput output = null;
+ try {
+ output = this.rendererServiceOperations.serviceImplementation(input).get();
+ } catch (InterruptedException | ExecutionException e) {
+ LOG.error("RPC service implementation failed !", e);
+ }
+ return ModelMappingUtils.createServiceImplementationRpcResponse(output);
}
}