blob: 109d0cfc7e85b27a72bf0c70bced8351f0b4bbe2 [file] [log] [blame]
Thomas Vachuska54c36ae2021-03-02 22:43:16 -08001/*
2 * Copyright 2015-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.provider.nil.cli;
17
18import org.apache.karaf.shell.api.action.Argument;
19import org.apache.karaf.shell.api.action.Command;
20import org.apache.karaf.shell.api.action.Completion;
21import org.apache.karaf.shell.api.action.lifecycle.Service;
22import org.onosproject.cfg.ComponentConfigService;
23import org.onosproject.cli.AbstractShellCommand;
24import org.onosproject.cli.StartStopCompleter;
25import org.onosproject.provider.nil.NullProviders;
26
27import static org.onosproject.cli.StartStopCompleter.START;
28
29/**
30 * Starts or stops topology simulation.
31 */
32@Service
33@Command(scope = "onos", name = "null-port-stats",
34 description = "Starts or stops port statistics simulation")
35public class NullPortStatsControlCommand extends AbstractShellCommand {
36
37 @Argument(index = 0, name = "cmd", description = "Control command: start/stop",
38 required = true)
39 @Completion(StartStopCompleter.class)
40 String cmd = null;
41
42 @Override
43 protected void doExecute() {
44 ComponentConfigService service = get(ComponentConfigService.class);
45 NullProviders npService = get(NullProviders.class);
46 npService.enablePortStats(cmd.equals(START));
47 }
48
49}