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.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;
19 public class InterfaceAddWorkerOnElanInterface implements Callable<List<ListenableFuture<Void>>> {
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);
29 public InterfaceAddWorkerOnElanInterface(String key, ElanInterface elanInterface, InterfaceInfo interfaceInfo,
30 ElanInstance elanInstance, boolean isFirstInterfaceInDpn, ElanInterfaceManager dataChangeListener) {
32 this.elanInterface = elanInterface;
33 this.interfaceInfo = interfaceInfo;
34 this.elanInstance = elanInstance;
35 this.dataChangeListener = dataChangeListener;
36 this.isFirstInterfaceInDpn = isFirstInterfaceInDpn;
40 public String toString() {
41 return "InterfaceAddWorkerOnElanInterface [key=" + key + ", elanInterface=" + elanInterface + ", elanInstance="
42 + elanInstance + ", interfaceInfo=" + interfaceInfo + "]";
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);