use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method createTcpFlags.
private static List<TcpFlags> createTcpFlags(final UnkeyedListNode tcpFlagsData) {
final List<TcpFlags> tcpFlags = new ArrayList<>();
for (final UnkeyedListEntryNode node : tcpFlagsData.getValue()) {
final TcpFlagsBuilder tcpFlagsBuilder = new TcpFlagsBuilder();
final Optional<DataContainerChild<? extends PathArgument, ?>> opValue = node.getChild(OP_NID);
if (opValue.isPresent()) {
tcpFlagsBuilder.setOp(BitmaskOperandParser.INSTANCE.create((Set<String>) opValue.get().getValue()));
}
final Optional<DataContainerChild<? extends PathArgument, ?>> valueNode = node.getChild(VALUE_NID);
if (valueNode.isPresent()) {
tcpFlagsBuilder.setValue((Integer) valueNode.get().getValue());
}
tcpFlags.add(tcpFlagsBuilder.build());
}
return tcpFlags;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags in project openflowplugin by opendaylight.
the class OnfOxmTcpFlagsSerializer method serialize.
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
ExperimenterIdCase expCase = serializeExperimenterId(entry, outBuffer);
TcpFlags tcpFlags = expCase.getAugmentation(TcpFlagsContainer.class).getTcpFlags();
outBuffer.writeShort(tcpFlags.getFlags());
if (entry.isHasMask()) {
outBuffer.writeBytes(tcpFlags.getMask());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags in project openflowplugin by opendaylight.
the class TcpFlagsEntryDeserializerTest method deserializeEntry.
@Test
public void deserializeEntry() throws Exception {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final int tcpFlags = 6;
final int tcpFlagsMask = 5;
writeHeader(in, false);
in.writeInt((int) EncodeConstants.ONF_EXPERIMENTER_ID);
in.writeShort(tcpFlags);
TcpFlagsMatch match = deserialize(in).getTcpFlagsMatch();
assertEquals(tcpFlags, match.getTcpFlags().intValue());
assertEquals(0, in.readableBytes());
writeHeader(in, true);
in.writeInt((int) EncodeConstants.ONF_EXPERIMENTER_ID);
in.writeShort(tcpFlags);
in.writeShort(tcpFlagsMask);
match = deserialize(in).getTcpFlagsMatch();
assertEquals(tcpFlags, match.getTcpFlags().intValue());
assertEquals(tcpFlagsMask, match.getTcpFlagsMask().intValue());
assertEquals(0, in.readableBytes());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags in project openflowplugin by opendaylight.
the class OfToSalExperimenterIdCase method process.
@Override
public Optional<MatchBuilder> process(@Nonnull ExperimenterIdCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
final MatchBuilder matchBuilder = data.getMatchBuilder();
if (data.getOxmMatchField().equals(TcpFlags.class)) {
final TcpFlagsMatchBuilder tcpFlagsMatchBuilder = data.getTcpFlagsMatchBuilder();
final TcpFlagsContainer tcpFlagsContainer = source.getAugmentation(TcpFlagsContainer.class);
if (tcpFlagsContainer != null) {
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags tcpFlags = tcpFlagsContainer.getTcpFlags();
tcpFlagsMatchBuilder.setTcpFlags(tcpFlags.getFlags());
byte[] mask = tcpFlags.getMask();
if (mask != null) {
tcpFlagsMatchBuilder.setTcpFlagsMask(ByteUtil.bytesToUnsignedShort(mask));
}
matchBuilder.setTcpFlagsMatch(tcpFlagsMatchBuilder.build());
}
}
return Optional.of(matchBuilder);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method stringTcpFlags.
private static String stringTcpFlags(final List<TcpFlags> flags) {
final StringBuilder buffer = new StringBuilder("where TCP flags ");
boolean isFirst = true;
for (final TcpFlags item : flags) {
buffer.append(BitmaskOperandParser.INSTANCE.toString(item.getOp(), isFirst));
buffer.append(item.getValue());
buffer.append(' ');
if (isFirst) {
isFirst = false;
}
}
return buffer.toString();
}
Aggregations