Remove redundant names in paths
[netvirt.git] / elanmanager / impl / src / main / java / org / opendaylight / netvirt / elan / internal / InterfaceAddWorkerOnElanInterface.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.internal;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.List;
12 import java.util.concurrent.Callable;
13 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class InterfaceAddWorkerOnElanInterface implements Callable<List<ListenableFuture<Void>>> {
20
21     private final String key;
22     private final ElanInterface elanInterface;
23     private final ElanInstance elanInstance;
24     private final InterfaceInfo interfaceInfo;
25     private final ElanInterfaceManager dataChangeListener;
26     private final boolean isFirstInterfaceInDpn;
27     private static final Logger LOG = LoggerFactory.getLogger(InterfaceAddWorkerOnElanInterface.class);
28
29     public InterfaceAddWorkerOnElanInterface(String key, ElanInterface elanInterface, InterfaceInfo interfaceInfo,
30             ElanInstance elanInstance, boolean isFirstInterfaceInDpn, ElanInterfaceManager dataChangeListener) {
31         this.key = key;
32         this.elanInterface = elanInterface;
33         this.interfaceInfo = interfaceInfo;
34         this.elanInstance = elanInstance;
35         this.dataChangeListener = dataChangeListener;
36         this.isFirstInterfaceInDpn = isFirstInterfaceInDpn;
37     }
38
39     @Override
40     public String toString() {
41         return "InterfaceAddWorkerOnElanInterface [key=" + key + ", elanInterface=" + elanInterface + ", elanInstance="
42             + elanInstance + ", interfaceInfo=" + interfaceInfo + "]";
43     }
44
45
46     @Override
47     public List<ListenableFuture<Void>> call() throws Exception {
48         LOG.info("Handling elan interface {} add for elan {} ", elanInterface.getName(),
49                 elanInstance.getElanInstanceName());
50         return dataChangeListener.setupEntriesForElanInterface(elanInstance, elanInterface, interfaceInfo,
51                 isFirstInterfaceInDpn);
52     }
53
54 }