use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos in project openflowplugin by opendaylight.
the class MplsBosEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final short mplsBos = (short) 1;
final Match mplsBosMatch = new MatchBuilder().setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsBos(mplsBos).build()).build();
// TODO: Why are we using short in models instead of boolean?
assertMatch(mplsBosMatch, false, (out) -> assertEquals(out.readBoolean(), mplsBos != 0));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos in project openflowplugin by opendaylight.
the class OfToSalMplsBosCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull MplsBosCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
MplsBos mplsBos = source.getMplsBos();
if (mplsBos != null) {
protocolMatchFieldsBuilder.setMplsBos(mplsBos.isBos() ? (short) 1 : (short) 0);
matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos in project openflowplugin by opendaylight.
the class MplsBosEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final short mplsBos = message.readUnsignedByte();
if (Objects.isNull(builder.getProtocolMatchFields())) {
builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsBos(mplsBos).build());
} else if (Objects.isNull(builder.getProtocolMatchFields().getMplsBos())) {
builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder(builder.getProtocolMatchFields()).setMplsBos(mplsBos).build());
} else {
throwErrorOnMalformed(builder, "protocolMatchFields", "mplsBos");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos in project openflowplugin by opendaylight.
the class MplsBosEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final short mplsBos = 6;
writeHeader(in, false);
in.writeByte(mplsBos);
ProtocolMatchFields match = deserialize(in).getProtocolMatchFields();
assertEquals(mplsBos, match.getMplsBos().shortValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos in project openflowplugin by opendaylight.
the class MatchConvertor method toOfMplsBos.
private static MatchEntry toOfMplsBos(final Short mplsBos) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(MplsBos.class);
MplsBosCaseBuilder mplsBosCaseBuilder = new MplsBosCaseBuilder();
MplsBosBuilder mplsBosBuilder = new MplsBosBuilder();
mplsBosBuilder.setBos(mplsBos != 0);
mplsBosCaseBuilder.setMplsBos(mplsBosBuilder.build());
matchEntryBuilder.setMatchEntryValue(mplsBosCaseBuilder.build());
return matchEntryBuilder.build();
}
Aggregations