Search in sources :

Example 1 with ProfileBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder 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 ProfileBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder 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)

Example 3 with ProfileBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder in project genius by opendaylight.

the class AlivenessMonitorTest method createProfile.

@SuppressWarnings("unchecked")
private long createProfile() 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), any(InstanceIdentifier.class));
    doReturn(Futures.immediateCheckedFuture(null)).when(readWriteTx).submit();
    RpcResult<MonitorProfileCreateOutput> output = alivenessMonitor.monitorProfileCreate(input).get();
    return 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) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) 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)

Example 4 with ProfileBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder in project genius by opendaylight.

the class AlivenessMonitorTest method testMonitorProfileCreateAlreadyExist.

@Test
public void testMonitorProfileCreateAlreadyExist() throws InterruptedException, ExecutionException {
    MonitorProfileCreateInput input = new MonitorProfileCreateInputBuilder().setProfile(new ProfileBuilder().setFailureThreshold(10L).setMonitorInterval(10000L).setMonitorWindow(10L).setProtocolType(EtherTypes.Arp).build()).build();
    @SuppressWarnings("unchecked") Optional<MonitorProfile> optionalProfile = mock(Optional.class);
    CheckedFuture<Optional<MonitorProfile>, ReadFailedException> proFuture = Futures.immediateCheckedFuture(optionalProfile);
    doReturn(true).when(optionalProfile).isPresent();
    doReturn(proFuture).when(readWriteTx).read(eq(LogicalDatastoreType.OPERATIONAL), argThat(isType(MonitorProfile.class)));
    RpcResult<MonitorProfileCreateOutput> output = alivenessMonitor.monitorProfileCreate(input).get();
    assertTrue("Monitor Profile Create result", output.isSuccessful());
    assertThat(output.getErrors(), CoreMatchers.hasItem(hasErrorType(ErrorType.PROTOCOL)));
}
Also used : MonitorProfileCreateOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateOutput) ReadFailedException(org.opendaylight.controller.md.sal.common.api.data.ReadFailedException) Optional(com.google.common.base.Optional) MonitorProfileCreateInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateInput) MonitorProfileCreateInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateInputBuilder) MonitorProfile(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile) 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)

Example 5 with ProfileBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder 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

ProfileBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profile.create.input.ProfileBuilder)5 MonitorProfileCreateInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateInput)3 MonitorProfileCreateInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateInputBuilder)3 MonitorProfileCreateOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileCreateOutput)3 MonitorProfileBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfileBuilder)3 Test (org.junit.Test)2 MonitorProfileGetInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.MonitorProfileGetInputBuilder)2 Optional (com.google.common.base.Optional)1 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)1 MonitorProfile (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.monitor.profiles.MonitorProfile)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1