use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput in project openflowplugin by opendaylight.
the class MessageListenerWrapperTest method test.
/**
* Test MessageListenerWrapper creation.
*/
@Test
public void test() {
HelloInputBuilder builder = new HelloInputBuilder();
HelloInput hello = builder.build();
SimpleRpcListener listener = new SimpleRpcListener(hello, "Error");
MessageListenerWrapper wrapper = new MessageListenerWrapper(hello, listener);
Assert.assertEquals("Wrong message", hello, wrapper.getMsg());
Assert.assertEquals("Wrong listener", listener, wrapper.getListener());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput in project openflowplugin by opendaylight.
the class OFDatagramPacketEncoderTest method startUp.
/**
* Initializes mocks and other objects.
*
* @param version openflow protocol wire version
*/
public void startUp(Short version) {
MockitoAnnotations.initMocks(this);
out = new ArrayList<>();
HelloInputBuilder builder = new HelloInputBuilder();
builder.setVersion(version);
HelloInput hello = builder.build();
wrapper = new UdpMessageListenerWrapper(hello, listener, address);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput in project openflowplugin by opendaylight.
the class HelloInputMessageFactoryTest method testWith4BitVersionBitmap.
/**
* Testing of {@link HelloInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testWith4BitVersionBitmap() throws Exception {
int lengthOfBitmap = 4;
HelloInputBuilder builder = new HelloInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
List<Elements> expectedElement = createElement(lengthOfBitmap);
builder.setElements(expectedElement);
HelloInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
helloFactory.serialize(message, out);
if (LOG.isDebugEnabled()) {
LOG.debug("bytebuf: {}", ByteBufUtils.byteBufToHexString(out));
}
BufferHelper.checkHeaderV13(out, (byte) 0, 16);
Elements element = readElement(out).get(0);
Assert.assertEquals("Wrong element type", expectedElement.get(0).getType(), element.getType());
Elements comparation = createComparationElement(lengthOfBitmap).get(0);
Assert.assertArrayEquals("Wrong element bitmap", comparation.getVersionBitmap().toArray(), element.getVersionBitmap().toArray());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput in project openflowplugin by opendaylight.
the class HelloInputMessageFactoryTest method testWithoutElementsSet.
/**
* Testing of {@link HelloInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testWithoutElementsSet() throws Exception {
HelloInputBuilder hib = new HelloInputBuilder();
BufferHelper.setupHeader(hib, EncodeConstants.OF13_VERSION_ID);
HelloInput hi = hib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
helloFactory.serialize(hi, out);
BufferHelper.checkHeaderV13(out, (byte) 0, EncodeConstants.OFHEADER_SIZE);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput in project openflowplugin by opendaylight.
the class OF10HelloInputMessageFactoryTest method testWithoutElementsSet.
/**
* Testing of {@link OF10HelloInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testWithoutElementsSet() throws Exception {
HelloInputBuilder hib = new HelloInputBuilder();
BufferHelper.setupHeader(hib, EncodeConstants.OF10_VERSION_ID);
HelloInput hi = hib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
helloFactory.serialize(hi, out);
BufferHelper.checkHeaderV10(out, (byte) 0, 8);
}
Aggregations