Search in sources :

Example 6 with MatchField

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField in project openflowplugin by opendaylight.

the class AbstractOxmMatchEntryDeserializer method processHeader.

/**
 * Prepares match entry header - sets oxm_class, oxm_field, hasMask
 *  + sets the buffer.readerIndex() to the end of match entry
 *  - where augmentation starts.
 *
 * @param oxmClass oxm class type
 * @param oxmField oxm field type
 * @param input input bytebuf
 * @return MatchEntriesBuilder which can be filled with MatchEntry augmentation
 */
protected MatchEntryBuilder processHeader(Class<? extends OxmClassBase> oxmClass, Class<? extends MatchField> oxmField, ByteBuf input) {
    MatchEntryBuilder builder = new MatchEntryBuilder();
    builder.setOxmClass(oxmClass);
    // skip oxm_class (provided)
    input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    builder.setOxmMatchField(oxmField);
    boolean hasMask = (input.readUnsignedByte() & 1) != 0;
    builder.setHasMask(hasMask);
    // skip match entry length - not needed
    input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
    return builder;
}
Also used : MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)

Example 7 with MatchField

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField in project openflowplugin by opendaylight.

the class PacketReceivedTranslatorTest method prepareHeader.

private static MatchEntryBuilder prepareHeader(Class<? extends MatchField> oxmMatchField, boolean hasMask) {
    MatchEntryBuilder builder = new MatchEntryBuilder();
    builder.setOxmClass(OpenflowBasicClass.class);
    builder.setOxmMatchField(oxmMatchField);
    builder.setHasMask(hasMask);
    return builder;
}
Also used : MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)

Example 8 with MatchField

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField in project openflowplugin by opendaylight.

the class TableFeaturesConvertor method setSetFieldTableFeatureProperty.

private static void setSetFieldTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type, final List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFields) {
    List<MatchEntry> matchEntriesList = new ArrayList<>();
    for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch currMatch : setFields) {
        Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField> currMatchType = currMatch.getMatchType();
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField> ofTableFeatureClass = SAL_TO_OF_TABLE_FEATURES.get(currMatchType);
        setMatchEntry(matchEntryBuilder, ofTableFeatureClass, currMatch.isHasMask());
        matchEntriesList.add(matchEntryBuilder.build());
    }
    OxmRelatedTableFeaturePropertyBuilder propBuilder = new OxmRelatedTableFeaturePropertyBuilder();
    propBuilder.setMatchEntry(matchEntriesList);
    builder.setType(type);
    builder.addAugmentation(OxmRelatedTableFeatureProperty.class, propBuilder.build());
}
Also used : MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) ArrayList(java.util.ArrayList) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) OxmRelatedTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeaturePropertyBuilder)

Example 9 with MatchField

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField in project openflowplugin by opendaylight.

the class MatchExtensionHelper method processExtension.

/**
 * Processes an extension.
 *
 * @param ofVersion openflow version
 * @param matchPath match path
 * @param matchEntry match entry
 * @return an ExtensionListBuilder
 */
private static ExtensionListBuilder processExtension(MatchEntry matchEntry, short ofVersion, MatchPath matchPath) {
    ExtensionListBuilder extListBld = null;
    // TODO: EXTENSION PROPOSAL (match, OFJava to MD-SAL)
    MatchEntrySerializerKey<? extends OxmClassBase, ? extends MatchField> key = new MatchEntrySerializerKey<>(ofVersion, matchEntry.getOxmClass(), matchEntry.getOxmMatchField());
    if (null != OFSessionUtil.getExtensionConvertorProvider()) {
        ConvertorFromOFJava<MatchEntry, MatchPath> convertor = OFSessionUtil.getExtensionConvertorProvider().getConverter(key);
        if (convertor != null) {
            ExtensionAugment<? extends Augmentation<Extension>> extensionMatch = convertor.convert(matchEntry, matchPath);
            ExtensionBuilder extBld = new ExtensionBuilder();
            extBld.addAugmentation(extensionMatch.getAugmentationClass(), extensionMatch.getAugmentationObject());
            extListBld = new ExtensionListBuilder();
            extListBld.setExtension(extBld.build());
            extListBld.setExtensionKey(extensionMatch.getKey());
        }
    }
    return extListBld;
}
Also used : Extension(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension) ExtensionListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionListBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) MatchPath(org.opendaylight.openflowplugin.extension.api.path.MatchPath) ExtensionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.ExtensionBuilder) MatchEntrySerializerKey(org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)

Aggregations

MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)4 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)4 ArrayList (java.util.ArrayList)2 TunnelIpv4Dst (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Dst)2 TunnelIpv4Src (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Src)2 SetFieldMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch)2 Consumer (java.util.function.Consumer)1 MatchEntrySerializerKey (org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey)1 MatchPath (org.opendaylight.openflowplugin.extension.api.path.MatchPath)1 ArpOpMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpOpMatchFieldSerializer)1 ArpShaMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpShaMatchFieldSerializer)1 ArpSpaMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpSpaMatchFieldSerializer)1 ArpThaMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpThaMatchFieldSerializer)1 ArpTpaMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpTpaMatchFieldSerializer)1 EthDstMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthDstMatchFieldSerializer)1 EthSrcMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthSrcMatchFieldSerializer)1 EthTypeMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthTypeMatchFieldSerializer)1 Icmpv4CodeMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv4CodeMatchFieldSerializer)1 Icmpv4TypeMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv4TypeMatchFieldSerializer)1 Icmpv6CodeMatchFieldSerializer (org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv6CodeMatchFieldSerializer)1