Thomas Vachuska | a8e7477 | 2018-02-26 11:33:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | * |
| 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 |
| 7 | * |
| 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. |
| 15 | */ |
| 16 | package org.onosproject.routescale; |
| 17 | |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame] | 18 | import org.apache.karaf.shell.api.action.Argument; |
| 19 | import org.apache.karaf.shell.api.action.Command; |
Ray Milkey | 7a2dee5 | 2018-09-28 10:58:28 -0700 | [diff] [blame] | 20 | import org.apache.karaf.shell.api.action.lifecycle.Service; |
Thomas Vachuska | fa61549 | 2018-03-19 09:11:51 -0700 | [diff] [blame] | 21 | import org.onosproject.cfg.ComponentConfigService; |
Thomas Vachuska | a8e7477 | 2018-02-26 11:33:35 -0800 | [diff] [blame] | 22 | import org.onosproject.cli.AbstractShellCommand; |
| 23 | |
| 24 | /** |
| 25 | * Creates the specified number of routes for scale testing. |
| 26 | */ |
Ray Milkey | 7a2dee5 | 2018-09-28 10:58:28 -0700 | [diff] [blame] | 27 | @Service |
Thomas Vachuska | fa61549 | 2018-03-19 09:11:51 -0700 | [diff] [blame] | 28 | @Command(scope = "onos", name = "scale-routes", |
| 29 | description = "Sets the specified number of routes for scale testing") |
Thomas Vachuska | a8e7477 | 2018-02-26 11:33:35 -0800 | [diff] [blame] | 30 | public class CreateRoutes extends AbstractShellCommand { |
| 31 | |
Thomas Vachuska | fa61549 | 2018-03-19 09:11:51 -0700 | [diff] [blame] | 32 | @Argument(index = 0, name = "routeCount", description = "Number of routes to maintain", |
Thomas Vachuska | a8e7477 | 2018-02-26 11:33:35 -0800 | [diff] [blame] | 33 | required = true) |
| 34 | int routeCount; |
| 35 | |
| 36 | @Override |
Ray Milkey | 86ad7bb | 2018-09-27 12:32:28 -0700 | [diff] [blame] | 37 | protected void doExecute() { |
Thomas Vachuska | fa61549 | 2018-03-19 09:11:51 -0700 | [diff] [blame] | 38 | ComponentConfigService service = get(ComponentConfigService.class); |
Thomas Vachuska | 6205f69 | 2018-03-21 12:22:04 -0700 | [diff] [blame] | 39 | service.setProperty("org.onosproject.routescale.ScaleTestManager", |
Thomas Vachuska | fa61549 | 2018-03-19 09:11:51 -0700 | [diff] [blame] | 40 | "routeCount", String.valueOf(routeCount)); |
| 41 | |
Thomas Vachuska | a8e7477 | 2018-02-26 11:33:35 -0800 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | } |