Search in sources :

Example 21 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 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 22 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 toTableProperties.

private static List<TableFeatureProperties> toTableProperties(final org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties tableProperties) {
    if (tableProperties == null) {
        return Collections.emptyList();
    }
    List<TableFeatureProperties> ofTablePropertiesList = new ArrayList<>();
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties> sortedTableProperties = TABLE_FEATURE_PROPS_ORDERING.sortedCopy(tableProperties.getTableFeatureProperties());
    for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties property : sortedTableProperties) {
        TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
        org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType propType = property.getTableFeaturePropType();
        setTableFeatureProperty(propType);
        if (propType instanceof Instructions) {
            setTableFeatureProperty((Instructions) propType, propBuilder);
        } else if (propType instanceof InstructionsMiss) {
            setTableFeatureProperty((InstructionsMiss) propType, propBuilder);
        } else if (propType instanceof NextTable) {
            setTableFeatureProperty((NextTable) propType, propBuilder);
        } else if (propType instanceof NextTableMiss) {
            setTableFeatureProperty((NextTableMiss) propType, propBuilder);
        } else if (propType instanceof WriteActions) {
            setTableFeatureProperty((WriteActions) propType, propBuilder);
        } else if (propType instanceof WriteActionsMiss) {
            setTableFeatureProperty((WriteActionsMiss) propType, propBuilder);
        } else if (propType instanceof ApplyActions) {
            setTableFeatureProperty((ApplyActions) propType, propBuilder);
        } else if (propType instanceof ApplyActionsMiss) {
            setTableFeatureProperty((ApplyActionsMiss) propType, propBuilder);
        } else if (propType instanceof Match) {
            setTableFeatureProperty((Match) propType, propBuilder);
        } else if (propType instanceof Wildcards) {
            setTableFeatureProperty((Wildcards) propType, propBuilder);
        } else if (propType instanceof WriteSetfield) {
            setTableFeatureProperty((WriteSetfield) propType, propBuilder);
        } else if (propType instanceof WriteSetfieldMiss) {
            setTableFeatureProperty((WriteSetfieldMiss) propType, propBuilder);
        } else if (propType instanceof ApplySetfield) {
            setTableFeatureProperty((ApplySetfield) propType, propBuilder);
        } else if (propType instanceof ApplySetfieldMiss) {
            setTableFeatureProperty((ApplySetfieldMiss) propType, propBuilder);
        }
        // Experimenter and Experimenter miss Table features are unhandled
        ofTablePropertiesList.add(propBuilder.build());
    }
    return ofTablePropertiesList;
}
Also used : TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) ArrayList(java.util.ArrayList) WriteSetfieldMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss) ApplyActionsMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match) ApplySetfieldMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder) WriteActions(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActions) WriteActionsMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss) TableFeaturePropType(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType) ApplyActions(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions) NextTable(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTable) InstructionsMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss) Instructions(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions) ApplySetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield) NextTableMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMiss) WriteSetfield(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield) Wildcards(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Wildcards)

Example 23 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 TableFeaturesResponseConvertor method toTableProperties.

private static TableProperties toTableProperties(final List<TableFeatureProperties> ofTablePropertiesList) {
    if (ofTablePropertiesList == null) {
        return new TablePropertiesBuilder().setTableFeatureProperties(Collections.emptyList()).build();
    }
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties> salTablePropertiesList = new ArrayList<>();
    TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
    int index = 0;
    for (TableFeatureProperties property : ofTablePropertiesList) {
        TableFeaturesPropType propType = property.getType();
        ActionExecutor actionExecutor = TABLE_FEATURE_PROPERTY_TYPE_TO_ACTION.get(propType);
        if (actionExecutor != null) {
            actionExecutor.execute(property, propBuilder);
        } else {
            LOG.error("Unsupported table feature property : " + propType);
        }
        propBuilder.setOrder(index);
        salTablePropertiesList.add(propBuilder.build());
        index += 1;
    }
    return new TablePropertiesBuilder().setTableFeatureProperties(salTablePropertiesList).build();
}
Also used : TableFeaturesPropType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties) ArrayList(java.util.ArrayList) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder) TablePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder)

Example 24 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 OpenflowpluginTableFeaturesTestCommandProvider method createApplySetFieldTblFeatureProp.

private TableFeaturePropertiesBuilder createApplySetFieldTblFeatureProp() {
    // t13
    SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder();
    setFieldMatchBld1.setHasMask(false);
    setFieldMatchBld1.setMatchType(ArpOp.class);
    SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder();
    setFieldMatchBld2.setHasMask(true);
    setFieldMatchBld2.setMatchType(InPort.class);
    SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder();
    setFieldMatchBld3.setHasMask(true);
    setFieldMatchBld3.setMatchType(Ipv4Dst.class);
    List<SetFieldMatch> setFieldMatch = new ArrayList<>();
    setFieldMatch.add(setFieldMatchBld1.build());
    setFieldMatch.add(setFieldMatchBld2.build());
    setFieldMatch.add(setFieldMatchBld3.build());
    ApplySetfieldBuilder applySetfieldBld = new ApplySetfieldBuilder();
    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder();
    applySetfieldBuilder.setSetFieldMatch(setFieldMatch);
    applySetfieldBld.setApplySetfield(applySetfieldBuilder.build());
    TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
    tableFeatureProperty.setTableFeaturePropType(applySetfieldBld.build());
    TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
    tableFeatureProperty.setKey(keyValue);
    tableFeatureProperty.setOrder(1);
    return tableFeatureProperty;
}
Also used : SetFieldMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder) ApplySetfieldBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder) ArrayList(java.util.ArrayList) TableFeaturePropertiesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey) SetFieldMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder)

Example 25 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 OpenflowpluginTableFeaturesTestCommandProvider method createWriteActionsMissTblFeatureProp.

private TableFeaturePropertiesBuilder createWriteActionsMissTblFeatureProp() {
    // t9
    List<Action> actionList = new ArrayList<>();
    ActionBuilder abt1 = new ActionBuilder();
    abt1.setAction(new CopyTtlInCaseBuilder().build());
    actionList.add(abt1.build());
    ActionBuilder abt2 = new ActionBuilder();
    abt2.setAction(new PushPbbActionCaseBuilder().build());
    actionList.add(abt2.build());
    TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
    tableFeatureProperty.setTableFeaturePropType(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.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(actionList).build()).build());
    TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0);
    tableFeatureProperty.setKey(keyValue);
    tableFeatureProperty.setOrder(1);
    return tableFeatureProperty;
}
Also used : Action(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) ArrayList(java.util.ArrayList) TableFeaturePropertiesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey) PushPbbActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder) CopyTtlInCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder)

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