use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor 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);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor in project genius by opendaylight.
the class AlivenessMonitorUtils method handleTunnelMonitorUpdates.
public void handleTunnelMonitorUpdates(Interface interfaceOld, Interface interfaceNew) {
String interfaceName = interfaceNew.getName();
IfTunnel ifTunnelNew = interfaceNew.getAugmentation(IfTunnel.class);
if (!lldpMonitoringEnabled(ifTunnelNew)) {
return;
}
LOG.debug("handling tunnel monitoring updates for interface {}", interfaceName);
stopLLDPMonitoring(ifTunnelNew, interfaceOld.getName());
if (ifTunnelNew.isMonitorEnabled()) {
startLLDPMonitoring(ifTunnelNew, interfaceName);
// Delete old profile from Aliveness Manager
IfTunnel ifTunnelOld = interfaceOld.getAugmentation(IfTunnel.class);
if (!ifTunnelNew.getMonitorInterval().equals(ifTunnelOld.getMonitorInterval())) {
LOG.debug("deleting older monitor profile for interface {}", interfaceName);
long profileId = allocateProfile(FAILURE_THRESHOLD, ifTunnelOld.getMonitorInterval(), MONITORING_WINDOW, EtherTypes.Lldp);
MonitorProfileDeleteInput profileDeleteInput = new MonitorProfileDeleteInputBuilder().setProfileId(profileId).build();
Future<RpcResult<Void>> future = alivenessMonitorService.monitorProfileDelete(profileDeleteInput);
ListenableFutures.addErrorLogging(JdkFutureAdapters.listenInPoolThread(future), LOG, "Delete monitor profile {}", interfaceName);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev171207.bmp.monitor.Monitor in project genius by opendaylight.
the class AlivenessMonitorUtils method stopLLDPMonitoring.
public void stopLLDPMonitoring(IfTunnel ifTunnel, String trunkInterface) {
if (!lldpMonitoringEnabled(ifTunnel)) {
return;
}
LOG.debug("stop LLDP monitoring for {}", trunkInterface);
ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(tx -> {
List<Long> monitorIds = getMonitorIdForInterface(tx, trunkInterface);
if (monitorIds == null) {
LOG.error("Monitor Id doesn't exist for Interface {}", trunkInterface);
return;
}
for (Long monitorId : monitorIds) {
String interfaceName = getInterfaceFromMonitorId(tx, monitorId);
if (interfaceName != null) {
MonitorStopInput input = new MonitorStopInputBuilder().setMonitorId(monitorId).build();
Future<RpcResult<Void>> future = alivenessMonitorService.monitorStop(input);
ListenableFutures.addErrorLogging(JdkFutureAdapters.listenInPoolThread(future), LOG, "Stop LLDP monitoring for {}", trunkInterface);
removeMonitorIdInterfaceMap(tx, monitorId);
removeMonitorIdFromInterfaceMonitorIdMap(tx, interfaceName, monitorId);
return;
}
}
}), LOG, "Error stopping LLDP monitoring for {}", trunkInterface);
}
Aggregations