Updated BgpManager for Be
[vpnservice.git] / neutronvpn / neutronvpn-shell / src / main / java / org / opendaylight / vpnservice / neutronvpn / shell / ShowVpnConfigCommand.java
1 /*
2  * Copyright (c) 2015 - 2016 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.vpnservice.neutronvpn.shell;
10
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.commands.Option;
13 import org.apache.karaf.shell.console.OsgiCommandSupport;
14 import org.opendaylight.vpnservice.neutronvpn.interfaces.INeutronVpnManager;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
16
17 @Command(scope = "vpnservice", name = "l3vpn-config-show", description = "Displays Neutron L3VPN configuration")
18 public class ShowVpnConfigCommand extends OsgiCommandSupport {
19
20     @Option(name = "-vid", aliases = {"--vpnid"}, description = "VPN ID", required = false, multiValued = false)
21     String vid;
22
23     private INeutronVpnManager neutronVpnManager;
24
25     public void setNeutronVpnManager(INeutronVpnManager neutronVpnManager) {
26         this.neutronVpnManager = neutronVpnManager;
27     }
28
29     @Override
30     protected Object doExecute() throws Exception {
31
32         Uuid vuuid = null;
33         if (vid != null) {
34             vuuid = new Uuid(vid);
35         }
36
37         for (String p : neutronVpnManager.showVpnConfigCLI(vuuid)) {
38             System.out.println(p);
39         }
40         return null;
41     }
42 }