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.netvirt.elan.cli;
10 import java.util.List;
11 import javax.annotation.Nullable;
12 import org.apache.karaf.shell.commands.Argument;
13 import org.apache.karaf.shell.commands.Command;
14 import org.apache.karaf.shell.console.OsgiCommandSupport;
15 import org.opendaylight.netvirt.elanmanager.api.IElanService;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 @Command(scope = "elanInterface", name = "add", description = "adding Elan Interface")
20 public class ElanInterfaceAdd extends OsgiCommandSupport {
22 @Argument(index = 0, name = "elanName", description = "ELAN-NAME", required = true, multiValued = false)
23 private String elanName;
24 @Argument(index = 1, name = "interfaceName", description = "InterfaceName", required = true, multiValued = false)
25 private String interfaceName;
26 @Argument(index = 2, name = "staticMacAddresses", description = "StaticMacAddresses", required = false,
28 private List<String> staticMacAddresses;
29 @Argument(index = 3, name = "elanInterfaceDescr", description = "ELAN Interface-Description", required = false,
31 private String elanInterfaceDescr;
32 private static final Logger LOG = LoggerFactory.getLogger(ElanInterfaceAdd.class);
33 private IElanService elanProvider;
35 public void setElanProvider(IElanService elanServiceProvider) {
36 this.elanProvider = elanServiceProvider;
41 protected Object doExecute() {
42 LOG.debug("Executing create ElanInterface command for elanName:{}, interfaceName:{}, staticMacAddresses:{},"
43 + "elanInterfaceDescr:{}",elanName, interfaceName, staticMacAddresses, elanInterfaceDescr);
44 elanProvider.addElanInterface(elanName, interfaceName, staticMacAddresses, elanInterfaceDescr);