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;
}
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());
}
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;
}
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);
});
}
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;
}
Aggregations