use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.
the class OfToSalMplsTcCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull MplsTcCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final ProtocolMatchFieldsBuilder protocolMatchFieldsBuilder = data.getProtocolMatchFieldsBuilder();
MplsTc mplsTc = source.getMplsTc();
if (mplsTc != null) {
protocolMatchFieldsBuilder.setMplsTc(mplsTc.getTc());
matchBuilder.setProtocolMatchFields(protocolMatchFieldsBuilder.build());
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.
the class MplsTcEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final short mplsTc = message.readUnsignedByte();
if (Objects.isNull(builder.getProtocolMatchFields())) {
builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder().setMplsTc(mplsTc).build());
} else if (Objects.isNull(builder.getProtocolMatchFields().getMplsTc())) {
builder.setProtocolMatchFields(new ProtocolMatchFieldsBuilder(builder.getProtocolMatchFields()).setMplsTc(mplsTc).build());
} else {
throwErrorOnMalformed(builder, "protocolMatchFields", "mplsTc");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc 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.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.
the class MplsTcEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final short mplsTc = 6;
writeHeader(in, false);
in.writeByte(mplsTc);
ProtocolMatchFields match = deserialize(in).getProtocolMatchFields();
assertEquals(mplsTc, match.getMplsTc().shortValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTc in project openflowplugin by opendaylight.
the class MatchConvertor method toOfMplsTc.
private static MatchEntry toOfMplsTc(final Short mplsTc) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
matchEntryBuilder.setHasMask(false);
matchEntryBuilder.setOxmMatchField(MplsTc.class);
MplsTcCaseBuilder mplsTcCaseBuilder = new MplsTcCaseBuilder();
MplsTcBuilder mplsTcBuilder = new MplsTcBuilder();
mplsTcBuilder.setTc(mplsTc);
mplsTcCaseBuilder.setMplsTc(mplsTcBuilder.build());
matchEntryBuilder.setMatchEntryValue(mplsTcCaseBuilder.build());
return matchEntryBuilder.build();
}
Aggregations