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 | */ |
pankaj | ea0acef | 2014-10-07 15:01:47 -0700 | [diff] [blame] | 12 | @Command(scope = "onos", name = "simple-netty-server", |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 13 | description = "Starts the simple netty server") |
| 14 | public class SimpleNettyServerCommand extends AbstractShellCommand { |
| 15 | |
pankaj | ea0acef | 2014-10-07 15:01:47 -0700 | [diff] [blame] | 16 | //FIXME: Replace these with parameters for |
pankaj | f49b45e | 2014-10-07 14:24:22 -0700 | [diff] [blame] | 17 | @Argument(index = 0, name = "serverIp", description = "Server IP address", |
| 18 | required = false, multiValued = false) |
| 19 | String serverIp = "127.0.0.1"; |
| 20 | |
| 21 | @Argument(index = 1, name = "workers", description = "IO workers", |
| 22 | required = false, multiValued = false) |
| 23 | String workers = "6"; |
| 24 | |
| 25 | @Argument(index = 2, name = "messageLength", description = "Message length (bytes)", |
| 26 | required = false, multiValued = false) |
| 27 | String messageLength = "128"; |
| 28 | |
| 29 | @Override |
| 30 | protected void execute() { |
| 31 | try { |
| 32 | startStandalone(new String[]{serverIp, workers, messageLength}); |
| 33 | } catch (Exception e) { |
| 34 | error("Unable to start server %s", e); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | } |