8a92cd70961e2f3951b1e4cd106f24235767c8c0
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / cli / StaticMacAdd.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 org.apache.karaf.shell.commands.Argument;
11 import org.apache.karaf.shell.commands.Command;
12 import org.apache.karaf.shell.console.OsgiCommandSupport;
13 import org.opendaylight.netvirt.elanmanager.api.IElanService;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16
17 @Command(scope = "staticMac", name = "add", description = "adding Static Mac Address")
18 public class StaticMacAdd extends OsgiCommandSupport {
19
20     @Argument(index = 0, name = "elanName", description = "ELAN-NAME", required = true, multiValued = false)
21     private String elanName;
22     @Argument(index = 1, name = "interfaceName", description = "InterfaceName", required = true, multiValued = false)
23     private String interfaceName;
24     @Argument(index = 2, name = "staticMacAddress", description = "StaticMacAddress", required = true,
25             multiValued = false)
26     private String staticMacAddress;
27     private static final Logger LOG = LoggerFactory.getLogger(StaticMacAdd.class);
28     private IElanService elanProvider;
29
30     public void setElanProvider(IElanService elanServiceProvider) {
31         this.elanProvider = elanServiceProvider;
32     }
33
34     @Override
35     protected Object doExecute() {
36         LOG.debug("Executing create ElanInterface command" + "\t" + elanName + "\t" + interfaceName + "\t"
37                 + staticMacAddress + "\t");
38         elanProvider.addStaticMacAddress(elanName, interfaceName, staticMacAddress);
39         return null;
40     }
41 }