Search in sources :

Example 6 with DcGatewayIpList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList in project genius by opendaylight.

the class ItmTepAddWorker method call.

@Override
public List<ListenableFuture<Void>> call() {
    List<ListenableFuture<Void>> futures = new ArrayList<>();
    this.meshedDpnList = ItmUtils.getDpnTEPsInfos(dataBroker);
    LOG.debug("Invoking Internal Tunnel build method with Configured DpnList {} ; Meshed DpnList {} ", cfgdDpnList, meshedDpnList);
    futures.addAll(itmInternalTunnelAddWorker.buildAllTunnels(mdsalManager, cfgdDpnList, meshedDpnList));
    // IF EXTERNAL TUNNELS NEEDS TO BE BUILT, DO IT HERE. IT COULD BE TO DC GATEWAY OR TOR SWITCH
    List<DcGatewayIp> dcGatewayIpList = ItmUtils.getDcGatewayIpList(dataBroker);
    if (dcGatewayIpList != null && !dcGatewayIpList.isEmpty()) {
        for (DcGatewayIp dcGatewayIp : dcGatewayIpList) {
            futures.addAll(externalTunnelAddWorker.buildTunnelsToExternalEndPoint(cfgdDpnList, dcGatewayIp.getIpAddress(), dcGatewayIp.getTunnnelType()));
        }
    }
    // futures.addAll(ItmExternalTunnelAddWorker.buildTunnelsToExternalEndPoint(dataBroker,meshedDpnList, extIp) ;
    LOG.debug("invoking build hwVtepTunnels with hwVteplist {}", cfgdHwVteps);
    futures.addAll(externalTunnelAddWorker.buildHwVtepsTunnels(cfgdDpnList, cfgdHwVteps));
    return futures;
}
Also used : DcGatewayIp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture)

Example 7 with DcGatewayIpList

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList in project genius by opendaylight.

the class ItmTepRemoveWorker method call.

@Override
public List<ListenableFuture<Void>> call() {
    List<ListenableFuture<Void>> futures = new ArrayList<>();
    this.meshedDpnList = dpnTEPsInfoCache.getAllPresent();
    futures.addAll(itmInternalTunnelDeleteWorker.deleteTunnels(mdsalManager, delDpnList, meshedDpnList));
    LOG.debug("Invoking Internal Tunnel delete method with DpnList to be deleted {} ; Meshed DpnList {} ", delDpnList, meshedDpnList);
    // IF EXTERNAL TUNNELS NEEDS TO BE DELETED, DO IT HERE, IT COULD BE TO DC GATEWAY OR TOR SWITCH
    List<DcGatewayIp> dcGatewayIpList = ItmUtils.getDcGatewayIpList(dataBroker);
    if (dcGatewayIpList != null && !dcGatewayIpList.isEmpty()) {
        List<DPNTEPsInfo> dpnDeleteList = new ArrayList<>();
        for (DPNTEPsInfo dpnTEPInfo : delDpnList) {
            List<TunnelEndPoints> tunnelEndPointsList = dpnTEPInfo.getTunnelEndPoints();
            if (tunnelEndPointsList.size() == 1) {
                dpnDeleteList.add(dpnTEPInfo);
            } else {
                LOG.error("DPNTEPInfo not available in data store for dpnId {}. Unable to delete external tunnel " + "for dpn ", dpnTEPInfo.getDPNID());
            }
        }
        for (DcGatewayIp dcGatewayIp : dcGatewayIpList) {
            futures.addAll(ItmExternalTunnelDeleteWorker.deleteTunnels(dataBroker, dpnDeleteList, meshedDpnList, dcGatewayIp.getIpAddress(), dcGatewayIp.getTunnnelType()));
        }
    }
    futures.addAll(ItmExternalTunnelDeleteWorker.deleteHwVtepsTunnels(dataBroker, delDpnList, cfgdHwVteps, this.originalTZone));
    return futures;
}
Also used : TunnelEndPoints(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints) DcGatewayIp(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp) ArrayList(java.util.ArrayList) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)

Aggregations

ArrayList (java.util.ArrayList)5 DcGatewayIpList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.DcGatewayIpList)5 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)4 DcGatewayIp (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.dc.gateway.ip.list.DcGatewayIp)3 Optional (com.google.common.base.Optional)2 BigInteger (java.math.BigInteger)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Future (java.util.concurrent.Future)2 PostConstruct (javax.annotation.PostConstruct)2 Inject (javax.inject.Inject)2 Singleton (javax.inject.Singleton)2 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)2 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)2 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)2 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)2 MDSALUtil (org.opendaylight.genius.mdsalutil.MDSALUtil)2 NwConstants (org.opendaylight.genius.mdsalutil.NwConstants)2