Search in sources :

Example 1 with MonitorProfileDeleteInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInputBuilder in project genius by opendaylight.

the class AlivenessMonitorTest method testMonitorProfileDelete.

@Test
public void testMonitorProfileDelete() throws InterruptedException, ExecutionException {
    MonitorProfileDeleteInput input = new MonitorProfileDeleteInputBuilder().setProfileId(1L).build();
    Optional<MonitorProfile> optProfile = Optional.of(getTestMonitorProfile());
    when(readWriteTx.read(eq(LogicalDatastoreType.OPERATIONAL), argThat(isType(MonitorProfile.class)))).thenReturn(Futures.immediateCheckedFuture(optProfile));
    RpcResult<Void> result = alivenessMonitor.monitorProfileDelete(input).get();
    verify(idManager).releaseId(any(ReleaseIdInput.class));
    verify(readWriteTx).delete(eq(LogicalDatastoreType.OPERATIONAL), Matchers.<InstanceIdentifier<MonitorProfile>>any());
    assertTrue("Monitor profile delete result", result.isSuccessful());
}
Also used : MonitorProfileDeleteInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInput) MonitorProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile) ReleaseIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput) MonitorProfileDeleteInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInputBuilder) Test(org.junit.Test)

Example 2 with MonitorProfileDeleteInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInputBuilder 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);
        }
    }
}
Also used : MonitorProfileDeleteInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) IfTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel) MonitorProfileDeleteInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInputBuilder)

Aggregations

MonitorProfileDeleteInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInput)2 MonitorProfileDeleteInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileDeleteInputBuilder)2 Test (org.junit.Test)1 MonitorProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile)1 ReleaseIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput)1 IfTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfTunnel)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1