2 * Copyright (c) 2016 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.vpnservice.interfacemgr.shell;
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.console.OsgiCommandSupport;
13 import org.opendaylight.vpnservice.interfacemgr.globals.InterfaceInfo;
14 import org.opendaylight.vpnservice.interfacemgr.globals.VlanInterfaceInfo;
15 import org.opendaylight.vpnservice.interfacemgr.interfaces.IInterfaceManager;
16 import org.opendaylight.vpnservice.interfacemgr.shell.IfmCLIUtil;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 import java.util.List;
23 @Command(scope = "vlan", name = "show", description = "view the configured vlan ports")
24 public class ShowVlan extends OsgiCommandSupport {
25 private static final Logger logger = LoggerFactory.getLogger(ShowVlan.class);
26 private IInterfaceManager interfaceManager;
28 public void setInterfaceManager(IInterfaceManager interfaceManager) {
29 this.interfaceManager = interfaceManager;
33 protected Object doExecute() throws Exception {
34 logger.debug("Executing show VLAN command");
35 List<Interface> vlanList = interfaceManager.getVlanInterfaces();
36 if (!vlanList.isEmpty()) {
37 IfmCLIUtil.showVlanHeaderOutput();
39 for (Interface iface : vlanList) {
40 InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDataStore(iface.getName());
41 IfmCLIUtil.showVlanOutput(ifaceState, iface);