7e97768badd5b361e40107d52bf778b22f64c729
[controller.git] / benchmark / rpcbenchmark / src / main / java / rpcbenchmark / impl / GlobalBindingRTCServer.java
1 /*
2  * Copyright (c) 2015 Cisco Systems 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
9 package rpcbenchmark.impl;
10
11 import java.util.concurrent.Future;
12
13 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchInput;
14 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchOutput;
15 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.GlobalRpcBenchOutputBuilder;
16 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchInput;
17 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutput;
18 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RoutedRpcBenchOutputBuilder;
19 import org.opendaylight.yang.gen.v1.rpcbench.payload.rev150702.RpcbenchPayloadService;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
21 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24
25 import com.google.common.util.concurrent.Futures;
26
27 public class GlobalBindingRTCServer implements RpcbenchPayloadService {
28
29     private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCServer.class);
30     private int numRpcs = 0;
31
32     public GlobalBindingRTCServer() {
33         LOG.debug("GlobalBindingRTCServer created.");
34     }
35
36     @Override
37     public Future<RpcResult<GlobalRpcBenchOutput>> globalRpcBench(
38             final GlobalRpcBenchInput input) {
39         GlobalRpcBenchOutput output = new GlobalRpcBenchOutputBuilder(input).build();
40         RpcResult<GlobalRpcBenchOutput> result = RpcResultBuilder.success(output).build();
41         numRpcs++;
42         return Futures.immediateFuture(result);
43     }
44
45     @Override
46     public Future<RpcResult<RoutedRpcBenchOutput>> routedRpcBench(
47             final RoutedRpcBenchInput input) {
48         RoutedRpcBenchOutput output = new RoutedRpcBenchOutputBuilder(input).build();
49         RpcResult<RoutedRpcBenchOutput> result = RpcResultBuilder.success(output).build();
50         numRpcs++;
51         return Futures.immediateFuture(result);
52     }
53
54     public int getNumRpcs() {
55         return numRpcs;
56     }
57 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.