2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.clustering.it.karaf.cli.odl.mdsal.lowlevel.control;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.apache.karaf.shell.api.action.Argument;
12 import org.apache.karaf.shell.api.action.Command;
13 import org.apache.karaf.shell.api.action.lifecycle.Reference;
14 import org.apache.karaf.shell.api.action.lifecycle.Service;
15 import org.opendaylight.clustering.it.karaf.cli.AbstractRpcAction;
16 import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
17 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.OdlMdsalLowlevelControlService;
18 import org.opendaylight.yang.gen.v1.tag.opendaylight.org._2017.controller.yang.lowlevel.control.rev170215.WriteTransactionsInputBuilder;
19 import org.opendaylight.yangtools.yang.common.RpcResult;
20 import org.opendaylight.yangtools.yang.common.Uint32;
23 @Command(scope = "test-app", name = "write-transactions", description = "Run a write-transactions test")
24 public class WriteTransactionsCommand extends AbstractRpcAction {
26 private RpcConsumerRegistry rpcService;
27 @Argument(index = 0, name = "id", required = true)
29 @Argument(index = 1, name = "seconds", required = true)
31 @Argument(index = 2, name = "trasactions-per-second", required = true)
32 long transactionsPerSecond;
33 @Argument(index = 3, name = "chained-transations", required = true)
34 boolean chainedTransactions;
37 protected ListenableFuture<? extends RpcResult<?>> invokeRpc() {
38 return rpcService.getRpcService(OdlMdsalLowlevelControlService.class)
39 .writeTransactions(new WriteTransactionsInputBuilder()
41 .setSeconds(Uint32.valueOf(seconds))
42 .setTransactionsPerSecond(Uint32.valueOf(transactionsPerSecond))
43 .setChainedTransactions(chainedTransactions)