Of Tunnel creation Oper Implementation
[genius.git] / itm / itm-impl / src / main / java / org / opendaylight / genius / itm / itmdirecttunnels / workers / OfPortStateAddWorkerForNodeConnector.java
1 /*
2  * Copyright (c) 2020 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 java.util.concurrent.ConcurrentHashMap;
14 import java.util.concurrent.ConcurrentMap;
15 import org.opendaylight.genius.itm.utils.NodeConnectorInfo;
16
17 public class OfPortStateAddWorkerForNodeConnector implements Callable<List<? extends ListenableFuture<?>>> {
18     private final OfPortStateAddWorker ofPortStateAddWorker;
19     private final NodeConnectorInfo nodeConnectorInfo;
20     private final ConcurrentMap<String, NodeConnectorInfo> ofPortStateInfo = new ConcurrentHashMap<>();
21
22     public OfPortStateAddWorkerForNodeConnector(OfPortStateAddWorker ofPortStateAddWorker,
23                                                 NodeConnectorInfo nodeConnectorInfo) {
24         this.ofPortStateAddWorker = ofPortStateAddWorker;
25         this.nodeConnectorInfo = nodeConnectorInfo;
26     }
27
28     @Override
29     public List<? extends ListenableFuture<?>> call() throws Exception {
30         // If another renderer(for eg : OVS) needs to be supported, check can be performed here
31         // to call the respective helpers.
32         return ofPortStateAddWorker.addState(nodeConnectorInfo);
33     }
34
35     @Override
36     public String toString() {
37         return "OfPortStateAddWorkerForNodeConnector{"
38                 + "ofStateInfo=" + ofPortStateInfo
39                 + '}';
40     }
41 }