X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=test-provider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Ftest%2FOpenflowpluginTableFeaturesTestCommandProvider.java;h=751eb532d89be6f88aabf1f149baea4015039f0c;hb=137e4d7d86e8f402f3d52fd0fa162792f9ff60eb;hp=e485d1307965683055da8843f40a347e047c77b5;hpb=8a3b468428a26205b1e19e1f50eba01b6e5386a1;p=openflowplugin.git diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestCommandProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestCommandProvider.java index e485d13079..751eb532d8 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestCommandProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestCommandProvider.java @@ -7,9 +7,11 @@ */ package org.opendaylight.openflowplugin.test; +import com.google.common.base.Preconditions; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.MoreExecutors; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; @@ -72,23 +74,18 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; import org.osgi.framework.BundleContext; - +@SuppressWarnings("checkstyle:MethodName") public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandProvider { private DataBroker dataBroker; - private ProviderContext pc; private final BundleContext ctx; - private TableFeatures testTable; private Node testNode; - private final String originalTableName = "Foo"; - private final String updatedTableName = "Bar"; public OpenflowpluginTableFeaturesTestCommandProvider(BundleContext ctx) { this.ctx = ctx; } public void onSessionInitiated(ProviderContext session) { - pc = session; dataBroker = session.getSALService(DataBroker.class); ctx.registerService(CommandProvider.class.getName(), this, null); // createTestNode(); @@ -98,19 +95,19 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private void createUserNode(String nodeRef) { NodeBuilder builder = new NodeBuilder(); builder.setId(new NodeId(nodeRef)); - builder.setKey(new NodeKey(builder.getId())); + builder.withKey(new NodeKey(builder.getId())); testNode = builder.build(); } private void createTestNode() { NodeBuilder builder = new NodeBuilder(); builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID)); - builder.setKey(new NodeKey(builder.getId())); + builder.withKey(new NodeKey(builder.getId())); testNode = builder.build(); } private InstanceIdentifier nodeToInstanceId(Node node) { - return InstanceIdentifier.create(Nodes.class).child(Node.class, node.getKey()); + return InstanceIdentifier.create(Nodes.class).child(Node.class, node.key()); } private TableFeaturesBuilder createTestTableFeatures(String tableFeatureTypeArg) { @@ -135,7 +132,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr tableFeature.setConfig(new TableConfig(false)); - List properties = new ArrayList(); + List properties = new ArrayList<>(); switch (tableFeatureType) { @@ -195,6 +192,8 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr // To set the wildcards set field match properties.add(createWildCardsTblFeatureProp().build()); break; + default: + break; } @@ -202,7 +201,6 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr propertyBld.setTableFeatureProperties(properties); tableFeature.setTableProperties(propertyBld.build()); } - testTable = tableFeature.build(); return tableFeature; } @@ -210,18 +208,19 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); //To set the ApplyActionsMiss - List actionList = new ArrayList(); + List 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() + 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.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -230,18 +229,19 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createApplyActionsTblFeatureProp() { TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List actionListt5 = new ArrayList(); + List actionListt5 = new ArrayList<>(); 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() + 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.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -256,7 +256,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr tableFeatureProperty.setTableFeaturePropType(nextTblBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -271,7 +271,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr tableFeatureProperty.setTableFeaturePropType(nextTblMissBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -279,21 +279,24 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createInstructionsTblFeatureProp() { - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - - List instLst = new ArrayList(); 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)); + ib.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction + .instruction.ApplyActionsCaseBuilder().build()); + ib.withKey(new InstructionKey(1)); + List instLst = new ArrayList<>(); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); 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()); + 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.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -301,26 +304,31 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createInstructionsMissTblFeatureProp() { // To set the instructions miss -- "t7" - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List instLst = new ArrayList(); 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)); + ib1.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction + .instruction.WriteMetadataCaseBuilder().build()); + ib1.withKey(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)); + ib2.setInstruction(new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction + .instruction.MeterCaseBuilder().build()); + ib2.withKey(new InstructionKey(2)); + List instLst = new ArrayList<>(); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); 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()); + 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.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -328,9 +336,8 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createWriteActionsTblFeatureProp() { // t8 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List actionList = new ArrayList(); + List actionList = new ArrayList<>(); ActionBuilder abt1 = new ActionBuilder(); abt1.setAction(new CopyTtlOutCaseBuilder().build()); @@ -340,12 +347,15 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr abt2.setAction(new PopVlanActionCaseBuilder().build()); actionList.add(abt2.build()); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); 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()); + 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.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -353,9 +363,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createWriteActionsMissTblFeatureProp() { // t9 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - - List actionList = new ArrayList(); + List actionList = new ArrayList<>(); ActionBuilder abt1 = new ActionBuilder(); abt1.setAction(new CopyTtlInCaseBuilder().build()); @@ -365,12 +373,15 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr abt2.setAction(new PushPbbActionCaseBuilder().build()); actionList.add(abt2.build()); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); 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()); + 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.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -378,10 +389,8 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createMatchFieldTblFeatureProp() { //t10 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - - List setFieldMatch = new ArrayList(); + List setFieldMatch = new ArrayList<>(); SetFieldMatchBuilder setFieldMatchBld = new SetFieldMatchBuilder(); setFieldMatchBld.setHasMask(false); setFieldMatchBld.setMatchType(MplsLabel.class); @@ -393,9 +402,10 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr matchSetfieldBld.setSetFieldMatch(setFieldMatch); matchBld.setMatchSetfield(matchSetfieldBld.build()); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); tableFeatureProperty.setTableFeaturePropType(matchBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -404,9 +414,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createWriteSetFieldTblFeatureProp() { //t11 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List setFieldMatch = new ArrayList(); SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder(); setFieldMatchBld1.setHasMask(false); setFieldMatchBld1.setMatchType(MplsLabel.class); @@ -419,20 +427,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr setFieldMatchBld3.setHasMask(true); setFieldMatchBld3.setMatchType(EthDst.class); + List setFieldMatch = new ArrayList<>(); setFieldMatch.add(setFieldMatchBld1.build()); setFieldMatch.add(setFieldMatchBld2.build()); setFieldMatch.add(setFieldMatchBld3.build()); WriteSetfieldBuilder writeSetfieldBld = new WriteSetfieldBuilder(); - org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder writeSetfieldBuilder = - new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.WriteSetfieldBuilder(); + org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop + .type.write.setfield.WriteSetfieldBuilder writeSetfieldBuilder = + new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table + .feature.prop.type.write.setfield.WriteSetfieldBuilder(); writeSetfieldBuilder.setSetFieldMatch(setFieldMatch); writeSetfieldBld.setWriteSetfield(writeSetfieldBuilder.build()); - + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -440,9 +451,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createWriteSetFieldMissTblFeatureProp() { // t12 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List setFieldMatch = new ArrayList(); SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder(); setFieldMatchBld1.setHasMask(false); setFieldMatchBld1.setMatchType(EthSrc.class); @@ -455,19 +464,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr setFieldMatchBld3.setHasMask(true); setFieldMatchBld3.setMatchType(Ipv4Dst.class); + List setFieldMatch = new ArrayList<>(); setFieldMatch.add(setFieldMatchBld1.build()); setFieldMatch.add(setFieldMatchBld2.build()); setFieldMatch.add(setFieldMatchBld3.build()); WriteSetfieldMissBuilder writeSetfieldBld = new WriteSetfieldMissBuilder(); - org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder writeSetfieldMissBuilder = - new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder(); + org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop + .type.write.setfield.miss.WriteSetfieldMissBuilder writeSetfieldMissBuilder = + new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table + .feature.prop.type.write.setfield.miss.WriteSetfieldMissBuilder(); writeSetfieldMissBuilder.setSetFieldMatch(setFieldMatch); writeSetfieldBld.setWriteSetfieldMiss(writeSetfieldMissBuilder.build()); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); tableFeatureProperty.setTableFeaturePropType(writeSetfieldBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -475,9 +488,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createApplySetFieldTblFeatureProp() { //t13 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List setFieldMatch = new ArrayList(); SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder(); setFieldMatchBld1.setHasMask(false); setFieldMatchBld1.setMatchType(ArpOp.class); @@ -490,19 +501,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr setFieldMatchBld3.setHasMask(true); setFieldMatchBld3.setMatchType(Ipv4Dst.class); + List setFieldMatch = new ArrayList<>(); setFieldMatch.add(setFieldMatchBld1.build()); setFieldMatch.add(setFieldMatchBld2.build()); setFieldMatch.add(setFieldMatchBld3.build()); ApplySetfieldBuilder applySetfieldBld = new ApplySetfieldBuilder(); - org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder = - new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.ApplySetfieldBuilder(); + org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop + .type.apply.setfield.ApplySetfieldBuilder applySetfieldBuilder = + new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table + .feature.prop.type.apply.setfield.ApplySetfieldBuilder(); applySetfieldBuilder.setSetFieldMatch(setFieldMatch); applySetfieldBld.setApplySetfield(applySetfieldBuilder.build()); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); tableFeatureProperty.setTableFeaturePropType(applySetfieldBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -510,9 +525,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createApplySetFieldMissTblFeatureProp() { //t14 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List setFieldMatch = new ArrayList(); SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder(); setFieldMatchBld1.setHasMask(false); setFieldMatchBld1.setMatchType(ArpOp.class); @@ -525,19 +538,23 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr setFieldMatchBld3.setHasMask(true); setFieldMatchBld3.setMatchType(Ipv4Dst.class); + List setFieldMatch = new ArrayList<>(); setFieldMatch.add(setFieldMatchBld1.build()); setFieldMatch.add(setFieldMatchBld2.build()); setFieldMatch.add(setFieldMatchBld3.build()); ApplySetfieldMissBuilder applySetfieldMissBld = new ApplySetfieldMissBuilder(); - org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder applySetfieldMissBuilder = - new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder(); + org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop + .type.apply.setfield.miss.ApplySetfieldMissBuilder applySetfieldMissBuilder = + new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table + .feature.prop.type.apply.setfield.miss.ApplySetfieldMissBuilder(); applySetfieldMissBuilder.setSetFieldMatch(setFieldMatch); applySetfieldMissBld.setApplySetfieldMiss(applySetfieldMissBuilder.build()); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); tableFeatureProperty.setTableFeaturePropType(applySetfieldMissBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; @@ -545,9 +562,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr private TableFeaturePropertiesBuilder createWildCardsTblFeatureProp() { //t15 - TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); - List setFieldMatch = new ArrayList(); SetFieldMatchBuilder setFieldMatchBld1 = new SetFieldMatchBuilder(); setFieldMatchBld1.setHasMask(false); setFieldMatchBld1.setMatchType(ArpOp.class); @@ -556,7 +571,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr setFieldMatchBld2.setHasMask(true); setFieldMatchBld2.setMatchType(InPort.class); - + List setFieldMatch = new ArrayList<>(); setFieldMatch.add(setFieldMatchBld1.build()); setFieldMatch.add(setFieldMatchBld2.build()); @@ -566,22 +581,21 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr wildcardsBuilder.setSetFieldMatch(setFieldMatch); wildCardsBld.setWildcardSetfield(wildcardsBuilder.build()); + TableFeaturePropertiesBuilder tableFeatureProperty = new TableFeaturePropertiesBuilder(); tableFeatureProperty.setTableFeaturePropType(wildCardsBld.build()); TableFeaturePropertiesKey keyValue = new TableFeaturePropertiesKey(0); - tableFeatureProperty.setKey(keyValue); + tableFeatureProperty.withKey(keyValue); tableFeatureProperty.setOrder(1); return tableFeatureProperty; } - private void writeTableFeatures(final CommandInterpreter ci, TableFeatures tableFeatures) { - ReadWriteTransaction modification = dataBroker.newReadWriteTransaction(); + ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction(); KeyedInstanceIdentifier path1 = InstanceIdentifier.create(Nodes.class) - .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class). - child(TableFeatures.class, new TableFeaturesKey(tableFeatures.getTableId())); - + .child(Node.class, testNode.key()).augmentation(FlowCapableNode.class) + .child(TableFeatures.class, new TableFeaturesKey(tableFeatures.getTableId())); modification.merge(LogicalDatastoreType.OPERATIONAL, nodeToInstanceId(testNode), testNode, true); modification.merge(LogicalDatastoreType.OPERATIONAL, path1, tableFeatures, true); @@ -590,7 +604,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr CheckedFuture commitFuture = modification.submit(); Futures.addCallback(commitFuture, new FutureCallback() { @Override - public void onSuccess(Void aVoid) { + public void onSuccess(Void notUsed) { ci.println("Status of Group Data Loaded Transaction: success."); } @@ -598,7 +612,7 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr public void onFailure(Throwable throwable) { ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } - }); + }, MoreExecutors.directExecutor()); } public void _modifyTable(CommandInterpreter ci) { @@ -626,6 +640,5 @@ public class OpenflowpluginTableFeaturesTestCommandProvider implements CommandPr return help.toString(); } - }