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();
}
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();
}
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());
}
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);
}
Aggregations