Vxlan/Gre co-existence,Alarms,tunnelstate,TR fixes
[vpnservice.git] / itm / itm-impl / src / main / java / org / opendaylight / vpnservice / itm / cli / TepConfigureTunnelType.java
1 /*
2  * Copyright (c) 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.itm.cli;
10
11 import org.apache.karaf.shell.commands.Argument;
12 import org.apache.karaf.shell.commands.Command;
13 import org.apache.karaf.shell.console.OsgiCommandSupport;
14 import org.opendaylight.vpnservice.itm.api.IITMProvider;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18
19 @Command(scope = "tep", name = "configure-tunnelType",
20         description = "configuring the tunnel type for a transport zone")
21 public class TepConfigureTunnelType extends OsgiCommandSupport {
22
23     @Argument(index = 0, name = "TransportZoneName", description = "TransportZoneName", required = true, multiValued = false)
24     private String tZoneName;
25     @Argument(index = 1, name = "TunnelType", description = "Tunnel-Type", required = true, multiValued = false)
26     private String tunnelType;
27
28
29     private static final Logger LOG = LoggerFactory.getLogger(TepConfigureTunnelType.class);
30
31     private IITMProvider itmProvider;
32
33     public void setItmProvider(IITMProvider itmProvider) {
34         this.itmProvider = itmProvider;
35     }
36
37     @Override
38     protected Object doExecute() {
39         try {
40             LOG.debug("TepConfigureTunnelType: configureTunnelType {} for transportZone {}", tunnelType, tZoneName);
41             itmProvider.configureTunnelType(tZoneName, tunnelType);
42         } catch (IllegalArgumentException e) {
43             System.out.println(e.getMessage());
44         } catch (Exception e) {
45             System.out.println(e.getMessage());
46             LOG.error("Exception occurred during execution of command \"tep:configure-tunnelType\": ", e);
47         }
48         return null;
49     }
50
51 }