2 * Copyright (c) 2015 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.vpnservice.itm.confighelpers;
10 import java.util.ArrayList;
11 import java.util.List;
12 import java.util.concurrent.Callable;
14 import com.google.common.util.concurrent.ListenableFuture;
16 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
17 import org.opendaylight.vpnservice.itm.impl.ItmUtils;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.op.rev150701.dpn.endpoints.DPNTEPsInfo;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
22 public class ItmTepRemoveWorker implements Callable<List<ListenableFuture<Void>>> {
23 private static final Logger logger = LoggerFactory.getLogger(ItmTepRemoveWorker.class ) ;
24 private DataBroker dataBroker;
25 private List<DPNTEPsInfo> delDpnList ;
26 private List<DPNTEPsInfo> meshedDpnList ;
28 public ItmTepRemoveWorker( List<DPNTEPsInfo> delDpnList, DataBroker broker) {
29 this.delDpnList = delDpnList ;
30 this.dataBroker = broker ;
31 logger.trace("ItmTepRemoveWorker initialized with DpnList {}",delDpnList );
35 public List<ListenableFuture<Void>> call() throws Exception {
36 List<ListenableFuture<Void>> futures = new ArrayList<>() ;
37 this.meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker) ;
38 futures.addAll( ItmInternalTunnelDeleteWorker.deleteTunnels(dataBroker, delDpnList, meshedDpnList));
39 logger.debug("Invoking Internal Tunnel delete method with DpnList to be deleted {} ; Meshed DpnList {} ",delDpnList, meshedDpnList );
40 // IF EXTERNAL TUNNELS NEEDS TO BE DELETED, DO IT HERE, IT COULD BE TO DC GATEWAY OR TOR SWITCH
45 public String toString() {
46 return "ItmTepRemoveWorker { " +
47 "Delete Dpn List : " + delDpnList + " }" ;