use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDescBuilder in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactory method setDesc.
private static MultipartReplyDescCase setDesc(ByteBuf input) {
final MultipartReplyDescCaseBuilder caseBuilder = new MultipartReplyDescCaseBuilder();
MultipartReplyDescBuilder descBuilder = new MultipartReplyDescBuilder();
byte[] mfrDescBytes = new byte[DESC_STR_LEN];
input.readBytes(mfrDescBytes);
String mfrDesc = new String(mfrDescBytes, StandardCharsets.UTF_8);
descBuilder.setMfrDesc(mfrDesc.trim());
byte[] hwDescBytes = new byte[DESC_STR_LEN];
input.readBytes(hwDescBytes);
String hwDesc = new String(hwDescBytes, StandardCharsets.UTF_8);
descBuilder.setHwDesc(hwDesc.trim());
byte[] swDescBytes = new byte[DESC_STR_LEN];
input.readBytes(swDescBytes);
String swDesc = new String(swDescBytes, StandardCharsets.UTF_8);
descBuilder.setSwDesc(swDesc.trim());
byte[] serialNumBytes = new byte[SERIAL_NUM_LEN];
input.readBytes(serialNumBytes);
String serialNum = new String(serialNumBytes, StandardCharsets.UTF_8);
descBuilder.setSerialNum(serialNum.trim());
byte[] dpDescBytes = new byte[DESC_STR_LEN];
input.readBytes(dpDescBytes);
String dpDesc = new String(dpDescBytes, StandardCharsets.UTF_8);
descBuilder.setDpDesc(dpDesc.trim());
caseBuilder.setMultipartReplyDesc(descBuilder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDescBuilder in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactoryTest method testDescBodySerialize.
@Test
public void testDescBodySerialize() throws Exception {
MultipartReplyMessageBuilder builder;
builder = new MultipartReplyMessageBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
builder.setFlags(new MultipartRequestFlags(true));
builder.setType(MultipartType.forValue(0));
final MultipartReplyDescCaseBuilder descCase = new MultipartReplyDescCaseBuilder();
MultipartReplyDescBuilder desc = new MultipartReplyDescBuilder();
desc.setMfrDesc("Test");
desc.setHwDesc("Test");
desc.setSwDesc("Test");
desc.setSerialNum("12345");
desc.setDpDesc("Test");
descCase.setMultipartReplyDesc(desc.build());
builder.setMultipartReplyBody(descCase.build());
MultipartReplyMessage message = builder.build();
ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
factory.serialize(message, serializedBuffer);
BufferHelper.checkHeaderV10(serializedBuffer, MESSAGE_TYPE, 1068);
Assert.assertEquals("Wrong type", MultipartType.OFPMPDESC.getIntValue(), serializedBuffer.readShort());
Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort()));
Assert.assertEquals("Wrong desc body", message.getMultipartReplyBody(), decodeDescBody(serializedBuffer));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDescBuilder in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorUtilTest method translateDesc.
@Test
public void translateDesc() {
final MultipartReply multipartReply = buildReply(MultipartType.OFPMPDESC, new MultipartReplyDescCaseBuilder().setMultipartReplyDesc(new MultipartReplyDescBuilder().build()).build());
dummyAssertReply(multipartReply);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.desc._case.MultipartReplyDescBuilder in project openflowplugin by opendaylight.
the class MsgGeneratorTestUtils method makeMultipartDescReply.
public static MultipartReplyMessageBuilder makeMultipartDescReply(final long xid, final String value, final boolean hasNext) {
final MultipartReplyDesc descValue = new MultipartReplyDescBuilder().setHwDesc(value).build();
final MultipartReplyDescCase replyBody = new MultipartReplyDescCaseBuilder().setMultipartReplyDesc(descValue).build();
MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder().setMultipartReplyBody(replyBody).setXid(xid).setFlags(new MultipartRequestFlags(hasNext)).setType(MultipartType.OFPMPDESC);
return messageBuilder;
}
Aggregations