PCE module init
[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 java.util.concurrent.Future;
11
12 import org.opendaylight.transportpce.pce.service.PathComputationService;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.CancelResourceReserveInput;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.CancelResourceReserveOutput;
15
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestInput;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PathComputationRequestOutput;
18 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.PceService;
19 /*
20 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev170426.service.path.rpc.result.PathDescriptionBuilder;
21 ///// check well PathDescriptionBuilder import
22 //---------------------------------------------
23 */
24 import org.opendaylight.yangtools.yang.common.RpcResult;
25 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29 /**
30  * PceService implementation.
31  */
32 public class PceServiceRPCImpl implements PceService {
33
34     private static final Logger LOG = LoggerFactory.getLogger(PceServiceRPCImpl.class);
35
36     private final PathComputationService pathComputationService;
37
38     public PceServiceRPCImpl(PathComputationService pathComputationService) {
39         this.pathComputationService = pathComputationService;
40     }
41
42     @Override
43     public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
44         LOG.info("RPC cancelResourceReserve request received");
45         return RpcResultBuilder.success(pathComputationService.cancelResourceReserve(input)).buildFuture();
46     }
47
48
49     @Override
50     public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
51         LOG.info("RPC path computation request received");
52         return RpcResultBuilder.success(pathComputationService.pathComputationRequest(input)).buildFuture();
53     }
54
55 }