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