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