Merge "ROADM To ROADM Path Calculation"
[transportpce.git] / renderer / src / main / java / org / opendaylight / transportpce / renderer / rpcs / TransportPCEServicePathRPCImpl.java
1 /*
2  * Copyright © 2017 AT&T and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.transportpce.renderer.rpcs;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.transportpce.renderer.ModelMappingUtils;
12 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteInput;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestInput;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestOutput;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.TransportpceRendererService;
18 import org.opendaylight.yangtools.yang.common.RpcResult;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
21
22 public class TransportPCEServicePathRPCImpl implements TransportpceRendererService {
23
24     private static final Logger LOG = LoggerFactory.getLogger(TransportPCEServicePathRPCImpl.class);
25
26     private final RendererServiceOperations rendererServiceOperations;
27
28     public TransportPCEServicePathRPCImpl(RendererServiceOperations rendererServiceOperations) {
29         this.rendererServiceOperations = rendererServiceOperations;
30     }
31
32     @Override
33     public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
34         String serviceName = input.getServiceName();
35         LOG.info("Calling RPC service delete request {} {}", serviceName);
36         return ModelMappingUtils
37                 .createServiceDeleteRpcResponse(this.rendererServiceOperations.serviceDelete(input));
38     }
39
40     @Override
41     public ListenableFuture<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
42             ServiceImplementationRequestInput input) {
43         String serviceName = input.getServiceName();
44         LOG.info("Calling RPC service impl request {} {}", serviceName);
45         return ModelMappingUtils
46                 .createServiceImplementationRpcResponse(this.rendererServiceOperations.serviceImplementation(input));
47     }
48
49 }
50