use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartRequestMeterFeaturesTest method test.
/**
* Tests {@link MultipartRequestInputFactory} - MeterFeatures case.
*/
@Test
public void test() throws Exception {
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setType(MultipartType.OFPMPMETERFEATURES);
builder.setFlags(new MultipartRequestFlags(false));
MultipartRequestMeterFeaturesCaseBuilder caseBuilder = new MultipartRequestMeterFeaturesCaseBuilder();
MultipartRequestMeterFeaturesBuilder featuresBuilder = new MultipartRequestMeterFeaturesBuilder();
featuresBuilder.setEmpty(true);
caseBuilder.setMultipartRequestMeterFeatures(featuresBuilder.build());
builder.setMultipartRequestBody(caseBuilder.build());
MultipartRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
multipartFactory.serialize(message, out);
BufferHelper.checkHeaderV13(out, (byte) 18, 16);
Assert.assertEquals("Wrong type", 11, out.readUnsignedShort());
Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
// skip padding
out.skipBytes(4);
Assert.assertTrue("Unexpected data", out.readableBytes() == 0);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorTest method prepareMocks.
private MultipartReplyMessage prepareMocks(DeviceContext mockedDeviceContext, MultipartReplyBody multipartReplyBody, final MultipartType multipartType) {
ConnectionContext mockedConnectionContext = mock(ConnectionContext.class);
FeaturesReply mockedFeaturesReply = mock(FeaturesReply.class);
when(mockedFeaturesReply.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(mockedFeaturesReply.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
DeviceInfo deviceInfo = mock(DeviceInfo.class);
when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
when(deviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID);
when(mockedDeviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeaturesReply);
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext);
MultipartReplyMessage multipartReplyMessage = mock(MultipartReplyMessage.class);
when(multipartReplyMessage.getType()).thenReturn(multipartType);
when(multipartReplyMessage.getFlags()).thenReturn(new MultipartRequestFlags(true));
when(multipartReplyMessage.getXid()).thenReturn(DUMMY_XID);
when(multipartReplyMessage.getMultipartReplyBody()).thenReturn(multipartReplyBody);
return multipartReplyMessage;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class OF10StatsRequestInputFactory method getMultipartRequestFlags.
@SuppressWarnings("checkstyle:AbbreviationAsWordInName")
private static MultipartRequestFlags getMultipartRequestFlags(int input) {
final Boolean _oFPMPFREQMORE = (input & 1 << 0) != 0;
MultipartRequestFlags flag = new MultipartRequestFlags(_oFPMPFREQMORE);
return flag;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartRequestDescInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 01 00 00 00 00");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong type", MultipartType.forValue(0), deserializedMessage.getType());
Assert.assertEquals("Wrong flags", new MultipartRequestFlags(true), deserializedMessage.getFlags());
Assert.assertEquals("Wrong aggregate", createRequestDesc(), deserializedMessage.getMultipartRequestBody());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags in project openflowplugin by opendaylight.
the class MultipartRequestQueueInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 00 00 08 d0 00 00 08 a3");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong type", MultipartType.forValue(5), deserializedMessage.getType());
Assert.assertEquals("Wrong flags", new MultipartRequestFlags(true), deserializedMessage.getFlags());
Assert.assertEquals("Wrong aggregate", createRequestQueue(), deserializedMessage.getMultipartRequestBody());
}
Aggregations