Search in sources :

Example 1 with ItmMonitorIntervalWorker

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

the class TunnelMonitorIntervalListener method remove.

@Override
protected void remove(InstanceIdentifier<TunnelMonitorInterval> key, TunnelMonitorInterval dataObjectModification) {
    LOG.debug("remove TunnelMonitorIntervalListener called with {}", dataObjectModification.getInterval());
    InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
    Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
    if (transportZonesOptional.isPresent()) {
        TransportZones tzones = transportZonesOptional.get();
        for (TransportZone tzone : tzones.getTransportZone()) {
            // if you remove configuration, the last configured interval is only set i.e no change
            LOG.debug("Remove:Calling TunnelMonitorIntervalWorker with tzone = {} and {}", tzone.getZoneName(), dataObjectModification.getInterval());
            ItmMonitorIntervalWorker toggleWorker = new ItmMonitorIntervalWorker(tzone.getZoneName(), dataObjectModification.getInterval(), broker);
            jobCoordinator.enqueueJob(tzone.getZoneName(), toggleWorker);
        }
    }
}
Also used : TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) ItmMonitorIntervalWorker(org.opendaylight.genius.itm.confighelpers.ItmMonitorIntervalWorker) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)

Example 2 with ItmMonitorIntervalWorker

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

the class TunnelMonitorIntervalListener method update.

@Override
protected void update(InstanceIdentifier<TunnelMonitorInterval> key, TunnelMonitorInterval dataObjectModificationBefore, TunnelMonitorInterval dataObjectModificationAfter) {
    LOG.debug("update TunnelMonitorIntervalListener called with {}", dataObjectModificationAfter.getInterval());
    InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
    Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
    if (transportZonesOptional.isPresent()) {
        TransportZones tzones = transportZonesOptional.get();
        for (TransportZone tzone : tzones.getTransportZone()) {
            LOG.debug("Update:Calling TunnelMonitorIntervalWorker with tzone = {} and {}", tzone.getZoneName(), dataObjectModificationAfter.getInterval());
            ItmMonitorIntervalWorker intervalWorker = new ItmMonitorIntervalWorker(tzone.getZoneName(), dataObjectModificationAfter.getInterval(), broker);
            jobCoordinator.enqueueJob(tzone.getZoneName(), intervalWorker);
        }
    }
}
Also used : TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) ItmMonitorIntervalWorker(org.opendaylight.genius.itm.confighelpers.ItmMonitorIntervalWorker) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)

Example 3 with ItmMonitorIntervalWorker

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

the class TunnelMonitorIntervalListener method add.

@Override
protected void add(InstanceIdentifier<TunnelMonitorInterval> key, TunnelMonitorInterval dataObjectModification) {
    LOG.debug("Add TunnelMonitorIntervalListener called with {}", dataObjectModification.getInterval());
    InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
    Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
    if (transportZonesOptional.isPresent()) {
        TransportZones tzones = transportZonesOptional.get();
        for (TransportZone tzone : tzones.getTransportZone()) {
            LOG.debug("Add:Calling TunnelMonitorIntervalWorker with tzone = {} and {}", tzone.getZoneName(), dataObjectModification.getInterval());
            ItmMonitorIntervalWorker intervalWorker = new ItmMonitorIntervalWorker(tzone.getZoneName(), dataObjectModification.getInterval(), broker);
            // conversion to milliseconds done while writing to i/f-mgr config DS
            jobCoordinator.enqueueJob(tzone.getZoneName(), intervalWorker);
        }
    }
}
Also used : TransportZones(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones) ItmMonitorIntervalWorker(org.opendaylight.genius.itm.confighelpers.ItmMonitorIntervalWorker) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)

Aggregations

ItmMonitorIntervalWorker (org.opendaylight.genius.itm.confighelpers.ItmMonitorIntervalWorker)3 TransportZones (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZones)3 TransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone)3