blob: c83871ee0af80a2ad9fdd3266d8871c8b62d1466 [file] [log] [blame]
Jonathan Hart5af5f142016-01-28 18:45:27 -08001/*
2 * Copyright 2016 Open Networking Laboratory
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.onosproject.pim.cli;
18
19import org.apache.karaf.shell.commands.Command;
20import org.onosproject.cli.AbstractShellCommand;
21import org.onosproject.pim.impl.PIMInterface;
22import org.onosproject.pim.impl.PIMInterfaceService;
23
24import java.util.Set;
25
26/**
27 * Lists the interfaces where PIM is enabled.
28 */
29@Command(scope = "onos", name = "pim-interfaces",
30 description = "Lists the interfaces where PIM is enabled")
31public class PimInterfacesListCommand extends AbstractShellCommand {
32
33 private static final String FORMAT = "interfaceName=%s, holdTime=%s, priority=%s, genId=%s";
34
35 @Override
36 protected void execute() {
37 PIMInterfaceService interfaceService = get(PIMInterfaceService.class);
38
39 Set<PIMInterface> interfaces = interfaceService.getPimInterfaces();
40
41 interfaces.forEach(
42 pimIntf -> print(FORMAT, pimIntf.getInterface().name(),
43 pimIntf.getHoldtime(), pimIntf.getPriority(),
44 pimIntf.getGenerationId()));
45 }
46
47}