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;
12 import org.apache.karaf.shell.commands.Command;
13 import org.apache.karaf.shell.console.OsgiCommandSupport;
14 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
15 import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 @Command(scope = "vlan", name = "show", description = "view the configured vlan ports")
21 public class ShowVlan extends OsgiCommandSupport {
22 private static final Logger LOG = LoggerFactory.getLogger(ShowVlan.class);
23 private IInterfaceManager interfaceManager;
25 public void setInterfaceManager(IInterfaceManager interfaceManager) {
26 this.interfaceManager = interfaceManager;
30 protected Object doExecute() {
31 LOG.debug("Executing show VLAN command");
32 List<Interface> vlanList = interfaceManager.getVlanInterfaces();
33 if (!vlanList.isEmpty()) {
34 IfmCLIUtil.showVlanHeaderOutput(session);
36 for (Interface iface : vlanList) {
37 InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDSCache(iface.getName());
38 IfmCLIUtil.showVlanOutput(ifaceState, iface, session);