use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder 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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder 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