Search in sources :

Example 1 with SetFieldMatchKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchKey in project openflowplugin by opendaylight.

the class TableFeaturesMatchFieldDeserializer method deserialize.

/**
 * Deserialize match field if deserializer supports it, otherwise returns empty optional.
 *
 * @param message input buffer
 * @return set field match
 */
public Optional<SetFieldMatch> deserialize(ByteBuf message) {
    int oxmClass = message.getUnsignedShort(message.readerIndex());
    int oxmField = message.getUnsignedByte(message.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
    Long expId = null;
    if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
        expId = message.getUnsignedInt(message.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    }
    final MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, oxmClass, oxmField);
    key.setExperimenterId(expId);
    return Optional.ofNullable(codeToFieldMap.get(key)).map(clazz -> processHeader(message).setKey(new SetFieldMatchKey(clazz)).setMatchType(clazz).build());
}
Also used : MatchEntryDeserializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey) SetFieldMatchKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchKey)

Aggregations

MatchEntryDeserializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey)1 SetFieldMatchKey (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchKey)1