Search in sources :

Example 1 with SendEchoInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput in project openflowplugin by opendaylight.

the class SalEchoServiceImplTest method testSendEcho.

@Test
public void testSendEcho() throws Exception {
    final EchoOutput echoOut = new EchoOutputBuilder().setData(DUMMY_DATA).build();
    final RpcResult<EchoOutput> replyRpcResult = RpcResultBuilder.success(echoOut).build();
    final ListenableFuture<RpcResult<EchoOutput>> replyFt = Futures.immediateFuture(replyRpcResult);
    Mockito.when(mockedRequestContext.getFuture()).thenReturn(replyFt);
    SendEchoInput sendEchoInput = new SendEchoInputBuilder().setData(DUMMY_DATA).build();
    final Future<RpcResult<SendEchoOutput>> echoOutput = salEchoService.sendEcho(sendEchoInput);
    Assert.assertNotNull(echoOutput);
    Assert.assertTrue(echoOutput.isDone());
    Assert.assertTrue(echoOutput.get().isSuccessful());
    verify(mockedRequestContextStack).createRequestContext();
    verify(mockedOutboundQueue).commitEntry(Matchers.eq(2121L), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
}
Also used : SendEchoOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoOutput) EchoOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) SendEchoInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) EchoOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutputBuilder) SendEchoInput(org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput) Test(org.junit.Test)

Example 2 with SendEchoInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput in project openflowplugin by opendaylight.

the class EchoServiceTest method testSendEcho.

@Test
public void testSendEcho() throws Exception {
    EchoInputBuilder sendEchoInput = new EchoInputBuilder();
    echoService.handleServiceCall(sendEchoInput);
    verify(mockedRequestContextStack).createRequestContext();
}
Also used : EchoInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInputBuilder) Test(org.junit.Test)

Example 3 with SendEchoInput

use of org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput in project openflowplugin by opendaylight.

the class EchoServiceTest method testBuildRequest.

@Test
public void testBuildRequest() throws Exception {
    EchoInputBuilder sendEchoInput = new EchoInputBuilder().setData(DUMMY_DATA);
    final OfHeader request = this.echoService.buildRequest(new Xid(DUMMY_XID_VALUE), sendEchoInput);
    assertEquals(DUMMY_XID_VALUE, request.getXid());
    assertTrue(request instanceof EchoInput);
    final byte[] data = ((EchoInput) request).getData();
    assertArrayEquals(DUMMY_DATA, data);
    assertEquals(OFConstants.OFP_VERSION_1_3, request.getVersion().shortValue());
}
Also used : Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) EchoInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput) OfHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader) EchoInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInputBuilder) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 EchoInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInputBuilder)2 OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)2 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)1 SendEchoInput (org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput)1 SendEchoInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInputBuilder)1 SendEchoOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoOutput)1 EchoInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput)1 EchoOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutput)1 EchoOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoOutputBuilder)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1