pankaj

Add port as for simple-netty-server

...@@ -18,7 +18,8 @@ import org.slf4j.LoggerFactory; ...@@ -18,7 +18,8 @@ import org.slf4j.LoggerFactory;
18 } 18 }
19 19
20 public static void startStandalone(String[] args) throws Exception { 20 public static void startStandalone(String[] args) throws Exception {
21 - NettyMessagingService server = new NettyMessagingService(8081); 21 + int port = args.length > 0 ? Integer.parseInt(args[0]) : 8081;
22 + NettyMessagingService server = new NettyMessagingService(port);
22 server.activate(); 23 server.activate();
23 server.registerHandler("simple", new NettyLoggingHandler()); 24 server.registerHandler("simple", new NettyLoggingHandler());
24 server.registerHandler("echo", new NettyEchoHandler()); 25 server.registerHandler("echo", new NettyEchoHandler());
......
...@@ -14,22 +14,15 @@ import org.onlab.onos.cli.AbstractShellCommand; ...@@ -14,22 +14,15 @@ import org.onlab.onos.cli.AbstractShellCommand;
14 public class SimpleNettyServerCommand extends AbstractShellCommand { 14 public class SimpleNettyServerCommand extends AbstractShellCommand {
15 15
16 //FIXME: Replace these with parameters for 16 //FIXME: Replace these with parameters for
17 - @Argument(index = 0, name = "serverIp", description = "Server IP address", 17 + @Argument(index = 0, name = "port", description = "Port to listen",
18 required = false, multiValued = false) 18 required = false, multiValued = false)
19 - String serverIp = "127.0.0.1"; 19 + String port = "8081";
20 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 21
29 @Override 22 @Override
30 protected void execute() { 23 protected void execute() {
31 try { 24 try {
32 - startStandalone(new String[]{serverIp, workers, messageLength}); 25 + startStandalone(new String[]{port});
33 } catch (Exception e) { 26 } catch (Exception e) {
34 error("Unable to start server %s", e); 27 error("Unable to start server %s", e);
35 } 28 }
......