blob: 37a0a70fb2cba34f3b4985368484620cb268c6f7 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
tomf110fff2014-09-26 00:38:18 -070019package org.onlab.onos.foo;
20
tomf7e13b02014-09-26 11:12:25 -070021import org.apache.karaf.shell.commands.Argument;
tomf110fff2014-09-26 00:38:18 -070022import org.apache.karaf.shell.commands.Command;
23import org.onlab.onos.cli.AbstractShellCommand;
24
25import static org.onlab.onos.foo.IOLoopTestClient.startStandalone;
26
27/**
28 * Starts the test IO loop client.
29 */
30@Command(scope = "onos", name = "test-io-client",
31 description = "Starts the test IO loop client")
32public class TestIOClientCommand extends AbstractShellCommand {
33
tomf7e13b02014-09-26 11:12:25 -070034 @Argument(index = 0, name = "serverIp", description = "Server IP address",
35 required = false, multiValued = false)
36 String serverIp = "127.0.0.1";
37
38 @Argument(index = 1, name = "workers", description = "IO workers",
39 required = false, multiValued = false)
40 String workers = "6";
41
42 @Argument(index = 2, name = "messageCount", description = "Message count",
43 required = false, multiValued = false)
tom14dc4d02014-09-26 12:43:14 -070044 String messageCount = "1000000";
tomf7e13b02014-09-26 11:12:25 -070045
46 @Argument(index = 3, name = "messageLength", description = "Message length (bytes)",
47 required = false, multiValued = false)
48 String messageLength = "128";
49
50 @Argument(index = 4, name = "timeoutSecs", description = "Test timeout (seconds)",
51 required = false, multiValued = false)
tom14dc4d02014-09-26 12:43:14 -070052 String timeoutSecs = "60";
tomf7e13b02014-09-26 11:12:25 -070053
tomf110fff2014-09-26 00:38:18 -070054 @Override
55 protected void execute() {
56 try {
tomf7e13b02014-09-26 11:12:25 -070057 startStandalone(new String[]{serverIp, workers, messageCount, messageLength, timeoutSecs});
tomf110fff2014-09-26 00:38:18 -070058 } catch (Exception e) {
tomf7e13b02014-09-26 11:12:25 -070059 error("Unable to start client %s", e);
tomf110fff2014-09-26 00:38:18 -070060 }
61 }
62
63}