use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput in project openflowplugin by opendaylight.
the class EchoInputMessageFactoryTest method testData.
/**
* Testing of {@link EchoInputMessageFactory} for correct data serialization.
*/
@Test
public void testData() throws Exception {
byte[] dataToTest = new byte[] { 91, 92, 93, 94, 95, 96, 97, 98 };
EchoInputBuilder eib = new EchoInputBuilder();
BufferHelper.setupHeader(eib, EncodeConstants.OF13_VERSION_ID);
eib.setData(dataToTest);
EchoInput ei = eib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
echoFactory.serialize(ei, out);
BufferHelper.checkHeaderV13(out, ECHO_REQUEST_MESSAGE_CODE_TYPE, 8 + dataToTest.length);
byte[] outData = new byte[dataToTest.length];
out.readBytes(outData);
Assert.assertArrayEquals("Wrong - different output data.", dataToTest, outData);
out.release();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput in project openflowplugin by opendaylight.
the class EchoInputMessageFactoryTest method testV13.
/**
* Testing of {@link EchoInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV13() throws Exception {
EchoInputBuilder eib = new EchoInputBuilder();
BufferHelper.setupHeader(eib, EncodeConstants.OF13_VERSION_ID);
EchoInput ei = eib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
echoFactory.serialize(ei, out);
BufferHelper.checkHeaderV13(out, ECHO_REQUEST_MESSAGE_CODE_TYPE, 8);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput in project openflowplugin by opendaylight.
the class EchoInputMessageFactoryTest method testV10.
/**
* Testing of {@link EchoInputMessageFactory} for correct translation from POJO.
*/
@Test
public void testV10() throws Exception {
EchoInputBuilder eib = new EchoInputBuilder();
BufferHelper.setupHeader(eib, EncodeConstants.OF10_VERSION_ID);
EchoInput ei = eib.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
echoFactory.serialize(ei, out);
BufferHelper.checkHeaderV10(out, ECHO_REQUEST_MESSAGE_CODE_TYPE, 8);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInput in project openflowplugin by opendaylight.
the class EchoServiceTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
EchoInputBuilder sendEchoInput = new EchoInputBuilder().setData(DUMMY_DATA);
final OfHeader request = this.echoService.buildRequest(new Xid(DUMMY_XID_VALUE), sendEchoInput);
assertEquals(DUMMY_XID_VALUE, request.getXid());
assertTrue(request instanceof EchoInput);
final byte[] data = ((EchoInput) request).getData();
assertArrayEquals(DUMMY_DATA, data);
assertEquals(OFConstants.OFP_VERSION_1_3, request.getVersion().shortValue());
}
Aggregations