use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase in project openflowplugin by opendaylight.
the class OF13MatchSerializer method serializeMatchEntries.
/**
* Serializes MatchEntries.
*
* @param matchEntries list of match entries (oxm_fields)
* @param out output ByteBuf
*/
public void serializeMatchEntries(List<MatchEntry> matchEntries, ByteBuf out) {
if (matchEntries == null) {
LOG.debug("Match entries are null");
return;
}
for (MatchEntry entry : matchEntries) {
MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, entry.getOxmClass(), entry.getOxmMatchField());
if (entry.getOxmClass().equals(ExperimenterClass.class)) {
ExperimenterIdCase entryValue = (ExperimenterIdCase) entry.getMatchEntryValue();
key.setExperimenterId(entryValue.getExperimenter().getExperimenter().getValue());
} else {
key.setExperimenterId(null);
}
OFSerializer<MatchEntry> entrySerializer = registry.getSerializer(key);
entrySerializer.serialize(entry, out);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase in project openflowplugin by opendaylight.
the class OF13SetFieldActionSerializer method serialize.
@Override
// FB doesn't recognize Objects.requireNonNull
@SuppressFBWarnings("UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR")
public void serialize(Action action, ByteBuf outBuffer) {
Objects.requireNonNull(registry);
final int startIndex = outBuffer.writerIndex();
outBuffer.writeShort(ActionConstants.SET_FIELD_CODE);
final int lengthIndex = outBuffer.writerIndex();
outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
MatchEntry entry = ((SetFieldCase) action.getActionChoice()).getSetFieldAction().getMatchEntry().get(0);
MatchEntrySerializerKey<?, ?> key = new MatchEntrySerializerKey<>(EncodeConstants.OF13_VERSION_ID, entry.getOxmClass(), entry.getOxmMatchField());
if (entry.getOxmClass().equals(ExperimenterClass.class)) {
ExperimenterIdCase experimenterIdCase = (ExperimenterIdCase) entry.getMatchEntryValue();
key.setExperimenterId(experimenterIdCase.getExperimenter().getExperimenter().getValue());
} else {
key.setExperimenterId(null);
}
OFSerializer<MatchEntry> serializer = registry.getSerializer(key);
serializer.serialize(entry, outBuffer);
int paddingRemainder = (outBuffer.writerIndex() - startIndex) % EncodeConstants.PADDING;
if (paddingRemainder != 0) {
outBuffer.writeZero(EncodeConstants.PADDING - paddingRemainder);
}
outBuffer.setShort(lengthIndex, outBuffer.writerIndex() - startIndex);
}
Aggregations