Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 2 | * Copyright 2014 Open Networking Laboratory |
Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 3 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 4 | * 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 Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 7 | * |
Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 8 | * 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 Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 15 | */ |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 16 | package org.onlab.onos.foo; |
| 17 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 18 | import org.apache.karaf.shell.commands.Argument; |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 19 | import org.apache.karaf.shell.commands.Command; |
| 20 | import org.onlab.onos.cli.AbstractShellCommand; |
| 21 | |
| 22 | import 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") |
| 29 | public class TestIOClientCommand extends AbstractShellCommand { |
| 30 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 31 | @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) |
tom | 14dc4d0 | 2014-09-26 12:43:14 -0700 | [diff] [blame] | 41 | String messageCount = "1000000"; |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 42 | |
| 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) |
tom | 14dc4d0 | 2014-09-26 12:43:14 -0700 | [diff] [blame] | 49 | String timeoutSecs = "60"; |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 50 | |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 51 | @Override |
| 52 | protected void execute() { |
| 53 | try { |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 54 | startStandalone(new String[]{serverIp, workers, messageCount, messageLength, timeoutSecs}); |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 55 | } catch (Exception e) { |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 56 | error("Unable to start client %s", e); |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 57 | } |
| 58 | } |
| 59 | |
| 60 | } |