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