Vxlan/Gre co-existence,Alarms,tunnelstate,TR fixes
[vpnservice.git] / itm / itm-impl / src / main / java / org / opendaylight / vpnservice / itm / cli / TepDelete.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 package org.opendaylight.vpnservice.itm.cli;
9
10 import java.math.BigInteger;
11
12 import org.apache.karaf.shell.console.OsgiCommandSupport;
13 import org.apache.karaf.shell.commands.Argument;
14 import org.apache.karaf.shell.commands.Command;
15 import org.apache.karaf.shell.commands.Option;
16 import org.opendaylight.vpnservice.itm.api.IITMProvider;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 @Command(scope = "tep", name = "delete", description = "deleting a tunnel end point")
21 public class TepDelete extends OsgiCommandSupport {
22
23     @Argument(index = 0, name = "dpnId", description = "DPN-ID", required = false, multiValued = false)
24     private BigInteger dpnId;
25     @Argument(index = 1, name = "portName", description = "port-number", required = false, multiValued = false)
26     private String portName;
27     @Argument(index = 2, name = "vlanId", description = "vlan-id", required = false, multiValued = false)
28     private Integer vlanId;
29     @Argument(index = 3, name = "ipAddress", description = "ip-address", required = false, multiValued = false)
30     private String ipAddress;
31     @Argument(index = 4, name = "subnetMask", description = "subnet-Mask", required = false, multiValued = false)
32     private String subnetMask;
33     @Argument(index = 5, name = "gatewayIp", description = "gateway-ip", required = false, multiValued = false)
34     private String gatewayIp;
35     @Argument(index = 6, name = "transportZone", description = "transport_zone", required = false, multiValued = false)
36     private String transportZone;
37
38     private static final Logger logger = LoggerFactory.getLogger(TepDelete.class);
39     private IITMProvider itmProvider;
40
41     public void setItmProvider(IITMProvider itmProvider) {
42         this.itmProvider = itmProvider;
43     }
44     @Override
45     protected Object doExecute() throws Exception {
46
47         if (dpnId == null || portName == null || vlanId == null || ipAddress == null || subnetMask == null
48                         || transportZone == null) {
49             System.out.println("Insufficient Arguments");
50             System.out.println("Correct Usage : exec tep-delete dpnId portName vlanId ipAddress subnetMask gatewayIp transportZone");
51             return null;
52         }
53         itmProvider.deleteVtep(dpnId, portName, vlanId, ipAddress, subnetMask, gatewayIp, transportZone);        
54         logger.trace("Executing delete TEP command");
55
56         return null;
57
58     }
59 }