use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes in project genius by opendaylight.
the class AlivenessMonitorUtils method buildMonitorGetProfile.
private static MonitorProfileGetInput buildMonitorGetProfile(long monitorInterval, long monitorWindow, long failureThreshold, EtherTypes protocolType) {
org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.get.input.ProfileBuilder profileBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.get.input.ProfileBuilder();
profileBuilder.setFailureThreshold(failureThreshold);
profileBuilder.setMonitorInterval(monitorInterval);
profileBuilder.setMonitorWindow(monitorWindow);
profileBuilder.setProtocolType(protocolType);
MonitorProfileGetInputBuilder buildGetProfile = new MonitorProfileGetInputBuilder();
buildGetProfile.setProfile(profileBuilder.build());
return buildGetProfile.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes in project genius by opendaylight.
the class AlivenessMonitor method getExistingProfileId.
private Long getExistingProfileId(MonitorProfileGetInput input) {
org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.get.input.Profile profile = input.getProfile();
final Long failureThreshold = profile.getFailureThreshold();
final Long monitorInterval = profile.getMonitorInterval();
final Long monitorWindow = profile.getMonitorWindow();
final EtherTypes ethType = profile.getProtocolType();
LOG.debug("getExistingProfileId for profile : {}", input.getProfile());
String idKey = getUniqueProfileKey(failureThreshold, monitorInterval, monitorWindow, ethType);
LOG.debug("Obtained existing profile ID for profile : {}", input.getProfile());
return (long) getUniqueId(idKey);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes in project genius by opendaylight.
the class AlivenessMonitor method releaseIdForMonitoringInfo.
private void releaseIdForMonitoringInfo(MonitoringInfo info) {
Long monitorId = info.getId();
EndpointType source = info.getSource().getEndpointType();
String interfaceName = getInterfaceName(source);
if (!Strings.isNullOrEmpty(interfaceName)) {
Optional<MonitorProfile> optProfile = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, getMonitorProfileId(info.getProfileId()));
if (optProfile.isPresent()) {
EtherTypes ethType = optProfile.get().getProtocolType();
EndpointType destination = info.getDestination() != null ? info.getDestination().getEndpointType() : null;
String idKey = getUniqueKey(interfaceName, ethType.toString(), source, destination);
releaseId(idKey);
} else {
LOG.warn("Could not release monitorId {}. No profile associated with it", monitorId);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes in project genius by opendaylight.
the class AlivenessMonitor method stopMonitoringTask.
private boolean stopMonitoringTask(Long monitorId, boolean interruptTask) {
Optional<MonitoringInfo> optInfo = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, getMonitoringInfoId(monitorId));
if (!optInfo.isPresent()) {
LOG.warn("There is no monitoring info present for monitor id {}", monitorId);
return false;
}
MonitoringInfo monitoringInfo = optInfo.get();
Optional<MonitorProfile> optProfile = SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, getMonitorProfileId(monitoringInfo.getProfileId()));
EtherTypes protocolType = optProfile.get().getProtocolType();
if (protocolType == EtherTypes.Bfd) {
LOG.debug("disabling bfd for hwvtep tunnel montior id {}", monitorId);
((HwVtepTunnelsStateHandler) alivenessProtocolHandlerRegistry.get(protocolType)).resetMonitoringTask(false);
return true;
}
ScheduledFuture<?> scheduledFutureResult = monitoringTasks.get(monitorId);
if (scheduledFutureResult != null) {
scheduledFutureResult.cancel(interruptTask);
return true;
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes in project netvirt by opendaylight.
the class AlivenessMonitorUtils method buildMonitorGetProfile.
private static MonitorProfileGetInput buildMonitorGetProfile(long monitorInterval, long monitorWindow, long failureThreshold, EtherTypes protocolType) {
MonitorProfileGetInputBuilder buildGetProfile = new MonitorProfileGetInputBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.get.input.ProfileBuilder profileBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.get.input.ProfileBuilder();
profileBuilder.setFailureThreshold(failureThreshold).setMonitorInterval(monitorInterval).setMonitorWindow(monitorWindow).setProtocolType(protocolType);
buildGetProfile.setProfile(profileBuilder.build());
return buildGetProfile.build();
}
Aggregations