use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput 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.openflow.protocol.rev130731.SetAsyncInput 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.openflow.protocol.rev130731.SetAsyncInput in project openflowplugin by opendaylight.
the class SetAsyncInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 07 00 00 00 00 00 00 00 " + "07 00 00 00 00 00 00 00 0f 00 00 00 00");
SetAsyncInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong packet in mask ", createPacketInMask().get(0), deserializedMessage.getPacketInMask().get(0));
Assert.assertEquals("Wrong packet in mask ", createPacketInMask().get(1), deserializedMessage.getPacketInMask().get(1));
Assert.assertEquals("Wrong port status mask ", createPortStatusMask().get(0), deserializedMessage.getPortStatusMask().get(0));
Assert.assertEquals("Wrong port status mask ", createPortStatusMask().get(1), deserializedMessage.getPortStatusMask().get(1));
Assert.assertEquals("Wrong flow removed mask ", createFlowRemowedMask().get(0), deserializedMessage.getFlowRemovedMask().get(0));
Assert.assertEquals("Wrong flow removed mask ", createFlowRemowedMask().get(1), deserializedMessage.getFlowRemovedMask().get(1));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetAsyncInput 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.openflow.protocol.rev130731.SetAsyncInput 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