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