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 java.util.ArrayList;
11 import java.util.List;
12 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.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
19 import com.google.common.util.concurrent.ListenableFuture;
21 public class InterfaceRemoveWorkerOnElanInterface implements Callable<List<ListenableFuture<Void>>> {
22 private String interfaceName;
23 private ElanInstance elanInfo;
24 private InterfaceInfo interfaceInfo;
25 private boolean isInterfaceStateRemoved;
26 private ElanInterfaceManager dataChangeListener;
27 private boolean isLastElanInterface;
28 private static final Logger logger = LoggerFactory.getLogger(InterfaceRemoveWorkerOnElanInterface.class);
30 public InterfaceRemoveWorkerOnElanInterface(String interfaceName, ElanInstance elanInfo,
31 InterfaceInfo interfaceInfo, boolean isInterfaceStateRemoved, ElanInterfaceManager dataChangeListener, boolean isLastElanInterface) {
32 this.interfaceName = interfaceName;
33 this.elanInfo = elanInfo;
34 this.interfaceInfo = interfaceInfo;
35 this.isInterfaceStateRemoved = isInterfaceStateRemoved;
36 this.dataChangeListener = dataChangeListener;
37 this.isLastElanInterface = isLastElanInterface;
41 public String toString() {
42 return "InterfaceRemoveWorkerOnElanInterface [key=" + interfaceName + ", elanInfo=" + elanInfo
43 + ", interfaceInfo=" + interfaceInfo + ", isInterfaceStateRemoved=" + isInterfaceStateRemoved + ", isLastElanInterface=" + isLastElanInterface + "]";
47 public List<ListenableFuture<Void>> call() throws Exception {
48 List<ListenableFuture<Void>> futures = new ArrayList<>();
50 dataChangeListener.removeEntriesForElanInterface(elanInfo, interfaceInfo, interfaceName, isInterfaceStateRemoved, isLastElanInterface);
51 } catch (Exception e) {
52 logger.error("Error while processing {} for {}, error {}", interfaceName, elanInfo, e);