Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame^] | 1 | /* |
| 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 | */ |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 19 | package org.onlab.onos.foo; |
| 20 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 21 | import org.apache.karaf.shell.commands.Argument; |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 22 | import org.apache.karaf.shell.commands.Command; |
| 23 | import org.onlab.onos.cli.AbstractShellCommand; |
| 24 | |
| 25 | import 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") |
| 32 | public class TestIOClientCommand extends AbstractShellCommand { |
| 33 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 34 | @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) |
tom | 14dc4d0 | 2014-09-26 12:43:14 -0700 | [diff] [blame] | 44 | String messageCount = "1000000"; |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 45 | |
| 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) |
tom | 14dc4d0 | 2014-09-26 12:43:14 -0700 | [diff] [blame] | 52 | String timeoutSecs = "60"; |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 53 | |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 54 | @Override |
| 55 | protected void execute() { |
| 56 | try { |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 57 | startStandalone(new String[]{serverIp, workers, messageCount, messageLength, timeoutSecs}); |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 58 | } catch (Exception e) { |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 59 | error("Unable to start client %s", e); |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 60 | } |
| 61 | } |
| 62 | |
| 63 | } |