blob: ff5eb8ee10a4ebdb9ae30dd4cb0a8a98495790fd [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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 Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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 Vachuska781d18b2014-10-27 10:31:25 -070015 */
tomf110fff2014-09-26 00:38:18 -070016package org.onlab.onos.foo;
17
tomf7e13b02014-09-26 11:12:25 -070018import org.apache.karaf.shell.commands.Argument;
tomf110fff2014-09-26 00:38:18 -070019import org.apache.karaf.shell.commands.Command;
20import org.onlab.onos.cli.AbstractShellCommand;
21
22import static org.onlab.onos.foo.IOLoopTestServer.startStandalone;
23
tomf110fff2014-09-26 00:38:18 -070024/**
25 * Starts the test IO loop server.
26 */
27@Command(scope = "onos", name = "test-io-server",
28 description = "Starts the test IO loop server")
29public class TestIOServerCommand extends AbstractShellCommand {
30
tomf7e13b02014-09-26 11:12:25 -070031 @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 = "messageLength", description = "Message length (bytes)",
40 required = false, multiValued = false)
41 String messageLength = "128";
42
tomf110fff2014-09-26 00:38:18 -070043 @Override
44 protected void execute() {
45 try {
tomf7e13b02014-09-26 11:12:25 -070046 startStandalone(new String[]{serverIp, workers, messageLength});
tomf110fff2014-09-26 00:38:18 -070047 } catch (Exception e) {
48 error("Unable to start server %s", e);
49 }
50 }
51
52}