blob: 0355b641e557fe9579d9f68f6a4b62050f03b162 [file] [log] [blame]
kalagesa1a1867a2017-03-07 13:06:41 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
kalagesa1a1867a2017-03-07 13:06:41 +05303 *
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.fwd;
Ray Milkey86ad7bb2018-09-27 12:32:28 -070017import org.apache.karaf.shell.api.action.Command;
Ray Milkey6c2cbe82018-10-09 12:03:49 -070018import org.apache.karaf.shell.api.action.Completion;
Ray Milkey7a2dee52018-09-28 10:58:28 -070019import org.apache.karaf.shell.api.action.lifecycle.Service;
kalagesa1a1867a2017-03-07 13:06:41 +053020import org.onosproject.cli.AbstractShellCommand;
Ray Milkey86ad7bb2018-09-27 12:32:28 -070021import org.apache.karaf.shell.api.action.Argument;
kalagesa1a1867a2017-03-07 13:06:41 +053022import org.onlab.packet.MacAddress;
23
24/**
25 * Sample reactive forwarding application.
26 */
Ray Milkey7a2dee52018-09-28 10:58:28 -070027@Service
kalagesa1a1867a2017-03-07 13:06:41 +053028@Command(scope = "onos", name = "reactive-fwd-metrics",
29 description = "List all the metrics of reactive fwd app based on mac address")
30public class ReactiveForwardingCommand extends AbstractShellCommand {
31 @Argument(index = 0, name = "mac", description = "One Mac Address",
32 required = false, multiValued = false)
Ray Milkey6c2cbe82018-10-09 12:03:49 -070033 @Completion(MacAddressCompleter.class)
kalagesa1a1867a2017-03-07 13:06:41 +053034 String mac = null;
35 @Override
Ray Milkey86ad7bb2018-09-27 12:32:28 -070036 protected void doExecute() {
kalagesa1a1867a2017-03-07 13:06:41 +053037 ReactiveForwarding reactiveForwardingService = AbstractShellCommand.get(ReactiveForwarding.class);
38 MacAddress macAddress = null;
39 if (mac != null) {
40 macAddress = MacAddress.valueOf(mac);
41 }
42 reactiveForwardingService.printMetric(macAddress);
43 }
44}