tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 1 | package org.onlab.onos.foo; |
| 2 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 3 | import org.apache.karaf.shell.commands.Argument; |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 4 | import org.apache.karaf.shell.commands.Command; |
| 5 | import org.onlab.onos.cli.AbstractShellCommand; |
| 6 | |
| 7 | import static org.onlab.onos.foo.IOLoopTestClient.startStandalone; |
| 8 | |
| 9 | /** |
| 10 | * Starts the test IO loop client. |
| 11 | */ |
| 12 | @Command(scope = "onos", name = "test-io-client", |
| 13 | description = "Starts the test IO loop client") |
| 14 | public class TestIOClientCommand extends AbstractShellCommand { |
| 15 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 16 | @Argument(index = 0, name = "serverIp", description = "Server IP address", |
| 17 | required = false, multiValued = false) |
| 18 | String serverIp = "127.0.0.1"; |
| 19 | |
| 20 | @Argument(index = 1, name = "workers", description = "IO workers", |
| 21 | required = false, multiValued = false) |
| 22 | String workers = "6"; |
| 23 | |
| 24 | @Argument(index = 2, name = "messageCount", description = "Message count", |
| 25 | required = false, multiValued = false) |
tom | 14dc4d0 | 2014-09-26 12:43:14 -0700 | [diff] [blame] | 26 | String messageCount = "1000000"; |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 27 | |
| 28 | @Argument(index = 3, name = "messageLength", description = "Message length (bytes)", |
| 29 | required = false, multiValued = false) |
| 30 | String messageLength = "128"; |
| 31 | |
| 32 | @Argument(index = 4, name = "timeoutSecs", description = "Test timeout (seconds)", |
| 33 | required = false, multiValued = false) |
tom | 14dc4d0 | 2014-09-26 12:43:14 -0700 | [diff] [blame] | 34 | String timeoutSecs = "60"; |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 35 | |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 36 | @Override |
| 37 | protected void execute() { |
| 38 | try { |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 39 | startStandalone(new String[]{serverIp, workers, messageCount, messageLength, timeoutSecs}); |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 40 | } catch (Exception e) { |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 41 | error("Unable to start client %s", e); |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 42 | } |
| 43 | } |
| 44 | |
| 45 | } |