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.math.BigInteger;
12 import java.util.Collections;
13 import java.util.List;
14 import java.util.concurrent.Callable;
15 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
16 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
21 public class ItmTepsNotHostedRemoveWorker implements Callable<List<ListenableFuture<Void>>> {
23 private static final Logger LOG = LoggerFactory.getLogger(ItmTepsNotHostedRemoveWorker.class);
25 private final IpAddress tepIpAddress;
26 private final String tzName;
27 private final BigInteger dpnId;
28 private final DataBroker dataBroker;
30 public ItmTepsNotHostedRemoveWorker(String tzName, IpAddress tepIpAddress, BigInteger dpnId, DataBroker broker) {
31 this.tepIpAddress = tepIpAddress;
34 this.dataBroker = broker ;
38 public List<ListenableFuture<Void>> call() throws Exception {
39 WriteTransaction wrTx = dataBroker.newWriteOnlyTransaction();
41 LOG.trace("Remove TEP from TepsNotHosted list task is picked from DataStoreJobCoordinator for execution.");
43 // Remove TEP from TepsNotHosted list.
44 OvsdbTepRemoveConfigHelper.removeUnknownTzTepFromTepsNotHosted(tzName, tepIpAddress, dpnId, dataBroker, wrTx);
46 return Collections.singletonList(wrTx.submit());