Convert itm-impl to use mdsal-binding-util
[genius.git] / itm / itm-impl / src / main / java / org / opendaylight / genius / itm / confighelpers / OvsdbTepRemoveWorker.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.genius.itm.confighelpers;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.List;
12 import java.util.concurrent.Callable;
13 import org.opendaylight.mdsal.binding.api.DataBroker;
14 import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner;
15 import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunnerImpl;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class OvsdbTepRemoveWorker implements Callable<List<? extends ListenableFuture<?>>> {
20
21     private static final Logger LOG = LoggerFactory.getLogger(OvsdbTepRemoveWorker.class) ;
22
23     private final String tepIp;
24     private final String strDpid;
25     private final String tzName;
26     private final DataBroker dataBroker;
27     private final ManagedNewTransactionRunner txRunner;
28
29     public OvsdbTepRemoveWorker(String tepIp, String strDpid, String tzName, DataBroker broker) {
30         this.tepIp = tepIp;
31         this.strDpid = strDpid;
32         this.tzName = tzName;
33         this.dataBroker = broker;
34         this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
35     }
36
37     @Override
38     public List<? extends ListenableFuture<?>> call() throws Exception {
39
40         LOG.trace("Remove TEP task is picked from DataStoreJobCoordinator for execution.");
41
42         // remove TEP received from southbound OVSDB from ITM config DS.
43         return OvsdbTepRemoveConfigHelper.removeTepReceivedFromOvsdb(tepIp, strDpid, tzName, dataBroker, txRunner);
44     }
45 }