blob: d738b74ee37b1a4f086a48fc3f8b6d68e9abc969 [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
18import org.apache.karaf.shell.commands.Argument;
19import org.apache.karaf.shell.commands.Command;
Thomas Vachuskafa615492018-03-19 09:11:51 -070020import org.onosproject.cfg.ComponentConfigService;
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080021import org.onosproject.cli.AbstractShellCommand;
22
23/**
24 * Creates the specified number of routes for scale testing.
25 */
Thomas Vachuskafa615492018-03-19 09:11:51 -070026@Command(scope = "onos", name = "scale-routes",
27 description = "Sets the specified number of routes for scale testing")
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080028public class CreateRoutes extends AbstractShellCommand {
29
Thomas Vachuskafa615492018-03-19 09:11:51 -070030 @Argument(index = 0, name = "routeCount", description = "Number of routes to maintain",
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080031 required = true)
32 int routeCount;
33
34 @Override
35 protected void execute() {
Thomas Vachuskafa615492018-03-19 09:11:51 -070036 ComponentConfigService service = get(ComponentConfigService.class);
37 service.setProperty("org.onosproject.routescale.ScaleManager",
38 "routeCount", String.valueOf(routeCount));
39
Thomas Vachuskaa8e74772018-02-26 11:33:35 -080040 }
41
42}