b02e9e9f8959dae7548bfb67c6b4bee62d09eb23
[vpnservice.git] / elanmanager / elanmanager-impl / src / main / java / org / opendaylight / vpnservice / elan / internal / ElanInterfaceAddWorker.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.vpnservice.elan.internal;
9
10 import java.util.ArrayList;
11 import java.util.List;
12 import java.util.concurrent.Callable;
13
14 import org.opendaylight.vpnservice.interfacemgr.globals.InterfaceInfo;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.elan.rev150602.elan.instances.ElanInstance;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.elan.rev150602.elan.interfaces.ElanInterface;
17
18 import com.google.common.util.concurrent.ListenableFuture;
19
20 public class ElanInterfaceAddWorker implements Callable<List<ListenableFuture<Void>>> {
21     private String key;
22     private ElanInterface elanInterface;
23     private ElanInstance elanInstance;
24     private InterfaceInfo interfaceInfo;
25     private ElanInterfaceManager dataChangeListener;
26
27     public ElanInterfaceAddWorker(String key, ElanInterface elanInterface, InterfaceInfo interfaceInfo,
28             ElanInstance elanInstance, ElanInterfaceManager dataChangeListener) {
29         super();
30         this.key = key;
31         this.elanInterface = elanInterface;
32         this.interfaceInfo = interfaceInfo;
33         this.elanInstance = elanInstance;
34         this.dataChangeListener = dataChangeListener;
35     }
36
37     @Override
38     public String toString() {
39         return "ElanInterfaceAddWorker [key=" + key + ", elanInterface=" + elanInterface + ", elanInstance="
40                 + elanInstance + ", interfaceInfo=" + interfaceInfo + "]";
41     }
42
43
44     @Override
45     public List<ListenableFuture<Void>> call() throws Exception {
46         List<ListenableFuture<Void>> futures = new ArrayList<>();
47         dataChangeListener.addElanInterface(elanInterface, interfaceInfo, elanInstance);
48         return futures;
49     }
50     
51     
52
53 }