Search in sources :

Example 1 with ItmTepAddWorker

use of org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker in project genius by opendaylight.

the class ItmTepInstanceRecoveryHandler method recoverTep.

private void recoverTep(String entityId) throws InterruptedException {
    List<DPNTEPsInfo> tepsToRecover = new ArrayList<>();
    DPNTEPsInfo dpnTepsToRecover = extractDPNTepsInfo(entityId);
    if (dpnTepsToRecover == null) {
        LOG.error("Please Enter appropriate arguments for Tep Recovery.");
        return;
    } else {
        tepsToRecover.add(dpnTepsToRecover);
        // Delete the transportZone and re create it
        // Get the transport zone from the transport zone name
        TransportZone oldTz = ItmUtils.getTransportZoneFromConfigDS(tzName, dataBroker);
        if (oldTz != null) {
            ItmTepRemoveWorker tepRemoveWorker = new ItmTepRemoveWorker(tepsToRecover, null, oldTz, dataBroker, imdsalApiManager, itmInternalTunnelDeleteWorker, dpntePsInfoCache);
            LOG.trace("Deleting transportzone {}", tzName);
            jobCoordinator.enqueueJob(tzName, tepRemoveWorker);
            ItmTepAddWorker tepAddWorker = new ItmTepAddWorker(tepsToRecover, null, dataBroker, imdsalApiManager, itmConfig, itmInternalTunnelAddWorker, itmExternalTunnelAddWorker, dpntePsInfoCache);
            LOG.trace("Re-creating transportzone {}", tzName);
            jobCoordinator.enqueueJob(tzName, tepAddWorker);
        }
    }
}
Also used : ItmTepRemoveWorker(org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker) ArrayList(java.util.ArrayList) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) ItmTepAddWorker(org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker)

Example 2 with ItmTepAddWorker

use of org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker in project genius by opendaylight.

the class TransportZoneListener method add.

@Override
public void add(@Nonnull TransportZone transportZone) {
    LOG.debug("Received Transport Zone Add Event: {}", transportZone);
    List<DPNTEPsInfo> opDpnList = createDPNTepInfo(transportZone);
    List<HwVtep> hwVtepList = createhWVteps(transportZone);
    opDpnList.addAll(getDPNTepInfoFromNotHosted(transportZone));
    LOG.trace("Add: Operational dpnTepInfo - Before invoking ItmManager {}", opDpnList);
    if (!opDpnList.isEmpty() || !hwVtepList.isEmpty()) {
        LOG.trace("Add: Invoking ItmManager with DPN List {} ", opDpnList);
        LOG.trace("Add: Invoking ItmManager with hwVtep List {} ", hwVtepList);
        jobCoordinator.enqueueJob(transportZone.getZoneName(), new ItmTepAddWorker(opDpnList, hwVtepList, dataBroker, mdsalManager, itmConfig, itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
    }
}
Also used : HwVtep(org.opendaylight.genius.itm.confighelpers.HwVtep) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) ItmTepAddWorker(org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker)

Example 3 with ItmTepAddWorker

use of org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker in project genius by opendaylight.

the class TransportZoneListener method update.

@Override
public void update(@Nonnull TransportZone originalTransportZone, @Nonnull TransportZone updatedTransportZone) {
    LOG.debug("Received Transport Zone Update Event: Old - {}, Updated - {}", originalTransportZone, updatedTransportZone);
    List<DPNTEPsInfo> oldDpnTepsList = createDPNTepInfo(originalTransportZone);
    List<DPNTEPsInfo> newDpnTepsList = createDPNTepInfo(updatedTransportZone);
    List<DPNTEPsInfo> oldDpnTepsListcopy = new ArrayList<>();
    oldDpnTepsListcopy.addAll(oldDpnTepsList);
    LOG.trace("oldcopy0 {}", oldDpnTepsListcopy);
    List<DPNTEPsInfo> newDpnTepsListcopy = new ArrayList<>();
    newDpnTepsListcopy.addAll(newDpnTepsList);
    LOG.trace("newcopy0 {}", newDpnTepsListcopy);
    oldDpnTepsList.removeAll(newDpnTepsListcopy);
    newDpnTepsList.removeAll(oldDpnTepsListcopy);
    LOG.trace("oldDpnTepsList {}", oldDpnTepsList);
    LOG.trace("newDpnTepsList {}", newDpnTepsList);
    LOG.trace("oldcopy {}", oldDpnTepsListcopy);
    LOG.trace("newcopy {}", newDpnTepsListcopy);
    LOG.trace("oldcopy Size {}", oldDpnTepsList.size());
    LOG.trace("newcopy Size {}", newDpnTepsList.size());
    if (!newDpnTepsList.isEmpty()) {
        LOG.trace("Adding TEPs ");
        jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepAddWorker(newDpnTepsList, Collections.emptyList(), dataBroker, mdsalManager, itmConfig, itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
    }
    if (!oldDpnTepsList.isEmpty()) {
        LOG.trace("Removing TEPs ");
        jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepRemoveWorker(oldDpnTepsList, Collections.emptyList(), originalTransportZone, dataBroker, mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
    }
    List<HwVtep> oldHwList = createhWVteps(originalTransportZone);
    List<HwVtep> newHwList = createhWVteps(updatedTransportZone);
    List<HwVtep> oldHwListcopy = new ArrayList<>();
    oldHwListcopy.addAll(oldHwList);
    LOG.trace("oldHwListcopy0 {}", oldHwListcopy);
    List<HwVtep> newHwListcopy = new ArrayList<>();
    newHwListcopy.addAll(newHwList);
    LOG.trace("newHwListcopy0 {}", newHwListcopy);
    oldHwList.removeAll(newHwListcopy);
    newHwList.removeAll(oldHwListcopy);
    LOG.trace("oldHwList {}", oldHwList);
    LOG.trace("newHwList {}", newHwList);
    LOG.trace("oldHwListcopy {}", oldHwListcopy);
    LOG.trace("newHwListcopy {}", newHwListcopy);
    if (!newHwList.isEmpty()) {
        LOG.trace("Adding HW TEPs ");
        jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepAddWorker(Collections.emptyList(), newHwList, dataBroker, mdsalManager, itmConfig, itmInternalTunnelAddWorker, externalTunnelAddWorker, dpnTEPsInfoCache));
    }
    if (!oldHwList.isEmpty()) {
        LOG.trace("Removing HW TEPs ");
        jobCoordinator.enqueueJob(updatedTransportZone.getZoneName(), new ItmTepRemoveWorker(Collections.emptyList(), oldHwList, originalTransportZone, dataBroker, mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
    }
}
Also used : ItmTepRemoveWorker(org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker) ArrayList(java.util.ArrayList) HwVtep(org.opendaylight.genius.itm.confighelpers.HwVtep) DPNTEPsInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo) ItmTepAddWorker(org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker)

Aggregations

ItmTepAddWorker (org.opendaylight.genius.itm.confighelpers.ItmTepAddWorker)3 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)3 ArrayList (java.util.ArrayList)2 HwVtep (org.opendaylight.genius.itm.confighelpers.HwVtep)2 ItmTepRemoveWorker (org.opendaylight.genius.itm.confighelpers.ItmTepRemoveWorker)2 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)1