Search in sources :

Example 1 with AlivenessMonitor

use of org.opendaylight.genius.alivenessmonitor.internal.AlivenessMonitor in project genius by opendaylight.

the class AlivenessMonitorTest method setUp.

@SuppressWarnings("unchecked")
@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    when(idManager.createIdPool(any(CreateIdPoolInput.class))).thenReturn(Futures.immediateFuture(RpcResultBuilder.<Void>success().build()));
    AlivenessProtocolHandlerRegistry alivenessProtocolHandlerRegistry = new AlivenessProtocolHandlerRegistryImpl();
    alivenessMonitor = new AlivenessMonitor(dataBroker, idManager, notificationPublishService, alivenessProtocolHandlerRegistry);
    arpHandler = new AlivenessProtocolHandlerARP(dataBroker, interfaceManager, alivenessProtocolHandlerRegistry, arpService);
    lldpHandler = new AlivenessProtocolHandlerLLDP(dataBroker, alivenessProtocolHandlerRegistry, packetProcessingService);
    mockId = 1L;
    when(idManager.allocateId(any(AllocateIdInput.class))).thenReturn(Futures.immediateFuture(RpcResultBuilder.success(new AllocateIdOutputBuilder().setIdValue(mockId++).build()).build()));
    when(idManager.releaseId(any(ReleaseIdInput.class))).thenReturn(Futures.immediateFuture(RpcResultBuilder.<Void>success().build()));
    doReturn(readTx).when(dataBroker).newReadOnlyTransaction();
    doReturn(writeTx).when(dataBroker).newWriteOnlyTransaction();
    doReturn(readWriteTx).when(dataBroker).newReadWriteTransaction();
    doNothing().when(writeTx).put(eq(LogicalDatastoreType.OPERATIONAL), any(InstanceIdentifier.class), any(DataObject.class));
    doReturn(Futures.immediateCheckedFuture(null)).when(writeTx).submit();
    doReturn(Futures.immediateCheckedFuture(null)).when(readWriteTx).submit();
}
Also used : DataObject(org.opendaylight.yangtools.yang.binding.DataObject) AllocateIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput) AllocateIdOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutputBuilder) AlivenessProtocolHandlerLLDP(org.opendaylight.genius.alivenessmonitor.protocols.internal.AlivenessProtocolHandlerLLDP) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) CreateIdPoolInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput) AlivenessProtocolHandlerRegistry(org.opendaylight.genius.alivenessmonitor.protocols.AlivenessProtocolHandlerRegistry) ReleaseIdInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput) AlivenessProtocolHandlerRegistryImpl(org.opendaylight.genius.alivenessmonitor.protocols.internal.AlivenessProtocolHandlerRegistryImpl) AlivenessMonitor(org.opendaylight.genius.alivenessmonitor.internal.AlivenessMonitor) AlivenessProtocolHandlerARP(org.opendaylight.genius.alivenessmonitor.protocols.internal.AlivenessProtocolHandlerARP) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)1 AlivenessMonitor (org.opendaylight.genius.alivenessmonitor.internal.AlivenessMonitor)1 AlivenessProtocolHandlerRegistry (org.opendaylight.genius.alivenessmonitor.protocols.AlivenessProtocolHandlerRegistry)1 AlivenessProtocolHandlerARP (org.opendaylight.genius.alivenessmonitor.protocols.internal.AlivenessProtocolHandlerARP)1 AlivenessProtocolHandlerLLDP (org.opendaylight.genius.alivenessmonitor.protocols.internal.AlivenessProtocolHandlerLLDP)1 AlivenessProtocolHandlerRegistryImpl (org.opendaylight.genius.alivenessmonitor.protocols.internal.AlivenessProtocolHandlerRegistryImpl)1 AllocateIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInput)1 AllocateIdOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdOutputBuilder)1 CreateIdPoolInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.CreateIdPoolInput)1 ReleaseIdInput (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.ReleaseIdInput)1 DataObject (org.opendaylight.yangtools.yang.binding.DataObject)1 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)1