use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType 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.openflow.common.types.rev130731.TableFeaturesPropType 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType in project openflowplugin by opendaylight.
the class TableFeaturesConvertor method setActionTableFeatureProperty.
private static void setActionTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type, final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> salActions) {
List<Action> actionList = new ArrayList<>();
for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action currAction : salActions) {
org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action actionType = currAction.getAction();
ActionBuilder actionBuilder = new ActionBuilder();
if (actionType instanceof OutputActionCase) {
OutputActionCaseBuilder outputActionCaseBuilder = new OutputActionCaseBuilder();
actionBuilder.setActionChoice(outputActionCaseBuilder.build());
} else if (actionType instanceof GroupActionCase) {
GroupCaseBuilder groupActionBuilder = new GroupCaseBuilder();
actionBuilder.setActionChoice(groupActionBuilder.build());
} else if (actionType instanceof CopyTtlOutCase) {
CopyTtlOutCaseBuilder copyTtlOutCaseBuilder = new CopyTtlOutCaseBuilder();
actionBuilder.setActionChoice(copyTtlOutCaseBuilder.build());
} else if (actionType instanceof CopyTtlInCase) {
CopyTtlInCaseBuilder copyTtlInCaseBuilder = new CopyTtlInCaseBuilder();
actionBuilder.setActionChoice(copyTtlInCaseBuilder.build());
} else if (actionType instanceof SetMplsTtlActionCase) {
SetMplsTtlCaseBuilder setMplsTtlActionBuilder = new SetMplsTtlCaseBuilder();
actionBuilder.setActionChoice(setMplsTtlActionBuilder.build());
} else if (actionType instanceof DecMplsTtlCase) {
DecMplsTtlCaseBuilder decMplsTtlCaseBuilder = new DecMplsTtlCaseBuilder();
actionBuilder.setActionChoice(decMplsTtlCaseBuilder.build());
} else if (actionType instanceof PushVlanActionCase) {
PushVlanCaseBuilder pushVlanActionBuilder = new PushVlanCaseBuilder();
actionBuilder.setActionChoice(pushVlanActionBuilder.build());
} else if (actionType instanceof PopVlanActionCase) {
PopVlanCaseBuilder popVlanCaseBuilder = new PopVlanCaseBuilder();
actionBuilder.setActionChoice(popVlanCaseBuilder.build());
} else if (actionType instanceof PushMplsActionCase) {
PushMplsCaseBuilder pushMplsActionBuilder = new PushMplsCaseBuilder();
actionBuilder.setActionChoice(pushMplsActionBuilder.build());
} else if (actionType instanceof PopMplsActionCase) {
PopMplsCaseBuilder popMplsCaseBuilder = new PopMplsCaseBuilder();
actionBuilder.setActionChoice(popMplsCaseBuilder.build());
} else if (actionType instanceof SetQueueActionCase) {
SetQueueCaseBuilder setQueueActionBuilder = new SetQueueCaseBuilder();
actionBuilder.setActionChoice(setQueueActionBuilder.build());
} else if (actionType instanceof SetNwTtlActionCase) {
SetNwTtlCaseBuilder setNwTtlActionBuilder = new SetNwTtlCaseBuilder();
actionBuilder.setActionChoice(setNwTtlActionBuilder.build());
} else if (actionType instanceof DecNwTtlCase) {
DecNwTtlCaseBuilder decNwTtlCaseBuilder = new DecNwTtlCaseBuilder();
actionBuilder.setActionChoice(decNwTtlCaseBuilder.build());
} else if (actionType instanceof SetFieldCase) {
SetFieldCaseBuilder setFieldCaseBuilder = new SetFieldCaseBuilder();
actionBuilder.setActionChoice(setFieldCaseBuilder.build());
} else if (actionType instanceof PushPbbActionCase) {
PushPbbCaseBuilder pushPbbCaseBuilder = new PushPbbCaseBuilder();
actionBuilder.setActionChoice(pushPbbCaseBuilder.build());
} else if (actionType instanceof PopPbbActionCase) {
PopPbbCaseBuilder popPbbCaseBuilder = new PopPbbCaseBuilder();
actionBuilder.setActionChoice(popPbbCaseBuilder.build());
}
// Experimenter action is unhandled
actionList.add(actionBuilder.build());
}
ActionRelatedTableFeaturePropertyBuilder propBuilder = new ActionRelatedTableFeaturePropertyBuilder();
propBuilder.setAction(actionList);
builder.setType(type);
builder.addAugmentation(ActionRelatedTableFeatureProperty.class, propBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType in project openflowplugin by opendaylight.
the class TableFeaturesConvertor method setInstructionTableFeatureProperty.
private static void setInstructionTableFeatureProperty(final TableFeaturePropertiesBuilder builder, final TableFeaturesPropType type, final List<Instruction> instructionList) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction> instructionTypeList = new ArrayList<>();
for (Instruction currInstruction : instructionList) {
InstructionBuilder instructionType = new InstructionBuilder();
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction instruction = currInstruction.getInstruction();
if (instruction instanceof GoToTableCase) {
GotoTableCaseBuilder goToTableCaseBuilder = new GotoTableCaseBuilder();
instructionType.setInstructionChoice(goToTableCaseBuilder.build());
} else if (instruction instanceof WriteMetadataCase) {
WriteMetadataCaseBuilder writeMetadataCaseBuilder = new WriteMetadataCaseBuilder();
instructionType.setInstructionChoice(writeMetadataCaseBuilder.build());
} else if (instruction instanceof WriteActionsCase) {
WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
instructionType.setInstructionChoice(writeActionsCaseBuilder.build());
} else if (instruction instanceof ApplyActionsCase) {
ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
instructionType.setInstructionChoice(applyActionsCaseBuilder.build());
} else if (instruction instanceof ClearActionsCase) {
ClearActionsCaseBuilder clearActionsCaseBuilder = new ClearActionsCaseBuilder();
instructionType.setInstructionChoice(clearActionsCaseBuilder.build());
} else if (instruction instanceof MeterCase) {
MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
instructionType.setInstructionChoice(meterCaseBuilder.build());
}
// TODO: Experimenter instructions are unhandled
instructionTypeList.add(instructionType.build());
}
InstructionRelatedTableFeaturePropertyBuilder propBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
propBuilder.setInstruction(instructionTypeList);
builder.setType(type);
builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, propBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType in project openflowplugin by opendaylight.
the class MultipartRequestInputMessageFactory method createTableFeaturesProperties.
private List<TableFeatureProperties> createTableFeaturesProperties(ByteBuf input, int length) {
List<TableFeatureProperties> properties = new ArrayList<>();
int tableFeaturesLength = length;
while (tableFeaturesLength > 0) {
int propStartIndex = input.readerIndex();
TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();
TableFeaturesPropType type = TableFeaturesPropType.forValue(input.readUnsignedShort());
builder.setType(type);
int propertyLength = input.readUnsignedShort();
int paddingRemainder = propertyLength % EncodeConstants.PADDING;
tableFeaturesLength -= propertyLength;
if (type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONS) || type.equals(TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS)) {
InstructionRelatedTableFeaturePropertyBuilder insBuilder = new InstructionRelatedTableFeaturePropertyBuilder();
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<Instruction> instructions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry);
insBuilder.setInstruction(instructions);
builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLES) || type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLESMISS)) {
propertyLength -= COMMON_PROPERTY_LENGTH;
NextTableRelatedTableFeaturePropertyBuilder tableBuilder = new NextTableRelatedTableFeaturePropertyBuilder();
List<NextTableIds> ids = new ArrayList<>();
while (propertyLength > 0) {
NextTableIdsBuilder nextTableIdsBuilder = new NextTableIdsBuilder();
nextTableIdsBuilder.setTableId(input.readUnsignedByte());
ids.add(nextTableIdsBuilder.build());
propertyLength--;
}
tableBuilder.setNextTableIds(ids);
builder.addAugmentation(NextTableRelatedTableFeatureProperty.class, tableBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONS) || type.equals(TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONS) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS)) {
ActionRelatedTableFeaturePropertyBuilder actionBuilder = new ActionRelatedTableFeaturePropertyBuilder();
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<Action> actions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry);
actionBuilder.setAction(actions);
builder.addAugmentation(ActionRelatedTableFeatureProperty.class, actionBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTMATCH) || type.equals(TableFeaturesPropType.OFPTFPTWILDCARDS) || type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELD) || type.equals(TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELD) || type.equals(TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS)) {
OxmRelatedTableFeaturePropertyBuilder oxmBuilder = new OxmRelatedTableFeaturePropertyBuilder();
CodeKeyMaker keyMaker = CodeKeyMakerFactory.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<MatchEntry> entries = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry);
oxmBuilder.setMatchEntry(entries);
builder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build());
} else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER) || type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS)) {
long expId = input.readUnsignedInt();
input.readerIndex(propStartIndex);
OFDeserializer<TableFeatureProperties> propDeserializer = registry.getDeserializer(ExperimenterDeserializerKeyFactory.createMultipartReplyTFDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId));
TableFeatureProperties expProp = propDeserializer.deserialize(input);
properties.add(expProp);
continue;
}
if (paddingRemainder != 0) {
input.skipBytes(EncodeConstants.PADDING - paddingRemainder);
tableFeaturesLength -= EncodeConstants.PADDING - paddingRemainder;
}
properties.add(builder.build());
}
return properties;
}
Aggregations