2 * Copyright (c) 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.itm.cli;
10 import java.math.BigInteger;
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;
20 @Command(scope = "tep", name = "delete", description = "deleting a tunnel end point")
21 public class TepDelete extends OsgiCommandSupport {
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;
38 private static final Logger logger = LoggerFactory.getLogger(TepDelete.class);
39 private IITMProvider itmProvider;
41 public void setItmProvider(IITMProvider itmProvider) {
42 this.itmProvider = itmProvider;
45 protected Object doExecute() throws Exception {
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");
53 itmProvider.deleteVtep(dpnId, portName, vlanId, ipAddress, subnetMask, gatewayIp, transportZone);
54 logger.trace("Executing delete TEP command");