3b1875cb0a868ccb5aadd65d43cac8acc52bb2a0
[genius.git] / itm / itm-impl / src / main / java / org / opendaylight / genius / itm / itmdirecttunnels / workers / TunnelStateAddWorkerForNodeConnector.java
1 /*
2  * Copyright (c) 2018 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.genius.itm.itmdirecttunnels.workers;
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.itm.utils.TunnelStateInfo;
14
15 public class TunnelStateAddWorkerForNodeConnector implements Callable<List<? extends ListenableFuture<?>>> {
16     private final TunnelStateAddWorker tunnelStateAddWorker;
17     private final TunnelStateInfo tunnelStateInfo;
18
19     public TunnelStateAddWorkerForNodeConnector(TunnelStateAddWorker tunnelStateAddWorker,
20                                                 TunnelStateInfo tunnelStateInfo) {
21         this.tunnelStateAddWorker = tunnelStateAddWorker;
22         this.tunnelStateInfo = tunnelStateInfo;
23     }
24
25     @Override
26     public List<ListenableFuture<Void>> call() throws Exception {
27         // If another renderer(for eg : OVS) needs to be supported, check can be performed here
28         // to call the respective helpers.
29         return tunnelStateAddWorker.addState(tunnelStateInfo);
30     }
31
32     @Override
33     public String toString() {
34         return "TunnelStateAddWorkerForNodeConnector{tunnelStateInfo=" + tunnelStateInfo + '}';
35     }
36 }