use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method createRequestMeterConfig.
private static MultipartRequestMeterConfigCase createRequestMeterConfig() {
MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
MultipartRequestMeterConfigBuilder builder = new MultipartRequestMeterConfigBuilder();
builder.setMeterId(new MeterId(1133L));
caseBuilder.setMultipartRequestMeterConfig(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method decodeRequestMeterConfig.
private static MultipartRequestMeterConfigCase decodeRequestMeterConfig(ByteBuf output) {
MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
MultipartRequestMeterConfigBuilder builder = new MultipartRequestMeterConfigBuilder();
builder.setMeterId(new MeterId(output.readUnsignedInt()));
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY);
caseBuilder.setMultipartRequestMeterConfig(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId in project openflowplugin by opendaylight.
the class MeterInstructionDeserializerTest method testDeserialize.
@Test
public void testDeserialize() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final int meterId = 3;
writeHeader(in);
in.writeInt(meterId);
final Instruction instruction = deserializeInstruction(in);
assertEquals(MeterCase.class, instruction.getImplementedInterface());
assertEquals(meterId, MeterCase.class.cast(instruction).getMeter().getMeterId().getValue().intValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method createMeterConfig.
private static List<MeterConfig> createMeterConfig() {
MeterConfigBuilder builder = new MeterConfigBuilder();
builder.setFlags(new MeterFlags(true, false, true, false));
builder.setMeterId(new MeterId(1L));
builder.setBands(createBandsList());
List<MeterConfig> list = new ArrayList<>();
list.add(builder.build());
return list;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method testMeterConfigSerialize.
@Test
public void testMeterConfigSerialize() throws Exception {
MultipartReplyMessageBuilder builder = new MultipartReplyMessageBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(10));
MultipartReplyMeterConfigCaseBuilder meterConfigCase = new MultipartReplyMeterConfigCaseBuilder();
MultipartReplyMeterConfigBuilder meterConfigBuilder = new MultipartReplyMeterConfigBuilder();
meterConfigBuilder.setMeterConfig(createMeterConfig());
meterConfigCase.setMultipartReplyMeterConfig(meterConfigBuilder.build());
builder.setMultipartReplyBody(meterConfigCase.build());
MultipartReplyMessage message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 48);
Assert.assertEquals("Wrong type", MultipartType.OFPMPMETERCONFIG.getIntValue(), serializedBuffer.readShort());
Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort()));
serializedBuffer.skipBytes(PADDING);
MultipartReplyMeterConfigCase body = (MultipartReplyMeterConfigCase) message.getMultipartReplyBody();
MultipartReplyMeterConfig messageOutput = body.getMultipartReplyMeterConfig();
MeterConfig meterConfig = messageOutput.getMeterConfig().get(0);
Assert.assertEquals("Wrong len", 32, serializedBuffer.readShort());
Assert.assertEquals("Wrong flags", meterConfig.getFlags(), createMeterFlags(serializedBuffer.readShort()));
Assert.assertEquals("Wrong meterId", meterConfig.getMeterId().getValue().intValue(), serializedBuffer.readInt());
Assert.assertEquals("Wrong bands", meterConfig.getBands(), decodeBandsList(serializedBuffer));
}
Aggregations