2 * Copyright (c) 2016 - 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.controller.md.sal.binding.api.DataBroker;
14 import org.opendaylight.vpnservice.interfacemgr.globals.InterfaceInfo;
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 = "vxlan", name = "show", description = "view the configured vxlan ports")
24 public class ShowVxlan extends OsgiCommandSupport {
25 private static final Logger logger = LoggerFactory.getLogger(ShowVxlan.class);
26 private IInterfaceManager interfaceManager;
27 private DataBroker dataBroker;
29 public void setInterfaceManager(IInterfaceManager interfaceManager) {
30 this.interfaceManager = interfaceManager;
33 public void setDataBroker(DataBroker dataBroker){
34 this.dataBroker = dataBroker;
38 protected Object doExecute() throws Exception {
39 logger.debug("Executing show Vxlan command");
40 List<Interface> vxlanList = interfaceManager.getVxlanInterfaces();
41 if (!vxlanList.isEmpty()) {
42 IfmCLIUtil.showVxlanHeaderOutput();
44 for (Interface iface : vxlanList) {
45 InterfaceInfo ifaceState = interfaceManager.getInterfaceInfoFromOperationalDataStore(iface.getName());
46 IfmCLIUtil.showVxlanOutput(iface, ifaceState);