Adjust for Binding RPC codegen changes
[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 com.google.common.util.concurrent.Futures;
12 import com.google.common.util.concurrent.ListenableFuture;
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 public class GlobalBindingRTCServer implements RpcbenchPayloadService {
26
27     private static final Logger LOG = LoggerFactory.getLogger(GlobalBindingRTCServer.class);
28     private int numRpcs = 0;
29
30     public GlobalBindingRTCServer() {
31         LOG.debug("GlobalBindingRTCServer created.");
32     }
33
34     @Override
35     public ListenableFuture<RpcResult<GlobalRpcBenchOutput>> globalRpcBench(final GlobalRpcBenchInput input) {
36         GlobalRpcBenchOutput output = new GlobalRpcBenchOutputBuilder(input).build();
37         RpcResult<GlobalRpcBenchOutput> result = RpcResultBuilder.success(output).build();
38         numRpcs++;
39         return Futures.immediateFuture(result);
40     }
41
42     @Override
43     public ListenableFuture<RpcResult<RoutedRpcBenchOutput>> routedRpcBench(final RoutedRpcBenchInput input) {
44         RoutedRpcBenchOutput output = new RoutedRpcBenchOutputBuilder(input).build();
45         RpcResult<RoutedRpcBenchOutput> result = RpcResultBuilder.success(output).build();
46         numRpcs++;
47         return Futures.immediateFuture(result);
48     }
49
50     public int getNumRpcs() {
51         return numRpcs;
52     }
53 }

©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.