/* * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.genius.itm.confighelpers; import com.google.common.util.concurrent.ListenableFuture; import java.util.Collections; import java.util.List; import java.util.concurrent.Callable; import org.opendaylight.mdsal.binding.util.Datastore; import org.opendaylight.mdsal.binding.util.ManagedNewTransactionRunner; import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Vteps; import org.opendaylight.yangtools.yang.common.Uint64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ItmTepsNotHostedMoveWorker implements Callable>> { private static final Logger LOG = LoggerFactory.getLogger(ItmTepsNotHostedMoveWorker.class); private final List vtepsList; private final String tzName; private final ManagedNewTransactionRunner txRunner; public ItmTepsNotHostedMoveWorker(List vtepsList, String tzName, ManagedNewTransactionRunner txRunner) { this.vtepsList = vtepsList; this.tzName = tzName; this.txRunner = txRunner; } @Override public List> call() throws Exception { LOG.trace("Move TEP from TepsNotHosted list to NBI configured TZ task is picked from " + "DataStoreJobCoordinator for execution."); // Move TEP from TepsNotHosted list to NBI configured TZ. return Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(Datastore .CONFIGURATION, tx -> OvsdbTepAddConfigHelper.addVtepInITMConfigDS( vtepsList, null /*tepIpAddress*/, tzName, Uint64.ZERO, false, tx))); } }