Search in sources :

Example 1 with EtherTypes

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();
}
Also used : MonitorProfileGetInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileGetInputBuilder) ProfileBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder)

Example 2 with EtherTypes

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);
}
Also used : EtherTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)

Example 3 with EtherTypes

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);
        }
    }
}
Also used : MonitorProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile) EndpointType(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.EndpointType) EtherTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)

Example 4 with EtherTypes

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;
}
Also used : MonitoringInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.configs.MonitoringInfo) MonitorProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile) EtherTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)

Example 5 with EtherTypes

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();
}
Also used : MonitorProfileGetInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileGetInputBuilder) ProfileBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder)

Aggregations

EtherTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)6 MonitorProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile)5 Optional (com.google.common.base.Optional)3 MonitoringInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.configs.MonitoringInfo)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)3 FutureCallback (com.google.common.util.concurrent.FutureCallback)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 Nonnull (javax.annotation.Nonnull)2 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)2 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)2 MonitorProfileCreateOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateOutput)2 MonitorProfileCreateOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateOutputBuilder)2 Profile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.Profile)2 MonitorProfileBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfileBuilder)2 Preconditions (com.google.common.base.Preconditions)1 Predicate (com.google.common.base.Predicate)1 Strings (com.google.common.base.Strings)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 CacheLoader (com.google.common.cache.CacheLoader)1 LoadingCache (com.google.common.cache.LoadingCache)1