Reintroduce SP 1.6 models in TPCE
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / impl / PceServiceRPCImpl.java
1 /*
2  * Copyright © 2017 AT&T, Inc. 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.pce.impl;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.transportpce.pce.service.PathComputationService;
12 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.CancelResourceReserveInput;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.CancelResourceReserveOutput;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.PathComputationRequestInput;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.PathComputationRequestOutput;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.TransportpcePceService;
17 import org.opendaylight.yangtools.yang.common.RpcResult;
18 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
21
22 /**
23  * PceService implementation.
24  */
25 public class PceServiceRPCImpl implements TransportpcePceService {
26
27     private static final Logger LOG = LoggerFactory.getLogger(PceServiceRPCImpl.class);
28
29     private final PathComputationService pathComputationService;
30
31     public PceServiceRPCImpl(PathComputationService pathComputationService) {
32         this.pathComputationService = pathComputationService;
33     }
34
35     @Override
36     public ListenableFuture<RpcResult<CancelResourceReserveOutput>>
37             cancelResourceReserve(CancelResourceReserveInput input) {
38         LOG.info("RPC cancelResourceReserve request received");
39         return RpcResultBuilder.success(this.pathComputationService.cancelResourceReserve(input)).buildFuture();
40     }
41
42
43     @Override
44     public ListenableFuture<RpcResult<PathComputationRequestOutput>>
45             pathComputationRequest(PathComputationRequestInput input) {
46         LOG.info("RPC path computation request received");
47         return RpcResultBuilder.success(this.pathComputationService.pathComputationRequest(input)).buildFuture();
48     }
49
50 }