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.LoggerFactory;
20 import org.slf4j.Logger;
22 public class ItmTepAddWorker implements Callable<List<ListenableFuture<Void>>> {
23 private static final Logger logger = LoggerFactory.getLogger(ItmTepAddWorker.class ) ;
24 private DataBroker dataBroker;
25 private List<DPNTEPsInfo> meshedDpnList;
26 private List<DPNTEPsInfo> cfgdDpnList ;
28 public ItmTepAddWorker( List<DPNTEPsInfo> cfgdDpnList, DataBroker broker) {
29 this.cfgdDpnList = cfgdDpnList ;
30 this.dataBroker = broker ;
31 logger.trace("ItmTepAddWorker initialized with DpnList {}",cfgdDpnList );
35 public List<ListenableFuture<Void>> call() throws Exception {
36 List<ListenableFuture<Void>> futures = new ArrayList<>() ;
37 this.meshedDpnList = ItmUtils.getTunnelMeshInfo(dataBroker) ;
38 logger.debug("Invoking Internal Tunnel build method with Configured DpnList {} ; Meshed DpnList {} ",cfgdDpnList, meshedDpnList );
39 futures.addAll( ItmInternalTunnelAddWorker.build_all_tunnels(dataBroker, cfgdDpnList, meshedDpnList) ) ;
40 // IF EXTERNAL TUNNELS NEEDS TO BE BUILT, DO IT HERE. IT COULD BE TO DC GATEWAY OR TOR SWITCH
41 //futures.addAll(ItmExternalTunnelAddWorker.buildTunnelsToExternalEndPoint(dataBroker,meshedDpnList, extIp) ;
46 public String toString() {
47 return "ItmTepAddWorker { " +
48 "Configured Dpn List : " + cfgdDpnList +
49 " Meshed Dpn List : " + meshedDpnList + " }" ;