blob: 83b518f236c7e943dad8e1c83b1c1dd0c04dae9f [file] [log] [blame]
Gamze Abaka33feef52019-02-27 08:16:47 +00001/*
2 * Copyright 2016-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
17package org.opencord.olt.cli;
18
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
21import org.onosproject.net.meter.MeterKey;
22import org.opencord.olt.AccessDeviceService;
23
24import java.util.List;
25import java.util.Map;
26
27@Command(scope = "onos", name = "volt-bpmeter-mappings",
28 description = "Shows information about bandwidthProfile-meterKey (device / meter) mappings")
29public class ShowBpMeterMappingsCommand extends AbstractShellCommand {
30
31 @Override
32 protected void execute() {
33 AccessDeviceService service = AbstractShellCommand.get(AccessDeviceService.class);
34 Map<String, List<MeterKey>> bpMeterMappings = service.getBpMeterMappings();
35 bpMeterMappings.forEach(this::display);
36 }
37
38 private void display(String bpInfo, List<MeterKey> meterKeyList) {
39 meterKeyList.forEach(meterKey ->
40 print("bpInfo=%s deviceId=%s meterId=%s",
41 bpInfo, meterKey.deviceId(), meterKey.meterId()));
42
43 }
44}