03b4991681c77d5b1089f279a4987b4590cfee00
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / cli / StaticMacDelete.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.netvirt.elan.cli;
9
10 import javax.annotation.Nullable;
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.netvirt.elanmanager.api.IElanService;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
17
18 @Command(scope = "staticMac", name = "delete", description = "deleting Static Mac Address")
19 public class StaticMacDelete  extends OsgiCommandSupport {
20
21     @Argument(index = 0, name = "elanName", description = "ELAN-NAME", required = true, multiValued = false)
22     private String elanName;
23     @Argument(index = 1, name = "interfaceName", description = "InterfaceName", required = true, multiValued = false)
24     private String interfaceName;
25     @Argument(index = 2, name = "staticMacAddress", description = "StaticMacAddress", required = true,
26                 multiValued = false)
27     private String staticMacAddress;
28     private static final Logger LOG = LoggerFactory.getLogger(StaticMacDelete.class);
29     private IElanService elanProvider;
30
31     public void setElanProvider(IElanService elanServiceProvider) {
32         this.elanProvider = elanServiceProvider;
33     }
34
35     @Override
36     @Nullable
37     protected Object doExecute() {
38         LOG.debug("Executing static mac delete command for elanName:{}, interfaceName:{}, staticMacAddress:{}",
39                 elanName, interfaceName, staticMacAddress);
40         elanProvider.deleteStaticMacAddress(interfaceName, staticMacAddress);
41         return null;
42     }
43 }