use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutputBuilder in project openflowplugin by opendaylight.
the class SalAsyncConfigServiceImplTest method testGetAsyncTest.
@Test
public void testGetAsyncTest() throws Exception {
final GetAsyncOutput getAsyncOutput = new GetAsyncOutputBuilder().build();
final RpcResult<GetAsyncOutput> replyRpcResult = RpcResultBuilder.success(getAsyncOutput).build();
final ListenableFuture<RpcResult<GetAsyncOutput>> replyFuture = Futures.immediateFuture(replyRpcResult);
Mockito.when(mockedRequestContext.getFuture()).thenReturn(replyFuture);
final Future<RpcResult<GetAsyncOutput>> getAsyncResult = salAsyncConfigService.getAsync(new GetAsyncInputBuilder().build());
Assert.assertNotNull(getAsyncResult);
Assert.assertTrue(getAsyncResult.isDone());
Assert.assertTrue(getAsyncResult.get().isSuccessful());
verify(mockedRequestContextStack).createRequestContext();
verify(mockedOutboundQueue).commitEntry(Matchers.eq(ServiceMocking.DUMMY_XID_VALUE), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutputBuilder in project openflowplugin by opendaylight.
the class GetAsyncReplyMessageFactory method deserialize.
@Override
public GetAsyncOutput deserialize(ByteBuf rawMessage) {
GetAsyncOutputBuilder builder = new GetAsyncOutputBuilder();
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.openflow.protocol.rev130731.GetAsyncOutputBuilder in project openflowplugin by opendaylight.
the class GetAsyncReplyMessageFactoryTest method testSerialize.
@Test
public void testSerialize() throws Exception {
GetAsyncOutputBuilder builder = new GetAsyncOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setPacketInMask(createPacketInMask());
builder.setPortStatusMask(createPortStatusMask());
builder.setFlowRemovedMask(createFlowRemowedMask());
GetAsyncOutput message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 32);
Assert.assertEquals("Wrong packetInMask", 7, serializedBuffer.readUnsignedInt());
Assert.assertEquals("Wrong packetInMask", 0, serializedBuffer.readUnsignedInt());
Assert.assertEquals("Wrong portStatusMask", 7, serializedBuffer.readUnsignedInt());
Assert.assertEquals("Wrong portStatusMask", 0, serializedBuffer.readUnsignedInt());
Assert.assertEquals("Wrong flowRemovedMask", 15, serializedBuffer.readUnsignedInt());
Assert.assertEquals("Wrong flowRemovedMask", 0, serializedBuffer.readUnsignedInt());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutputBuilder in project openflowplugin by opendaylight.
the class GetAsyncReplyMessageFactoryTest method testSetAsyncInputWithNullMasks.
@Test
public void testSetAsyncInputWithNullMasks() throws Exception {
GetAsyncOutputBuilder builder = new GetAsyncOutputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setPacketInMask(null);
builder.setPortStatusMask(null);
builder.setFlowRemovedMask(null);
GetAsyncOutput message = builder.build();
GetAsyncReplyMessageFactory serializer = new GetAsyncReplyMessageFactory();
SerializerRegistry registry = new SerializerRegistryImpl();
registry.init();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 8);
Assert.assertTrue("Unexpected data", serializedBuffer.readableBytes() == 0);
}
Aggregations