Search in sources :

Example 1 with Monitor

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor in project netvirt by opendaylight.

the class ArpMonitorEventListener method onMonitorEvent.

@Override
public void onMonitorEvent(MonitorEvent notification) {
    Long monitorId = notification.getEventData().getMonitorId();
    MacEntry macEntry = AlivenessMonitorUtils.getMacEntryFromMonitorId(monitorId);
    if (macEntry == null) {
        LOG.debug("No MacEntry found associated with the monitor Id {}", monitorId);
        return;
    }
    LivenessState livenessState = notification.getEventData().getMonitorState();
    if (livenessState.equals(LivenessState.Down)) {
        String vpnName = macEntry.getVpnName();
        String learntIp = macEntry.getIpAddress().getHostAddress();
        LearntVpnVipToPort vpnVipToPort = VpnUtil.getLearntVpnVipToPort(dataBroker, vpnName, learntIp);
        if (vpnVipToPort != null && macEntry.getCreatedTime().equals(vpnVipToPort.getCreationTime())) {
            jobCoordinator.enqueueJob(ArpMonitoringHandler.buildJobKey(macEntry.getIpAddress().getHostAddress(), macEntry.getVpnName()), new ArpMonitorStopTask(macEntry, dataBroker, alivenessManager));
        }
    }
}
Also used : LivenessState(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.LivenessState) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort)

Example 2 with Monitor

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor in project netvirt by opendaylight.

the class StatisticsImpl method createIdPool.

private void createIdPool() {
    if (checkPoolExists()) {
        return;
    }
    CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(CountersServiceUtils.COUNTERS_PULL_NAME).setLow(CountersServiceUtils.COUNTERS_PULL_START).setHigh(CountersServiceUtils.COUNTERS_PULL_START + CountersServiceUtils.COUNTERS_PULL_END).build();
    ListenableFuture<RpcResult<CreateIdPoolOutput>> result = idManagerService.createIdPool(createPool);
    Futures.addCallback(result, new FutureCallback<RpcResult<CreateIdPoolOutput>>() {

        @Override
        public void onFailure(Throwable error) {
            LOG.error("Failed to create idPool for Aliveness Monitor Service", error);
        }

        @Override
        public void onSuccess(@NonNull RpcResult<CreateIdPoolOutput> rpcResult) {
            if (rpcResult.isSuccessful()) {
                LOG.debug("Created IdPool for tap");
            } else {
                LOG.error("RPC to create Idpool failed {}", rpcResult.getErrors());
            }
        }
    }, MoreExecutors.directExecutor());
}
Also used : RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) CreateIdPoolOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolOutput) CreateIdPoolInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInputBuilder)

Example 3 with Monitor

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor in project netvirt by opendaylight.

the class IpMonitorEventListener method onMonitorEvent.

@Override
public void onMonitorEvent(MonitorEvent notification) {
    Long monitorId = notification.getEventData().getMonitorId().toJava();
    MacEntry macEntry = AlivenessMonitorUtils.getMacEntryFromMonitorId(monitorId);
    if (macEntry == null) {
        LOG.debug("No MacEntry found associated with the monitor Id {}", monitorId);
        return;
    }
    LivenessState livenessState = notification.getEventData().getMonitorState();
    if (livenessState.equals(LivenessState.Down)) {
        String vpnName = macEntry.getVpnName();
        String learntIp = macEntry.getIpAddress().getHostAddress();
        LearntVpnVipToPort vpnVipToPort = vpnUtil.getLearntVpnVipToPort(vpnName, learntIp);
        if (vpnVipToPort != null && macEntry.getCreatedTime().equals(vpnVipToPort.getCreationTime())) {
            String jobKey = VpnUtil.buildIpMonitorJobKey(macEntry.getIpAddress().getHostAddress(), macEntry.getVpnName());
            jobCoordinator.enqueueJob(jobKey, new IpMonitorStopTask(macEntry, dataBroker, Boolean.TRUE, vpnUtil, alivenessMonitorUtils));
        }
    }
}
Also used : MacEntry(org.opendaylight.netvirt.vpnmanager.iplearn.model.MacEntry) LivenessState(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.LivenessState) LearntVpnVipToPort(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.learnt.vpn.vip.to.port.data.LearntVpnVipToPort)

Example 4 with Monitor

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor in project genius by opendaylight.

the class ItmMonitorIntervalWorker method toggle.

private void toggle(String tunnelInterfaceName, WriteTransaction transaction) {
    if (tunnelInterfaceName != null) {
        LOG.debug("tunnel {} will have monitor interval {}", tunnelInterfaceName, interval);
        InstanceIdentifier<IfTunnel> trunkIdentifier = ItmUtils.buildTunnelId(tunnelInterfaceName);
        IfTunnel tunnel = new IfTunnelBuilder().setMonitorInterval(interval.longValue()).build();
        transaction.merge(LogicalDatastoreType.CONFIGURATION, trunkIdentifier, tunnel);
    }
}
Also used : IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) IfTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnelBuilder)

Example 5 with Monitor

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.bmp.monitor.Monitor in project genius by opendaylight.

the class AlivenessMonitorTest method testMonitorProfileCreate.

@Test
public void testMonitorProfileCreate() throws InterruptedException, ExecutionException {
    MonitorProfileCreateInput input = new MonitorProfileCreateInputBuilder().setProfile(new ProfileBuilder().setFailureThreshold(10L).setMonitorInterval(10000L).setMonitorWindow(10L).setProtocolType(EtherTypes.Arp).build()).build();
    doReturn(Futures.immediateCheckedFuture(Optional.absent())).when(readWriteTx).read(eq(LogicalDatastoreType.OPERATIONAL), argThat(isType(MonitorProfile.class)));
    doReturn(Futures.immediateCheckedFuture(null)).when(readWriteTx).submit();
    RpcResult<MonitorProfileCreateOutput> output = alivenessMonitor.monitorProfileCreate(input).get();
    assertTrue("Monitor Profile Create result", output.isSuccessful());
    assertNotNull("Monitor Profile Output", output.getResult().getProfileId());
}
Also used : MonitorProfileCreateOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateOutput) MonitorProfileCreateInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateInput) MonitorProfileCreateInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateInputBuilder) ProfileBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder) MonitorProfileBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfileBuilder) Test(org.junit.Test)

Aggregations

Optional (com.google.common.base.Optional)15 MonitorProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile)15 ReadWriteTransaction (org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction)10 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)9 Test (org.junit.Test)8 MonitoringInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.configs.MonitoringInfo)8 MonitoringState (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitoring.states.MonitoringState)8 MonitoringStateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitoring.states.MonitoringStateBuilder)8 FutureCallback (com.google.common.util.concurrent.FutureCallback)6 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)6 EtherTypes (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.EtherTypes)6 LivenessState (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.LivenessState)6 MonitorProfileCreateOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateOutput)6 ArrayList (java.util.ArrayList)5 Semaphore (java.util.concurrent.Semaphore)5 Nonnull (javax.annotation.Nonnull)5 MonitorProfileDeleteInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInput)5 MonitoringInfoBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.configs.MonitoringInfoBuilder)5 MonitoridKeyEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitorid.key.map.MonitoridKeyEntry)5 MonitoridKeyEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitorid.key.map.MonitoridKeyEntryBuilder)5