Thomas Vachuska | 781d18b | 2014-10-27 10:31:25 -0700 | [diff] [blame] | 1 | /* |
| 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 | */ |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 19 | package org.onlab.onos.foo; |
| 20 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 21 | import org.apache.karaf.shell.commands.Argument; |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 22 | import org.apache.karaf.shell.commands.Command; |
| 23 | import org.onlab.onos.cli.AbstractShellCommand; |
| 24 | |
| 25 | import static org.onlab.onos.foo.IOLoopTestServer.startStandalone; |
| 26 | |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 27 | /** |
| 28 | * Starts the test IO loop server. |
| 29 | */ |
| 30 | @Command(scope = "onos", name = "test-io-server", |
| 31 | description = "Starts the test IO loop server") |
| 32 | public class TestIOServerCommand extends AbstractShellCommand { |
| 33 | |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 34 | @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 | |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 46 | @Override |
| 47 | protected void execute() { |
| 48 | try { |
tom | f7e13b0 | 2014-09-26 11:12:25 -0700 | [diff] [blame] | 49 | startStandalone(new String[]{serverIp, workers, messageLength}); |
tom | f110fff | 2014-09-26 00:38:18 -0700 | [diff] [blame] | 50 | } catch (Exception e) { |
| 51 | error("Unable to start server %s", e); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | } |