Search in sources :

Example 6 with ExperimenterIdCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.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);
    }
}
Also used : ExperimenterIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) MatchEntrySerializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)

Example 7 with ExperimenterIdCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.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);
}
Also used : ExperimenterIdCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) SetFieldCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase) MatchEntrySerializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

ExperimenterIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase)5 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)3 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)2 TcpFlagsContainer (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainer)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 ActionSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey)1 ExperimenterActionSerializerKey (org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey)1 ExtensionConverterProvider (org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider)1 ActionPath (org.opendaylight.openflowplugin.extension.api.path.ActionPath)1 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)1 TcpFlagsMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder)1 TcpFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags)1 ExperimenterIdCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.action.container.action.choice.ExperimenterIdCase)1 SetFieldCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetFieldCase)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)1