blob: 2566b83749ddfb474216df723805712e7702c0a7 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
tomf110fff2014-09-26 00:38:18 -070019package org.onlab.onos.foo;
20
tomf7e13b02014-09-26 11:12:25 -070021import org.apache.karaf.shell.commands.Argument;
tomf110fff2014-09-26 00:38:18 -070022import org.apache.karaf.shell.commands.Command;
23import org.onlab.onos.cli.AbstractShellCommand;
24
25import static org.onlab.onos.foo.IOLoopTestServer.startStandalone;
26
tomf110fff2014-09-26 00:38:18 -070027/**
28 * Starts the test IO loop server.
29 */
30@Command(scope = "onos", name = "test-io-server",
31 description = "Starts the test IO loop server")
32public class TestIOServerCommand extends AbstractShellCommand {
33
tomf7e13b02014-09-26 11:12:25 -070034 @Argument(index = 0, name = "serverIp", description = "Server IP address",
35 required = false, multiValued = false)
36 String serverIp = "127.0.0.1";
37
38 @Argument(index = 1, name = "workers", description = "IO workers",
39 required = false, multiValued = false)
40 String workers = "6";
41
42 @Argument(index = 2, name = "messageLength", description = "Message length (bytes)",
43 required = false, multiValued = false)
44 String messageLength = "128";
45
tomf110fff2014-09-26 00:38:18 -070046 @Override
47 protected void execute() {
48 try {
tomf7e13b02014-09-26 11:12:25 -070049 startStandalone(new String[]{serverIp, workers, messageLength});
tomf110fff2014-09-26 00:38:18 -070050 } catch (Exception e) {
51 error("Unable to start server %s", e);
52 }
53 }
54
55}