blob: 5bf7e69cde84c07c45f31b47781086c3e1d49704 [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 */
pankajf49b45e2014-10-07 14:24:22 -070016package org.onlab.onos.foo;
17
18import static org.onlab.onos.foo.SimpleNettyClient.startStandalone;
pankaj9fc87592014-10-10 15:40:43 -070019import static org.onlab.onos.foo.SimpleNettyClient.stop;
pankajf49b45e2014-10-07 14:24:22 -070020
21import org.apache.karaf.shell.commands.Argument;
22import org.apache.karaf.shell.commands.Command;
23import org.onlab.onos.cli.AbstractShellCommand;
24
25/**
26 * Test Netty client performance.
27 */
28@Command(scope = "onos", name = "simple-netty-client",
pankaj5364ca92014-10-09 14:11:58 -070029 description = "Starts simple Netty client")
pankajf49b45e2014-10-07 14:24:22 -070030public class SimpleNettyClientCommand extends AbstractShellCommand {
31
pankajea0acef2014-10-07 15:01:47 -070032 //FIXME: replace these arguments with proper ones needed for the test.
pankajf0f80b22014-10-07 18:37:32 -070033 @Argument(index = 0, name = "hostname", description = "Server Hostname",
pankajf49b45e2014-10-07 14:24:22 -070034 required = false, multiValued = false)
pankaj28c35642014-10-08 16:42:36 -070035 String hostname = "localhost";
pankajf49b45e2014-10-07 14:24:22 -070036
pankaj31b8eab2014-10-08 18:14:08 -070037 @Argument(index = 1, name = "port", description = "Port",
pankajf49b45e2014-10-07 14:24:22 -070038 required = false, multiValued = false)
pankaj13373b52014-10-07 18:26:07 -070039 String port = "8081";
40
pankaj31b8eab2014-10-08 18:14:08 -070041 @Argument(index = 2, name = "warmupCount", description = "Warm-up count",
pankaj13373b52014-10-07 18:26:07 -070042 required = false, multiValued = false)
pankaj6245a7a2014-10-10 17:50:55 -070043 String warmupCount = "1000";
pankajf49b45e2014-10-07 14:24:22 -070044
pankaj31b8eab2014-10-08 18:14:08 -070045 @Argument(index = 3, name = "messageCount", description = "Message count",
pankajf49b45e2014-10-07 14:24:22 -070046 required = false, multiValued = false)
pankaj9fc87592014-10-10 15:40:43 -070047 String messageCount = "1000000";
pankajf49b45e2014-10-07 14:24:22 -070048
49 @Override
50 protected void execute() {
51 try {
pankaj28c35642014-10-08 16:42:36 -070052 startStandalone(new String[]{hostname, port, warmupCount, messageCount});
pankajf49b45e2014-10-07 14:24:22 -070053 } catch (Exception e) {
54 error("Unable to start client %s", e);
55 }
pankaj9fc87592014-10-10 15:40:43 -070056 stop();
pankajf49b45e2014-10-07 14:24:22 -070057 }
pankajf49b45e2014-10-07 14:24:22 -070058}