use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder in project openflowplugin by opendaylight.
the class Icmpv4TypeEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final short type = message.readUnsignedByte();
if (Objects.isNull(builder.getIcmpv4Match())) {
builder.setIcmpv4Match(new Icmpv4MatchBuilder().setIcmpv4Type(type).build());
} else if (Objects.isNull(builder.getIcmpv4Match().getIcmpv4Type())) {
builder.setIcmpv4Match(new Icmpv4MatchBuilder(builder.getIcmpv4Match()).setIcmpv4Type(type).build());
} else {
throwErrorOnMalformed(builder, "icmpv4Match", "icmpv4Type");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder in project openflowplugin by opendaylight.
the class Icmpv4CodeEntryDeserializer method deserializeEntry.
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
processHeader(message);
final short code = message.readUnsignedByte();
if (Objects.isNull(builder.getIcmpv4Match())) {
builder.setIcmpv4Match(new Icmpv4MatchBuilder().setIcmpv4Code(code).build());
} else if (Objects.isNull(builder.getIcmpv4Match().getIcmpv4Code())) {
builder.setIcmpv4Match(new Icmpv4MatchBuilder(builder.getIcmpv4Match()).setIcmpv4Code(code).build());
} else {
throwErrorOnMalformed(builder, "icmpv4Match", "icmpv4Code");
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder in project openflowplugin by opendaylight.
the class Icmpv4CodeEntrySerializerTest method testSerialize.
@Test
public void testSerialize() throws Exception {
final short code = 200;
final Match match = new MatchBuilder().setIcmpv4Match(new Icmpv4MatchBuilder().setIcmpv4Code(code).build()).build();
assertMatch(match, false, (out) -> assertEquals(out.readUnsignedByte(), code));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder in project openflowplugin by opendaylight.
the class OfToSalIcmpv4TypeCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull Icmpv4TypeCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
final Icmpv4MatchBuilder icmpv4MatchBuilder = data.getIcmpv4MatchBuilder();
Icmpv4Type icmpv4Type = source.getIcmpv4Type();
Short type = icmpv4Type.getIcmpv4Type();
if (type != null) {
icmpv4MatchBuilder.setIcmpv4Type(type);
matchBuilder.setIcmpv4Match(icmpv4MatchBuilder.build());
}
return Optional.of(matchBuilder);
}
Aggregations