ofTableFeatures.setName(salTableFeatures.getName());
ofTableFeatures.setMetadataMatch(salTableFeatures.getMetadataMatch());
ofTableFeatures.setMetadataWrite(salTableFeatures.getMetadataWrite());
+ ofTableFeatures.setMaxEntries(new Long(0));
if (salTableFeatures.getConfig() != null) {
ofTableFeatures.setConfig(new TableConfig(salTableFeatures.getConfig().isDEPRECATEDMASK()));
}
return Collections.<TableFeatureProperties> emptyList();
}
List<TableFeatureProperties> ofTablePropertiesList = new ArrayList<>();
- TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
-
+
for (org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties property : tableProperties
.getTableFeatureProperties()) {
+ TableFeaturePropertiesBuilder propBuilder = new TableFeaturePropertiesBuilder();
+
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType propType = property
.getTableFeaturePropType();
+
if (propType instanceof Instructions) {
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions instructions = ((Instructions) propType)
.getInstructions();
.getSetFieldMatch();
setSetFieldTableFeatureProperty(
propBuilder,
- TableFeaturesPropType.OFPTFPTWRITEACTIONS,
+ TableFeaturesPropType.OFPTFPTWRITESETFIELD,
((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
: setFieldMatch));
} else if (propType instanceof WriteSetfieldMiss) {
.getSetFieldMatch();
setSetFieldTableFeatureProperty(
propBuilder,
- TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
+ TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,
((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
: setFieldMatch));
} else if (propType instanceof ApplySetfield) {
.getSetFieldMatch();
setSetFieldTableFeatureProperty(
propBuilder,
- TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
+ TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,
((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
: setFieldMatch));
} else if (propType instanceof ApplySetfieldMiss) {
.getSetFieldMatch();
setSetFieldTableFeatureProperty(
propBuilder,
- TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
+ TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,
((setFieldMatch == null) ? new ArrayList<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch>()
: setFieldMatch));
} // Experimenter and Experimeneter miss Table features are
private static void setInstructionTableFeatureProperty(TableFeaturePropertiesBuilder builder,
TableFeaturesPropType type, List<Instruction> instructionList) {
List<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.Instructions> instructionTypeList = new ArrayList<>();
- InstructionsBuilder instructionType = new InstructionsBuilder();
+
for (Instruction currInstruction : instructionList) {
+ InstructionsBuilder instructionType = new InstructionsBuilder();
+
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction instruction = currInstruction
.getInstruction();
if (instruction instanceof GoToTableCase) {
private static void setNextTableFeatureProperty(TableFeaturePropertiesBuilder builder, TableFeaturesPropType type,
List<Short> tableIds) {
List<NextTableIds> nextTableIdsList = new ArrayList<>();
- NextTableIdsBuilder nextTableId = new NextTableIdsBuilder();
+
for (Short tableId : tableIds) {
+ NextTableIdsBuilder nextTableId = new NextTableIdsBuilder();
nextTableId.setTableId(tableId);
nextTableIdsList.add(nextTableId.build());
}
TableFeaturesPropType type,
List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> salActions) {
List<ActionsList> actionList = new ArrayList<>();
+
ActionsListBuilder actionListBuilder = new ActionsListBuilder();
- ActionBuilder actionBuilder = new ActionBuilder();
+
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) {
actionBuilder
.setType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output.class);
TableFeaturesPropType type,
List<org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch> setFields) {
List<MatchEntries> matchEntriesList = new ArrayList<>();
- MatchEntriesBuilder matchEntryBuilder = new MatchEntriesBuilder();
+
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();
+ MatchEntriesBuilder matchEntryBuilder = new MatchEntriesBuilder();
if (currMatchType.equals(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp.class)) {
setMatchEntry(matchEntryBuilder, ArpOp.class, currMatch.isHasMask());
} else if (currMatchType
package org.opendaylight.openflowplugin.test;
+import java.math.BigInteger;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.common.api.data.DataModification;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.pcp.action._case.SetVlanPcpActionBuilder;
+
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatchBuilder;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMissBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WildcardsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.actions.miss.ApplyActionsMissBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.Instructions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.TablesBuilder ;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
-
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder ;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
return InstanceIdentifier.builder(Nodes.class).child(Node.class, node.getKey()).toInstance();
}
- private TableBuilder createTestTable() {
+ private TableBuilder createTestTable(String tableFeatureTypeArg) {
+
+ String tableFeatureType = tableFeatureTypeArg;
+ if (tableFeatureType == null) {
+ tableFeatureType = "t1";
+ }
// Sample data , committing to DataStore
DataModification modification = dataBrokerService.beginTransaction();
short id = 12;
TableKey key = new TableKey(id) ;
TableBuilder table = new TableBuilder();
-
+ table.setId((short)12) ;
table.setId(id) ;
table.setKey(key) ;
-
-
- // Send empty table features
- List<TableFeatures> features = new ArrayList<TableFeatures>() ;
- table.setTableFeatures(features) ;
+
+
+ List<TableFeatures> ofTablefeatures = new ArrayList<TableFeatures>() ;
+
+ // Skip this to send empty table features
+ if( ! tableFeatureType.equals( "t1")) {
+
+
+ TableFeaturesBuilder tableFeature1 = new TableFeaturesBuilder() ;
+ tableFeature1.setTableId(new Short((short)0));
+ tableFeature1.setName("Table 0");
+
+ tableFeature1.setMetadataMatch((new BigInteger("10", 10)));
+ tableFeature1.setMetadataWrite((new BigInteger("10", 10)));
+ tableFeature1.setMaxEntries(new Long(10000)) ;
+
+ tableFeature1.setConfig(new TableConfig(false));
+
+ List<TableFeatureProperties> properties = new ArrayList<TableFeatureProperties>() ;
+
+
+ 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 ;
+ }
+
+
+ TablePropertiesBuilder propertyBld = new TablePropertiesBuilder() ;
+ propertyBld.setTableFeatureProperties(properties) ;
+ tableFeature1.setTableProperties(propertyBld.build());
+
+
+ ofTablefeatures.add(tableFeature1.build()) ;
+
+ }
+ table.setTableFeatures(ofTablefeatures) ;
+
testTable = table.build();
return table;
}
+ private TableFeaturePropertiesBuilder createApplyActionsMissTblFeatureProp() {
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ //To set the ApplyActionsMiss
+ List<Action> actionList = new ArrayList<Action>();
+ 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 ;
+
+ }
+
+ private TableFeaturePropertiesBuilder createApplyActionsTblFeatureProp() {
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+ List<Action> actionListt5 = new ArrayList<Action>();
+ ActionBuilder abt5 = new ActionBuilder();
+
+ abt5.setAction(new PopMplsActionCaseBuilder().build());
+ actionListt5.add(abt5.build());
+
+ tableFeatureProperty.setTableFeaturePropType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder()
+ .setApplyActions(new ApplyActionsBuilder().setAction(actionListt5).build()).build()) ;
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createNextTblFeatureProp() {
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+ List<Short> nextTblIds = Arrays.asList(new Short[] { 2, 3} );
+ NextTableBuilder nextTblBld = new NextTableBuilder() ;
+
+ nextTblBld.setTables( new TablesBuilder().setTableIds(nextTblIds).build()) ;
+ tableFeatureProperty.setTableFeaturePropType(nextTblBld.build() ) ;
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createNextTableMissTblFeatureProp() {
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+ List<Short> nextTblMissIds = Arrays.asList( new Short[] { 23, 24, 25, 27, 28, 29 , 30 } );
+ NextTableMissBuilder nextTblMissBld = new NextTableMissBuilder() ;
+
+ nextTblMissBld.setTables(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.miss.TablesBuilder().setTableIds(nextTblMissIds).build()) ;
+ tableFeatureProperty.setTableFeaturePropType(nextTblMissBld.build() ) ;
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+
+
+ private TableFeaturePropertiesBuilder createInstructionsTblFeatureProp() {
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<Instruction> instLst = new ArrayList<Instruction>() ;
+ InstructionBuilder ib = new InstructionBuilder() ;
+ ib.setOrder(1) ;
+ ib.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder().build());
+ ib.setKey(new InstructionKey(1)) ;
+
+ tableFeatureProperty.setTableFeaturePropType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder().setInstructions(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.instructions.InstructionsBuilder().setInstruction(instLst).build()).build() ) ;
+
+
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createInstructionsMissTblFeatureProp() {
+ // To set the instructions miss -- "t7"
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<Instruction> instLst = new ArrayList<Instruction>() ;
+ InstructionBuilder ib1 = new InstructionBuilder() ;
+ ib1.setOrder(1) ;
+ ib1.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder().build());
+ ib1.setKey(new InstructionKey(1)) ;
+
+ InstructionBuilder ib2 = new InstructionBuilder() ;
+ ib2.setOrder(2) ;
+ ib2.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCaseBuilder().build());
+ ib2.setKey(new InstructionKey(2)) ;
+
+ tableFeatureProperty.setTableFeaturePropType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.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(instLst).build()).build() ) ;
+
+
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createWriteActionsTblFeatureProp() {
+ // t8
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<Action> actionList = new ArrayList<Action>();
+
+ ActionBuilder abt1 = new ActionBuilder();
+ abt1.setAction(new CopyTtlOutCaseBuilder().build());
+ actionList.add(abt1.build());
+
+ ActionBuilder abt2 = new ActionBuilder();
+ abt2.setAction(new PopVlanActionCaseBuilder().build());
+ actionList.add(abt2.build());
+
+ tableFeatureProperty.setTableFeaturePropType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.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(actionList).build()).build()) ;
+
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createWriteActionsMissTblFeatureProp() {
+ // t9
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<Action> actionList = new ArrayList<Action>();
+
+ 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());
+
+ 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 ;
+ }
+ private TableFeaturePropertiesBuilder createMatchFieldTblFeatureProp() {
+ //t10
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
+ SetFieldMatchBuilder setFieldMatchBld = new SetFieldMatchBuilder() ;
+ setFieldMatchBld.setHasMask(false) ;
+ setFieldMatchBld.setMatchType(MplsLabel.class) ;
+
+
+ setFieldMatch.add(setFieldMatchBld.build()) ;
+ MatchBuilder matchBld = new MatchBuilder() ;
+ matchBld.setSetFieldMatch(setFieldMatch) ;
+
+ tableFeatureProperty.setTableFeaturePropType(matchBld.build()) ;
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+
+ private TableFeaturePropertiesBuilder createWriteSetFieldTblFeatureProp() {
+ //t11
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld1.setHasMask(false) ;
+ setFieldMatchBld1.setMatchType(MplsLabel.class) ;
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld2.setHasMask(true) ;
+ setFieldMatchBld2.setMatchType(MplsBos.class) ;
+
+ SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld3.setHasMask(true) ;
+ setFieldMatchBld3.setMatchType(EthDst.class) ;
+
+ setFieldMatch.add(setFieldMatchBld1.build()) ;
+ setFieldMatch.add(setFieldMatchBld2.build()) ;
+ setFieldMatch.add(setFieldMatchBld3.build()) ;
+
+ WriteSetfieldBuilder writeSetfieldBld = new WriteSetfieldBuilder() ;
+ writeSetfieldBld.setSetFieldMatch(setFieldMatch) ;
+
+ tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build()) ;
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createWriteSetFieldMissTblFeatureProp() {
+ // t12
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld1.setHasMask(false) ;
+ setFieldMatchBld1.setMatchType(EthSrc.class) ;
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld2.setHasMask(true) ;
+ setFieldMatchBld2.setMatchType(InPort.class) ;
+
+ SetFieldMatchBuilder setFieldMatchBld3 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld3.setHasMask(true) ;
+ setFieldMatchBld3.setMatchType(Ipv4Dst.class) ;
+
+ setFieldMatch.add(setFieldMatchBld1.build()) ;
+ setFieldMatch.add(setFieldMatchBld2.build()) ;
+ setFieldMatch.add(setFieldMatchBld3.build()) ;
+
+ WriteSetfieldMissBuilder writeSetfieldBld = new WriteSetfieldMissBuilder() ;
+ writeSetfieldBld.setSetFieldMatch(setFieldMatch) ;
+
+ tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build()) ;
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createApplySetFieldTblFeatureProp() {
+ //t13
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
+ 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) ;
+
+ setFieldMatch.add(setFieldMatchBld1.build()) ;
+ setFieldMatch.add(setFieldMatchBld2.build()) ;
+ setFieldMatch.add(setFieldMatchBld3.build()) ;
+
+ ApplySetfieldBuilder applySetfieldBld = new ApplySetfieldBuilder() ;
+ applySetfieldBld.setSetFieldMatch(setFieldMatch) ;
+
+ tableFeatureProperty.setTableFeaturePropType(applySetfieldBld.build()) ;
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createApplySetFieldMissTblFeatureProp() {
+ //t14
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
+ 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) ;
+
+ setFieldMatch.add(setFieldMatchBld1.build()) ;
+ setFieldMatch.add(setFieldMatchBld2.build()) ;
+ setFieldMatch.add(setFieldMatchBld3.build()) ;
+
+ ApplySetfieldMissBuilder applySetfieldMissBld = new ApplySetfieldMissBuilder() ;
+ applySetfieldMissBld.setSetFieldMatch(setFieldMatch) ;
+
+ tableFeatureProperty.setTableFeaturePropType(applySetfieldMissBld.build()) ;
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
+ private TableFeaturePropertiesBuilder createWildCardsTblFeatureProp() {
+ //t15
+ TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder() ;
+
+ List<SetFieldMatch> setFieldMatch = new ArrayList<SetFieldMatch>() ;
+ SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld1.setHasMask(false) ;
+ setFieldMatchBld1.setMatchType(ArpOp.class) ;
+
+ SetFieldMatchBuilder setFieldMatchBld2 = new SetFieldMatchBuilder() ;
+ setFieldMatchBld2.setHasMask(true) ;
+ setFieldMatchBld2.setMatchType(InPort.class) ;
+
+
+ setFieldMatch.add(setFieldMatchBld1.build()) ;
+ setFieldMatch.add(setFieldMatchBld2.build()) ;
+
+ WildcardsBuilder wildCardsBld = new WildcardsBuilder() ;
+ wildCardsBld.setSetFieldMatch(setFieldMatch) ;
+
+ tableFeatureProperty.setTableFeaturePropType(wildCardsBld.build()) ;
+ TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0) ;
+ tableFeatureProperty.setKey(keyValue) ;
+ tableFeatureProperty.setOrder(1) ;
+
+ return tableFeatureProperty ;
+ }
+
private void writeTable(CommandInterpreter ci, Table table) {
DataModification modification = dataBrokerService.beginTransaction();
ci.println("User node added" + nref);
createUserNode(nref);
}
- TableBuilder table = createTestTable();
+ String tableFeatureType = ci.nextArgument() ;
+ TableBuilder table = createTestTable(tableFeatureType);
writeTable(ci, table.build());
}