2 * Copyright (c) 2016 - 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.genius.interfacemanager.shell;
10 import java.util.List;
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.console.OsgiCommandSupport;
13 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
14 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 @Command(scope = "vlan", name = "show", description = "view the configured vlan ports")
20 public class ShowVlan extends OsgiCommandSupport {
21 private static final Logger LOG = LoggerFactory.getLogger(ShowVlan.class);
22 private IInterfaceManager interfaceManager;
24 public void setInterfaceManager(IInterfaceManager interfaceManager) {
25 this.interfaceManager = interfaceManager;
29 protected Object doExecute() {
30 LOG.debug("Executing show VLAN command");
31 List<Interface> vlanList = interfaceManager.getVlanInterfaces();
32 if (!vlanList.isEmpty()) {
33 IfmCLIUtil.showVlanHeaderOutput(session);
35 for (Interface iface : vlanList) {
36 InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDSCache(iface.getName());
37 IfmCLIUtil.showVlanOutput(ifaceState, iface, session);