Search in sources :

Example 1 with ApplyActionsMiss

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss in project openflowplugin by opendaylight.

the class OpenflowpluginTableFeaturesTestCommandProvider method createApplyActionsMissTblFeatureProp.

private TableFeaturePropertiesBuilder createApplyActionsMissTblFeatureProp() {
    TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder();
    // To set the ApplyActionsMiss
    List<Action> actionList = new ArrayList<>();
    ActionBuilder ab = new ActionBuilder();
    ab.setAction(new PopMplsActionCaseBuilder().build());
    actionList.add(ab.build());
    tableFeatureProperty.setTableFeaturePropType(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder().setApplyActionsMiss(new ApplyActionsMissBuilder().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) ApplyActionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder) ArrayList(java.util.ArrayList) TableFeaturePropertiesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey) PopMplsActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder) TableFeaturePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder)

Example 2 with ApplyActionsMiss

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss in project openflowplugin by opendaylight.

the class TableFeaturesConvertorTest method testToTableFeaturesRequest.

@Test
public void testToTableFeaturesRequest() throws Exception {
    List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures> tableFeaturesList = new ArrayList<>();
    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder tableFeaturesBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder();
    for (int i = 0; i < 10; i++) {
        tableFeaturesBuilder.setTableId((short) i);
        tableFeaturesBuilder.setName(String.format("table:%d", i));
        tableFeaturesBuilder.setMetadataMatch(BigInteger.ONE);
        tableFeaturesBuilder.setMetadataWrite(BigInteger.ONE);
        tableFeaturesBuilder.setMaxEntries((long) 1 + 10 * i);
        tableFeaturesBuilder.setConfig(new TableConfig(false));
        tableFeaturesBuilder.setTableProperties(getTableProperties());
        tableFeaturesList.add(tableFeaturesBuilder.build());
    }
    TableFeatures tableFeatures = new UpdatedTableBuilder().setTableFeatures(tableFeaturesList).build();
    final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
    Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures>> tableFeaturesesOptional = convertorManager.convert(tableFeatures, new VersionConvertorData(OFConstants.OFP_VERSION_1_3));
    assertNotNull(tableFeatures);
    assertEquals(10, tableFeatures.getTableFeatures().size());
    List<TableFeatureProperties> tableFeaturePropertieses = tableFeatures.getTableFeatures().get(0).getTableProperties().getTableFeatureProperties();
    assertEquals(AUGMENTATIONS_MAP.size() + 1, tableFeaturePropertieses.size());
    org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss applyActionsMiss = null;
    for (int i = 0; i < tableFeaturePropertieses.size(); i++) {
        if (tableFeaturePropertieses.get(i).getTableFeaturePropType().getImplementedInterface().isAssignableFrom(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss.class)) {
            applyActionsMiss = (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss) tableFeaturePropertieses.get(i).getTableFeaturePropType();
            break;
        }
    }
    assertNotNull(applyActionsMiss);
    assertEquals(ACTIONS.size(), applyActionsMiss.getApplyActionsMiss().getAction().size());
}
Also used : ArrayList(java.util.ArrayList) TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties) UpdatedTableBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder) ApplyActionsMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss) TableFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig) List(java.util.List) ArrayList(java.util.ArrayList) VersionConvertorData(org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData) Test(org.junit.Test)

Example 3 with ApplyActionsMiss

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss 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 4 with ApplyActionsMiss

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss in project openflowplugin by opendaylight.

the class ApplyActionsMissTablePropertySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final ApplyActionsMiss property = 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(Collections.singletonList(new ActionBuilder().setOrder(0).setAction(new SetNwSrcActionCaseBuilder().build()).build())).build()).build();
    assertProperty(property, out -> {
        assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
        // Skip length of set field action
        out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
    });
}
Also used : SetNwSrcActionCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder) ActionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder) ApplyActionsMissBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder) ApplyActionsMiss(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss) Test(org.junit.Test)

Example 5 with ApplyActionsMiss

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss in project openflowplugin by opendaylight.

the class OpenflowpluginTableFeaturesTestCommandProvider method createTestTableFeatures.

private TableFeaturesBuilder createTestTableFeatures(String tableFeatureTypeArg) {
    String tableFeatureType = tableFeatureTypeArg;
    if (tableFeatureType == null) {
        tableFeatureType = "t1";
    }
    final TableFeaturesBuilder tableFeature = new TableFeaturesBuilder();
    // Sample data , committing to DataStore
    if (!tableFeatureType.equals("t1")) {
        tableFeature.setTableId((short) 0);
        tableFeature.setName("Table 0");
        tableFeature.setMetadataMatch(BigInteger.valueOf(10));
        tableFeature.setMetadataWrite(BigInteger.valueOf(10));
        tableFeature.setMaxEntries(10000L);
        tableFeature.setConfig(new TableConfig(false));
        List<TableFeatureProperties> properties = new ArrayList<>();
        switch(tableFeatureType) {
            case "t2":
                // To set the ApplyActionsMiss
                properties.add(createApplyActionsMissTblFeatureProp().build());
                break;
            case "t3":
                // To set the Next Table
                properties.add(createNextTblFeatureProp().build());
                break;
            case "t4":
                // To set the Next Table Miss
                properties.add(createNextTableMissTblFeatureProp().build());
                break;
            case "t5":
                // To set the ApplyActions
                properties.add(createApplyActionsTblFeatureProp().build());
                break;
            case "t6":
                // To set the instructions
                properties.add(createInstructionsTblFeatureProp().build());
                break;
            case "t7":
                // To set the instructions miss
                properties.add(createInstructionsMissTblFeatureProp().build());
                break;
            case "t8":
                // To set the write actions
                properties.add(createWriteActionsTblFeatureProp().build());
                break;
            case "t9":
                // To set the write actions miss
                properties.add(createWriteActionsMissTblFeatureProp().build());
                break;
            case "t10":
                // To set the match field
                properties.add(createMatchFieldTblFeatureProp().build());
                break;
            case "t11":
                // To set the write set-field
                properties.add(createWriteSetFieldTblFeatureProp().build());
                break;
            case "t12":
                // To set the write set-field miss
                properties.add(createWriteSetFieldMissTblFeatureProp().build());
                break;
            case "t13":
                // To set the apply set field
                properties.add(createApplySetFieldTblFeatureProp().build());
                break;
            case "t14":
                // To set the apply set field miss
                properties.add(createApplySetFieldMissTblFeatureProp().build());
                break;
            case "t15":
                // To set the wildcards set field match
                properties.add(createWildCardsTblFeatureProp().build());
                break;
            default:
                break;
        }
        TablePropertiesBuilder propertyBld = new TablePropertiesBuilder();
        propertyBld.setTableFeatureProperties(properties);
        tableFeature.setTableProperties(propertyBld.build());
    }
    return tableFeature;
}
Also used : TableFeatureProperties(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties) ArrayList(java.util.ArrayList) TableFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder) TableConfig(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig) TablePropertiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder)

Aggregations

ArrayList (java.util.ArrayList)4 ApplyActionsMiss (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss)3 Test (org.junit.Test)2 ActionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder)2 TableConfig (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig)2 TableFeatureProperties (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties)2 List (java.util.List)1 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)1 PopMplsActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder)1 SetNwSrcActionCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder)1 Action (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action)1 TableFeatureProperties (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties)1 TableFeaturePropertiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder)1 UpdatedTableBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder)1 TableFeatures (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableFeatures)1 TableFeaturePropType (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType)1 ApplyActions (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions)1 ApplyActionsMissBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder)1 ApplySetfield (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield)1 ApplySetfieldMiss (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss)1