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.idmanager.rev150403.IdManagerService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.vpnservice.itm.op.rev150701.dpn.endpoints.DPNTEPsInfo;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
23 public class ItmTepRemoveWorker implements Callable<List<ListenableFuture<Void>>> {
24 private static final Logger logger = LoggerFactory.getLogger(ItmTepRemoveWorker.class ) ;
25 private DataBroker dataBroker;
26 private List<DPNTEPsInfo> delDpnList ;
27 private List<DPNTEPsInfo> meshedDpnList ;
28 private IdManagerService idManagerService;
30 public ItmTepRemoveWorker( List<DPNTEPsInfo> delDpnList, DataBroker broker, IdManagerService idManagerService) {
31 this.delDpnList = delDpnList ;
32 this.dataBroker = broker ;
33 this.idManagerService = idManagerService;
34 logger.trace("ItmTepRemoveWorker initialized with DpnList {}",delDpnList );
38 public List<ListenableFuture<Void>> call() throws Exception {
39 List<ListenableFuture<Void>> futures = new ArrayList<>() ;
40 this.meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker) ;
41 futures.addAll( ItmInternalTunnelDeleteWorker.deleteTunnels(dataBroker, idManagerService, delDpnList, meshedDpnList));
42 logger.debug("Invoking Internal Tunnel delete method with DpnList to be deleted {} ; Meshed DpnList {} ",delDpnList, meshedDpnList );
43 // IF EXTERNAL TUNNELS NEEDS TO BE DELETED, DO IT HERE, IT COULD BE TO DC GATEWAY OR TOR SWITCH
48 public String toString() {
49 return "ItmTepRemoveWorker { " +
50 "Delete Dpn List : " + delDpnList + " }" ;