blob: 5fdcb7a214783f8b77e32eea0570f8a0f924c5e2 [file] [log] [blame]
Thomas Vachuskaa8e74772018-02-26 11:33:35 -08001/*
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 */
16package org.onosproject.routescale;
17
Ray Milkey86ad7bb2018-09-27 12:32:28 -070018import org.apache.karaf.shell.api.action.Argument;
19import org.apache.karaf.shell.api.action.Command;
Ray Milkey7a2dee52018-09-28 10:58:28 -070020import org.apache.karaf.shell.api.action.lifecycle.Service;
Thomas Vachuskafa615492018-03-19 09:11:51 -070021import org.onosproject.cfg.ComponentConfigService;
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080022import org.onosproject.cli.AbstractShellCommand;
23
24/**
25 * Creates the specified number of routes for scale testing.
26 */
Ray Milkey7a2dee52018-09-28 10:58:28 -070027@Service
Thomas Vachuskafa615492018-03-19 09:11:51 -070028@Command(scope = "onos", name = "scale-routes",
29 description = "Sets the specified number of routes for scale testing")
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080030public class CreateRoutes extends AbstractShellCommand {
31
Thomas Vachuskafa615492018-03-19 09:11:51 -070032 @Argument(index = 0, name = "routeCount", description = "Number of routes to maintain",
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080033 required = true)
34 int routeCount;
35
36 @Override
Ray Milkey86ad7bb2018-09-27 12:32:28 -070037 protected void doExecute() {
Thomas Vachuskafa615492018-03-19 09:11:51 -070038 ComponentConfigService service = get(ComponentConfigService.class);
Thomas Vachuska6205f692018-03-21 12:22:04 -070039 service.setProperty("org.onosproject.routescale.ScaleTestManager",
Thomas Vachuskafa615492018-03-19 09:11:51 -070040 "routeCount", String.valueOf(routeCount));
41
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080042 }
43
44}