Search in sources :

Example 6 with TableFeaturePropertiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder in project openflowplugin by opendaylight.

the class MultipartReplyTableFeaturesDeserializer method readTableProperties.

private TableProperties readTableProperties(ByteBuf message, int length) {
    final List<TableFeatureProperties> items = new ArrayList<>();
    int tableFeaturesLength = length;
    int order = 0;
    while (tableFeaturesLength > 0) {
        final int propStartIndex = message.readerIndex();
        final TableFeaturesPropType propType = TableFeaturesPropType.forValue(message.readUnsignedShort());
        int propertyLength = message.readUnsignedShort();
        final int paddingRemainder = propertyLength % EncodeConstants.PADDING;
        tableFeaturesLength -= propertyLength;
        final int commonPropertyLength = propertyLength - COMMON_PROPERTY_LENGTH;
        final TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder().setOrder(order).setKey(new TableFeaturePropertiesKey(order));
        switch(propType) {
            case OFPTFPTINSTRUCTIONS:
                propBuilder.setTableFeaturePropType(new InstructionsBuilder().setInstructions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(readInstructions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTINSTRUCTIONSMISS:
                propBuilder.setTableFeaturePropType(new InstructionsMissBuilder().setInstructionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.miss.InstructionsMissBuilder().setInstruction(readInstructions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTNEXTTABLES:
                propBuilder.setTableFeaturePropType(new NextTableBuilder().setTables(new TablesBuilder().setTableIds(readNextTableIds(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTNEXTTABLESMISS:
                propBuilder.setTableFeaturePropType(new NextTableMissBuilder().setTablesMiss(new TablesMissBuilder().setTableIds(readNextTableIds(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITEACTIONS:
                propBuilder.setTableFeaturePropType(new WriteActionsBuilder().setWriteActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.WriteActionsBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITEACTIONSMISS:
                propBuilder.setTableFeaturePropType(new WriteActionsMissBuilder().setWriteActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.actions.miss.WriteActionsMissBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYACTIONS:
                propBuilder.setTableFeaturePropType(new ApplyActionsBuilder().setApplyActions(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYACTIONSMISS:
                propBuilder.setTableFeaturePropType(new ApplyActionsMissBuilder().setApplyActionsMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder().setAction(readActions(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTMATCH:
                propBuilder.setTableFeaturePropType(new MatchBuilder().setMatchSetfield(new MatchSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWILDCARDS:
                propBuilder.setTableFeaturePropType(new WildcardsBuilder().setWildcardSetfield(new WildcardSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITESETFIELD:
                propBuilder.setTableFeaturePropType(new WriteSetfieldBuilder().setWriteSetfield(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTWRITESETFIELDMISS:
                propBuilder.setTableFeaturePropType(new WriteSetfieldMissBuilder().setWriteSetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYSETFIELD:
                propBuilder.setTableFeaturePropType(new ApplySetfieldBuilder().setApplySetfield(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTAPPLYSETFIELDMISS:
                propBuilder.setTableFeaturePropType(new ApplySetfieldMissBuilder().setApplySetfieldMiss(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder().setSetFieldMatch(readMatchFields(message, commonPropertyLength)).build()).build());
                break;
            case OFPTFPTEXPERIMENTER:
            case OFPTFPTEXPERIMENTERMISS:
                final long expId = message.readUnsignedInt();
                message.readerIndex(propStartIndex);
                final OFDeserializer<TableFeatureProperties> propDeserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId));
                // TODO: Finish experimenter table features (currently using OFJava deserialization only to skip
                // bytes)
                propDeserializer.deserialize(message);
                LOG.debug("Table feature property type {} is not handled yet.", propType);
                break;
            default:
        }
        if (paddingRemainder != 0) {
            message.skipBytes(EncodeConstants.PADDING - paddingRemainder);
            tableFeaturesLength -= EncodeConstants.PADDING - paddingRemainder;
        }
        items.add(propBuilder.build());
        order++;
    }
    return new TablePropertiesBuilder().setTableFeatureProperties(items).build();
}
Also used : ApplyActionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder) ApplySetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties) ArrayList(java.util.ArrayList) TableFeaturePropertiesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey) InstructionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder) MatchSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder) WildcardsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WildcardsBuilder) ApplyActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder) WriteActionsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder) ApplySetfieldMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder) TablesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.TablesBuilder) WriteSetfieldMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder) NextTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder) TableFeaturesPropType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType) TablesMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesMissBuilder) WildcardSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfieldBuilder) InstructionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder) NextTableMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMissBuilder) WriteActionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder) WriteSetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder) TablePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder)

Example 7 with TableFeaturePropertiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder in project openflowplugin by opendaylight.

the class TableFeaturesConvertor method setTableFeatureProperty.

private static void setTableFeatureProperty(final Match propType, final TableFeaturePropertiesBuilder propBuilder) {
    MatchSetfield matchSetField = propType.getMatchSetfield();
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
    if (null != matchSetField) {
        setFieldMatch = matchSetField.getSetFieldMatch();
    }
    setSetFieldTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTMATCH, setFieldMatch == null ? new ArrayList<>() : setFieldMatch);
}
Also used : MatchSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfield) WriteSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield) ApplySetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield) WildcardSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfield) MatchSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfield) ArrayList(java.util.ArrayList)

Example 8 with TableFeaturePropertiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder in project openflowplugin by opendaylight.

the class TableFeaturesConvertor method setNextTableFeatureProperty.

private static void setNextTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type, final List<Short> tableIds) {
    List<NextTableIds> nextTableIdsList = new ArrayList<>();
    for (Short tableId : tableIds) {
        NextTableIdsBuilder nextTableId = new NextTableIdsBuilder();
        nextTableId.setTableId(tableId);
        nextTableIdsList.add(nextTableId.build());
    }
    NextTableRelatedTableFeaturePropertyBuilder propBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
    propBuilder.setNextTableIds(nextTableIdsList);
    builder.setType(type);
    builder.addAugmentation(NextTableRelatedTableFeatureProperty.class, propBuilder.build());
}
Also used : NextTableIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIdsBuilder) NextTableIds(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds) ArrayList(java.util.ArrayList) NextTableRelatedTableFeaturePropertyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder)

Example 9 with TableFeaturePropertiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder in project openflowplugin by opendaylight.

the class TableFeaturesConvertor method setTableFeatureProperty.

private static void setTableFeatureProperty(final Wildcards propType, final TableFeaturePropertiesBuilder propBuilder) {
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFieldMatch = null;
    WildcardSetfield wildcardSetField = propType.getWildcardSetfield();
    if (null != wildcardSetField) {
        setFieldMatch = wildcardSetField.getSetFieldMatch();
    }
    setSetFieldTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTWILDCARDS, setFieldMatch == null ? new ArrayList<>() : setFieldMatch);
}
Also used : WildcardSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfield) MatchSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfield) WriteSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield) ApplySetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield) WildcardSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfield) ArrayList(java.util.ArrayList)

Example 10 with TableFeaturePropertiesBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder in project openflowplugin by opendaylight.

the class TableFeaturesConvertor method setTableFeatureProperty.

private static void setTableFeatureProperty(final NextTableMiss propType, final TableFeaturePropertiesBuilder propBuilder) {
    TablesMiss tables = propType.getTablesMiss();
    setNextTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTNEXTTABLESMISS, tables == null ? new ArrayList<>() : tables.getTableIds());
}
Also used : ArrayList(java.util.ArrayList) TablesMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesMiss)

Aggregations

ArrayList (java.util.ArrayList)30 TableFeaturePropertiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder)17 TableFeaturePropertiesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey)15 TableFeatureProperties (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties)9 TableFeaturePropertiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder)8 ActionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeaturePropertyBuilder)7 InstructionRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeaturePropertyBuilder)7 NextTableRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeaturePropertyBuilder)7 OxmRelatedTableFeaturePropertyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeaturePropertyBuilder)7 SetFieldMatch (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch)7 NextTableIdsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIdsBuilder)6 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action)6 Instruction (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction)5 Test (org.junit.Test)4 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)4 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)4 NextTableIds (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds)4 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder)4 ApplyActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCaseBuilder)4 ClearActionsCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder)4