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.internal;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.ArrayList;
12 import java.util.List;
13 import java.util.concurrent.Callable;
14 import org.opendaylight.genius.interfacemanager.globals.InterfaceInfo;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.interfaces.ElanInterface;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
20 public class InterfaceAddWorkerOnElanInterface implements Callable<List<ListenableFuture<Void>>> {
23 private ElanInterface elanInterface;
24 private ElanInstance elanInstance;
25 private InterfaceInfo interfaceInfo;
26 private ElanInterfaceManager dataChangeListener;
27 private boolean isFirstInterfaceInDpn;
28 private static final Logger LOG = LoggerFactory.getLogger(InterfaceAddWorkerOnElanInterface.class);
30 public InterfaceAddWorkerOnElanInterface(String key, ElanInterface elanInterface, InterfaceInfo interfaceInfo,
31 ElanInstance elanInstance, boolean isFirstInterfaceInDpn, ElanInterfaceManager dataChangeListener) {
34 this.elanInterface = elanInterface;
35 this.interfaceInfo = interfaceInfo;
36 this.elanInstance = elanInstance;
37 this.dataChangeListener = dataChangeListener;
38 this.isFirstInterfaceInDpn = isFirstInterfaceInDpn;
42 public String toString() {
43 return "InterfaceAddWorkerOnElanInterface [key=" + key + ", elanInterface=" + elanInterface + ", elanInstance="
44 + elanInstance + ", interfaceInfo=" + interfaceInfo + "]";
49 public List<ListenableFuture<Void>> call() throws Exception {
50 LOG.info("Handling elan interface {} add for elan {} ", elanInterface.getName(),
51 elanInstance.getElanInstanceName());
52 List<ListenableFuture<Void>> futures = new ArrayList<>();
53 dataChangeListener.setupEntriesForElanInterface(futures, elanInstance, elanInterface, interfaceInfo,
54 isFirstInterfaceInDpn);