blob: 4b13b8a35f6b20f330a326717bffdb9d097ab727 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
tomf110fff2014-09-26 00:38:18 -070016package org.onlab.onos.foo;
17
tomf7e13b02014-09-26 11:12:25 -070018import org.apache.karaf.shell.commands.Argument;
tomf110fff2014-09-26 00:38:18 -070019import org.apache.karaf.shell.commands.Command;
20import org.onlab.onos.cli.AbstractShellCommand;
21
22import static org.onlab.onos.foo.IOLoopTestClient.startStandalone;
23
24/**
25 * Starts the test IO loop client.
26 */
27@Command(scope = "onos", name = "test-io-client",
28 description = "Starts the test IO loop client")
29public class TestIOClientCommand extends AbstractShellCommand {
30
tomf7e13b02014-09-26 11:12:25 -070031 @Argument(index = 0, name = "serverIp", description = "Server IP address",
32 required = false, multiValued = false)
33 String serverIp = "127.0.0.1";
34
35 @Argument(index = 1, name = "workers", description = "IO workers",
36 required = false, multiValued = false)
37 String workers = "6";
38
39 @Argument(index = 2, name = "messageCount", description = "Message count",
40 required = false, multiValued = false)
tom14dc4d02014-09-26 12:43:14 -070041 String messageCount = "1000000";
tomf7e13b02014-09-26 11:12:25 -070042
43 @Argument(index = 3, name = "messageLength", description = "Message length (bytes)",
44 required = false, multiValued = false)
45 String messageLength = "128";
46
47 @Argument(index = 4, name = "timeoutSecs", description = "Test timeout (seconds)",
48 required = false, multiValued = false)
tom14dc4d02014-09-26 12:43:14 -070049 String timeoutSecs = "60";
tomf7e13b02014-09-26 11:12:25 -070050
tomf110fff2014-09-26 00:38:18 -070051 @Override
52 protected void execute() {
53 try {
tomf7e13b02014-09-26 11:12:25 -070054 startStandalone(new String[]{serverIp, workers, messageCount, messageLength, timeoutSecs});
tomf110fff2014-09-26 00:38:18 -070055 } catch (Exception e) {
tomf7e13b02014-09-26 11:12:25 -070056 error("Unable to start client %s", e);
tomf110fff2014-09-26 00:38:18 -070057 }
58 }
59
60}