pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 1 | package org.onlab.onos.foo; |
| 2 | |
| 3 | import static org.onlab.onos.foo.SimpleNettyServer.startStandalone; |
| 4 | |
| 5 | import org.apache.karaf.shell.commands.Argument; |
| 6 | import org.apache.karaf.shell.commands.Command; |
| 7 | import org.onlab.onos.cli.AbstractShellCommand; |
| 8 | |
| 9 | /** |
| 10 | * Starts the Simple Netty server. |
| 11 | */ |
| 12 | @Command(scope = "onos", name = "test-netty-server", |
| 13 | description = "Starts the simple netty server") |
| 14 | public class SimpleNettyServerCommand extends AbstractShellCommand { |
| 15 | |
| 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 = "messageLength", description = "Message length (bytes)", |
| 25 | required = false, multiValued = false) |
| 26 | String messageLength = "128"; |
| 27 | |
| 28 | @Override |
| 29 | protected void execute() { |
| 30 | try { |
| 31 | startStandalone(new String[]{serverIp, workers, messageLength}); |
| 32 | } catch (Exception e) { |
| 33 | error("Unable to start server %s", e); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | } |