2 * Copyright (c) 2017 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.genius.itm.confighelpers;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.Collections;
12 import java.util.List;
13 import java.util.concurrent.Callable;
14 import org.opendaylight.mdsal.binding.api.DataBroker;
15 import org.opendaylight.mdsal.binding.util.Datastore;
16 import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
18 import org.opendaylight.yangtools.yang.common.Uint64;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class ItmTepsNotHostedRemoveWorker implements Callable<List<? extends ListenableFuture<?>>> {
24 private static final Logger LOG = LoggerFactory.getLogger(ItmTepsNotHostedRemoveWorker.class);
26 private final IpAddress tepIpAddress;
27 private final String tzName;
28 private final Uint64 dpnId;
29 private final DataBroker dataBroker;
30 private final ManagedNewTransactionRunner txRunner;
32 public ItmTepsNotHostedRemoveWorker(String tzName, IpAddress tepIpAddress, Uint64 dpnId, DataBroker broker,
33 ManagedNewTransactionRunner txRunner) {
34 this.tepIpAddress = tepIpAddress;
37 this.dataBroker = broker;
38 this.txRunner = txRunner;
42 public List<? extends ListenableFuture<?>> call() throws Exception {
43 LOG.trace("Remove TEP from TepsNotHosted list task is picked from DataStoreJobCoordinator for execution.");
45 // Remove TEP from TepsNotHosted list.
46 return Collections.singletonList(txRunner.callWithNewReadWriteTransactionAndSubmit(Datastore.OPERATIONAL,
47 tx -> OvsdbTepRemoveConfigHelper
48 .removeUnknownTzTepFromTepsNotHosted(tzName, tepIpAddress, dpnId, dataBroker, tx)));