use of org.opendaylight.genius.itm.confighelpers.ItmMonitorToggleWorker in project genius by opendaylight.
the class TunnelMonitorChangeListener method remove.
@Override
protected void remove(InstanceIdentifier<TunnelMonitorParams> key, TunnelMonitorParams dataObjectModification) {
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
Class<? extends TunnelMonitoringTypeBase> monitorProtocol = dataObjectModification.getMonitorProtocol();
if (monitorProtocol == null) {
monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
}
if (transportZonesOptional.isPresent()) {
TransportZones transportZones = transportZonesOptional.get();
for (TransportZone tzone : transportZones.getTransportZone()) {
LOG.debug("Remove - TunnelMonitorToggleWorker with tzone = {}, Enable = {}, MonitorProtocol = {}", tzone.getZoneName(), dataObjectModification.isEnabled(), monitorProtocol);
ItmMonitorToggleWorker toggleWorker = new ItmMonitorToggleWorker(tzone.getZoneName(), false, monitorProtocol, broker);
jobCoordinator.enqueueJob(tzone.getZoneName(), toggleWorker);
}
}
}
use of org.opendaylight.genius.itm.confighelpers.ItmMonitorToggleWorker in project genius by opendaylight.
the class TunnelMonitorChangeListener method add.
@Override
protected void add(InstanceIdentifier<TunnelMonitorParams> key, TunnelMonitorParams dataObjectModification) {
LOG.debug("Add - TunnelMonitorToggleWorker with Enable = {}, MonitorProtocol = {}", dataObjectModification.isEnabled(), dataObjectModification.getMonitorProtocol());
Class<? extends TunnelMonitoringTypeBase> monitorProtocol = dataObjectModification.getMonitorProtocol();
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
if (monitorProtocol == null) {
monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
}
if (transportZonesOptional.isPresent()) {
TransportZones tzones = transportZonesOptional.get();
for (TransportZone tzone : tzones.getTransportZone()) {
LOG.debug("Add: TunnelMonitorToggleWorker with tzone = {} monitoringEnabled {} and " + "monitoringProtocol {}", tzone.getZoneName(), dataObjectModification.isEnabled(), dataObjectModification.getMonitorProtocol());
ItmMonitorToggleWorker toggleWorker = new ItmMonitorToggleWorker(tzone.getZoneName(), dataObjectModification.isEnabled(), monitorProtocol, broker);
jobCoordinator.enqueueJob(tzone.getZoneName(), toggleWorker);
}
}
}
use of org.opendaylight.genius.itm.confighelpers.ItmMonitorToggleWorker in project genius by opendaylight.
the class TunnelMonitorChangeListener method update.
@Override
protected void update(InstanceIdentifier<TunnelMonitorParams> key, TunnelMonitorParams dataObjectModificationBefore, TunnelMonitorParams dataObjectModificationAfter) {
LOG.debug("update TunnelMonitorChangeListener called with {}", dataObjectModificationAfter.isEnabled());
Class<? extends TunnelMonitoringTypeBase> monitorProtocolBefore = dataObjectModificationBefore.getMonitorProtocol();
Class<? extends TunnelMonitoringTypeBase> monitorProtocolAfter = dataObjectModificationAfter.getMonitorProtocol();
Class<? extends TunnelMonitoringTypeBase> monitorProtocol = ITMConstants.DEFAULT_MONITOR_PROTOCOL;
InstanceIdentifier<TransportZones> path = InstanceIdentifier.builder(TransportZones.class).build();
Optional<TransportZones> transportZonesOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, broker);
if (monitorProtocolAfter != null) {
monitorProtocol = dataObjectModificationAfter.getMonitorProtocol();
}
if (monitorProtocolBefore != null && monitorProtocolAfter != null) {
LOG.debug("TunnelMonitorChangeListener Update : Existing_MonitorProtocol {}, New_MonitorProtocol {} ", monitorProtocolBefore.getName(), monitorProtocolAfter.getName());
if (!monitorProtocolAfter.getName().equalsIgnoreCase(monitorProtocolBefore.getName())) {
LOG.error("Updation of monitor protocol not allowed");
}
}
if (transportZonesOptional.isPresent()) {
TransportZones tzones = transportZonesOptional.get();
for (TransportZone tzone : tzones.getTransportZone()) {
LOG.debug("Update - TunnelMonitorToggleWorker with tzone = {}, Enable = {}, MonitorProtocol = {}", tzone.getZoneName(), dataObjectModificationAfter.isEnabled(), monitorProtocol);
ItmMonitorToggleWorker toggleWorker = new ItmMonitorToggleWorker(tzone.getZoneName(), dataObjectModificationAfter.isEnabled(), monitorProtocol, broker);
jobCoordinator.enqueueJob(tzone.getZoneName(), toggleWorker);
}
}
}
Aggregations