use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder in project openflowplugin by opendaylight.
the class MplsTcEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final short mplsTc = (short) 1;
final Match mplsTcMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsTc(mplsTc).build()).build();
assertMatch(mplsTcMatch, false, (out) -> assertEquals(out.readUnsignedByte(), mplsTc));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder in project openflowplugin by opendaylight.
the class MplsLabelEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final long mplsLabel = message.readUnsignedInt();
if (Objects.isNull(builder.getProtocolMatchFields())) {
builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsLabel(mplsLabel).build());
} else if (Objects.isNull(builder.getProtocolMatchFields().getMplsLabel())) {
builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder(builder.getProtocolMatchFields()).setMplsLabel(mplsLabel).build());
} else {
throwErrorOnMalformed(builder, "protocolMatchFields", "mplsLabel");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder in project openflowplugin by opendaylight.
the class MplsLabelEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final long mplsLabel = 10L;
final Match mplsLabelMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsLabel(mplsLabel).build()).build();
assertMatch(mplsLabelMatch, false, (out) -> assertEquals(out.readUnsignedInt(), mplsLabel));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder in project openflowplugin by opendaylight.
the class PbbEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final long pbbId = 6789;
final byte[] pbbIdMask = new byte[] { 0, 15, 10 };
final Match pbbMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setPbb(new PbbBuilder().setPbbIsid(pbbId).setPbbMask(ByteUtil.bytesToUnsignedMedium(pbbIdMask)).build()).build()).build();
assertMatch(pbbMatch, true, (out) -> {
assertEquals(out.readUnsignedMedium(), pbbId);
final byte[] mask = new byte[3];
out.readBytes(mask);
assertArrayEquals(mask, pbbIdMask);
});
final Match pbbMatchNoMask = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setPbb(new PbbBuilder().setPbbIsid(pbbId).build()).build()).build();
assertMatch(pbbMatchNoMask, false, (out) -> assertEquals(out.readUnsignedMedium(), pbbId));
}
Aggregations