Search in sources :

Example 1 with SetAsyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInputBuilder in project openflowplugin by opendaylight.

the class SalAsyncConfigServiceImplTest method testSetAsync.

@Test
public void testSetAsync() throws Exception {
    final SetAsyncInput setAsyncInput = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInputBuilder().build();
    final RpcResult<SetAsyncInput> replyRpcResult = RpcResultBuilder.success(setAsyncInput).build();
    final ListenableFuture<RpcResult<SetAsyncInput>> replyFuture = Futures.immediateFuture(replyRpcResult);
    Mockito.when(mockedRequestContext.getFuture()).thenReturn(replyFuture);
    final Future<RpcResult<Void>> setAsyncResult = salAsyncConfigService.setAsync(new SetAsyncInputBuilder().build());
    Assert.assertNotNull(setAsyncResult);
    Assert.assertTrue(setAsyncResult.isDone());
    Assert.assertTrue(setAsyncResult.get().isSuccessful());
    verify(mockedRequestContextStack).createRequestContext();
}
Also used : SetAsyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInputBuilder) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) SetAsyncInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput) Test(org.junit.Test)

Example 2 with SetAsyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInputBuilder in project openflowplugin by opendaylight.

the class SetAsyncInputMessageFactory method deserialize.

@Override
public SetAsyncInput deserialize(ByteBuf rawMessage) {
    SetAsyncInputBuilder builder = new SetAsyncInputBuilder();
    builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
    builder.setXid(rawMessage.readUnsignedInt());
    builder.setPacketInMask(decodePacketInMask(rawMessage));
    builder.setPortStatusMask(decodePortStatusMask(rawMessage));
    builder.setFlowRemovedMask(decodeFlowRemovedMask(rawMessage));
    return builder.build();
}
Also used : SetAsyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInputBuilder)

Example 3 with SetAsyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInputBuilder in project openflowplugin by opendaylight.

the class SetAsyncInputMessageFactoryTest method testSetAsyncInputMessage.

/**
 * Testing of {@link SetAsyncInputMessageFactory} for correct translation from POJO.
 */
@Test
public void testSetAsyncInputMessage() throws Exception {
    SetAsyncInputBuilder builder = new SetAsyncInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setPacketInMask(createPacketInMask());
    builder.setPortStatusMask(createPortStatusMask());
    builder.setFlowRemovedMask(createFlowRemowedMask());
    SetAsyncInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    setAsyncFactory.serialize(message, out);
    BufferHelper.checkHeaderV13(out, (byte) 28, 32);
    Assert.assertEquals("Wrong packetInMask", 7, out.readUnsignedInt());
    Assert.assertEquals("Wrong packetInMask", 0, out.readUnsignedInt());
    Assert.assertEquals("Wrong portStatusMask", 7, out.readUnsignedInt());
    Assert.assertEquals("Wrong portStatusMask", 0, out.readUnsignedInt());
    Assert.assertEquals("Wrong flowRemovedMask", 15, out.readUnsignedInt());
    Assert.assertEquals("Wrong flowRemovedMask", 0, out.readUnsignedInt());
}
Also used : SetAsyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInputBuilder) SetAsyncInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 4 with SetAsyncInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInputBuilder in project openflowplugin by opendaylight.

the class SetAsyncInputMessageFactoryTest method testSetAsyncInputWithNullMasks.

/**
 * Testing of {@link SetAsyncInputMessageFactory} for correct translation from POJO.
 */
@Test
public void testSetAsyncInputWithNullMasks() throws Exception {
    SetAsyncInputBuilder builder = new SetAsyncInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setPacketInMask(null);
    builder.setPortStatusMask(null);
    builder.setFlowRemovedMask(null);
    SetAsyncInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    setAsyncFactory.serialize(message, out);
    BufferHelper.checkHeaderV13(out, (byte) 28, 8);
    Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
Also used : SetAsyncInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInputBuilder) SetAsyncInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 SetAsyncInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput)3 SetAsyncInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInputBuilder)3 ByteBuf (io.netty.buffer.ByteBuf)2 SetAsyncInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.async.config.service.rev170619.SetAsyncInputBuilder)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1