Switch to JDT annotations for Nullable and NonNull
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / cli / ElanInterfaceUpdate.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 java.util.List;
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.eclipse.jdt.annotation.Nullable;
15 import org.opendaylight.netvirt.elanmanager.api.IElanService;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 @Command(scope = "elanInterface", name = "update", description = "updating Elan Interface")
20 public class ElanInterfaceUpdate extends OsgiCommandSupport {
21
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,
27                 multiValued = true)
28     private List<String> staticMacAddresses;
29     @Argument(index = 3, name = "elanInterfaceDescr", description = "ELAN Interface-Description", required = false,
30                 multiValued = false)
31     private String elanInterfaceDescr;
32     private static final Logger LOG = LoggerFactory.getLogger(ElanInterfaceUpdate.class);
33     private IElanService elanProvider;
34
35     public void setElanProvider(IElanService elanServiceProvider) {
36         this.elanProvider = elanServiceProvider;
37     }
38
39     @Override
40     @Nullable
41     protected Object doExecute() {
42         LOG.debug("Executing elanInterface update command for elanName:{}, interfaceName:{}, staticMacAddresses:{},"
43                 + "elanInterfaceDescr:{}", elanName, interfaceName, staticMacAddresses, elanInterfaceDescr);
44         elanProvider.updateElanInterface(elanName, interfaceName, staticMacAddresses, elanInterfaceDescr);
45         return null;
46     }
47 }
48