import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModCommand;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;\r
\r
/**\r
* @author michal.polkorab\r
public class FlowConvertorTest {\r
\r
/**\r
- * Tests {@link FlowConvertor#toFlowModInput(Flow, short, BigInteger)}\r
+ * Tests {@link FlowConvertor#toFlowModInputs(Flow, short, BigInteger)}\r
*/\r
@Test\r
public void test() {\r
flowBuilder.setMatch(null);\r
RemoveFlowInput flow = flowBuilder.build();\r
\r
- FlowModInput flowMod = FlowConvertor\r
- .toFlowModInput(flow, EncodeConstants.OF13_VERSION_ID, new BigInteger("42")).build();\r
+ List<FlowModInputBuilder> flowMod = FlowConvertor\r
+ .toFlowModInputs(flow, EncodeConstants.OF13_VERSION_ID, new BigInteger("42"));\r
\r
- Assert.assertEquals("Wrong version", 4, flowMod.getVersion().intValue());\r
- Assert.assertEquals("Wrong cookie", 4, flowMod.getCookie().intValue());\r
- Assert.assertEquals("Wrong cookie mask", 5, flowMod.getCookieMask().intValue());\r
- Assert.assertEquals("Wrong table id", 6, flowMod.getTableId().getValue().intValue());\r
- Assert.assertEquals("Wrong command", FlowModCommand.OFPFCDELETESTRICT, flowMod.getCommand());\r
- Assert.assertEquals("Wrong idle timeout", 50, flowMod.getIdleTimeout().intValue());\r
- Assert.assertEquals("Wrong hard timeout", 500, flowMod.getHardTimeout().intValue());\r
- Assert.assertEquals("Wrong priority", 40, flowMod.getPriority().intValue());\r
- Assert.assertEquals("Wrong buffer id", 18, flowMod.getBufferId().intValue());\r
- Assert.assertEquals("Wrong out port", 65535, flowMod.getOutPort().getValue().intValue());\r
- Assert.assertEquals("Wrong out group", 5000, flowMod.getOutGroup().intValue());\r
- Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowMod.getFlags());\r
+ Assert.assertEquals("Wrong version", 4, flowMod.get(0).getVersion().intValue());\r
+ Assert.assertEquals("Wrong cookie", 4, flowMod.get(0).getCookie().intValue());\r
+ Assert.assertEquals("Wrong cookie mask", 5, flowMod.get(0).getCookieMask().intValue());\r
+ Assert.assertEquals("Wrong table id", 6, flowMod.get(0).getTableId().getValue().intValue());\r
+ Assert.assertEquals("Wrong command", FlowModCommand.OFPFCDELETESTRICT, flowMod.get(0).getCommand());\r
+ Assert.assertEquals("Wrong idle timeout", 50, flowMod.get(0).getIdleTimeout().intValue());\r
+ Assert.assertEquals("Wrong hard timeout", 500, flowMod.get(0).getHardTimeout().intValue());\r
+ Assert.assertEquals("Wrong priority", 40, flowMod.get(0).getPriority().intValue());\r
+ Assert.assertEquals("Wrong buffer id", 18, flowMod.get(0).getBufferId().intValue());\r
+ Assert.assertEquals("Wrong out port", 65535, flowMod.get(0).getOutPort().getValue().intValue());\r
+ Assert.assertEquals("Wrong out group", 5000, flowMod.get(0).getOutGroup().intValue());\r
+ Assert.assertEquals("Wrong flags", new FlowModFlags(false, false, false, false, false), flowMod.get(0).getFlags());\r
Assert.assertEquals("Wrong match", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmMatchType",\r
- flowMod.getMatch().getType().getName());\r
- Assert.assertEquals("Wrong match entries size", 0, flowMod.getMatch().getMatchEntry().size());\r
+ flowMod.get(0).getMatch().getType().getName());\r
+ Assert.assertEquals("Wrong match entries size", 0, flowMod.get(0).getMatch().getMatchEntry().size());\r
}\r
\r
/**\r
- * Tests {@link FlowConvertor#toFlowModInput(Flow, short, BigInteger)}\r
+ * Tests {@link FlowConvertor#toFlowModInputs(Flow, short, BigInteger)}\r
*/\r
@Test\r
public void testOnlyModifyStrictCommand() {\r
flowBuilder.setStrict(true);\r
UpdatedFlow flow = flowBuilder.build();\r
\r
- FlowModInput flowMod = FlowConvertor\r
- .toFlowModInput(flow, EncodeConstants.OF10_VERSION_ID, new BigInteger("42")).build();\r
+ List<FlowModInputBuilder> flowMod = FlowConvertor\r
+ .toFlowModInputs(flow, EncodeConstants.OF10_VERSION_ID, new BigInteger("42"));\r
\r
- Assert.assertEquals("Wrong version", 1, flowMod.getVersion().intValue());\r
- Assert.assertEquals("Wrong command", FlowModCommand.OFPFCMODIFYSTRICT, flowMod.getCommand());\r
+ Assert.assertEquals("Wrong version", 1, flowMod.get(0).getVersion().intValue());\r
+ Assert.assertEquals("Wrong command", FlowModCommand.OFPFCMODIFYSTRICT, flowMod.get(0).getCommand());\r
}\r
\r
/**\r
- * Tests {@link FlowConvertor#toFlowModInput(Flow, short, BigInteger)}\r
+ * Tests {@link FlowConvertor#toFlowModInputs(Flow, short, BigInteger)}\r
*/\r
@Test\r
public void testInstructionsTranslation() {\r
flowBuilder.setInstructions(instructionsBuilder.build());\r
AddFlowInput flow = flowBuilder.build();\r
\r
- FlowModInput flowMod = FlowConvertor\r
- .toFlowModInput(flow, EncodeConstants.OF10_VERSION_ID, new BigInteger("42")).build();\r
+ List<FlowModInputBuilder> flowMod = FlowConvertor\r
+ .toFlowModInputs(flow, EncodeConstants.OF10_VERSION_ID, new BigInteger("42"));\r
\r
- Assert.assertEquals("Wrong version", 1, flowMod.getVersion().intValue());\r
- Assert.assertEquals("Wrong command", FlowModCommand.OFPFCADD, flowMod.getCommand());\r
- Assert.assertEquals("Wrong instructions size", 6, flowMod.getInstruction().size());\r
+ Assert.assertEquals("Wrong version", 1, flowMod.get(0).getVersion().intValue());\r
+ Assert.assertEquals("Wrong command", FlowModCommand.OFPFCADD, flowMod.get(0).getCommand());\r
+ Assert.assertEquals("Wrong instructions size", 6, flowMod.get(0).getInstruction().size());\r
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions\r
- .grouping.Instruction instruction = flowMod.getInstruction().get(0);\r
+ .grouping.Instruction instruction = flowMod.get(0).getInstruction().get(0);\r
Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
+ ".instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCase", instruction.getInstructionChoice().getImplementedInterface().getName());\r
GotoTableCase gotoTableCase = (GotoTableCase) instruction.getInstructionChoice();\r
Assert.assertEquals("Wrong table id", 1, gotoTableCase.getGotoTable().getTableId().intValue());\r
- instruction = flowMod.getInstruction().get(1);\r
+ instruction = flowMod.get(0).getInstruction().get(1);\r
Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
+ ".instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase", instruction.getInstructionChoice().getImplementedInterface().getName());\r
WriteMetadataCase writeMetadataCase = (WriteMetadataCase) instruction.getInstructionChoice();\r
Assert.assertArrayEquals("Wrong metadata mask", new byte[]{0, 0, 0, 0, 0, 0, 0, 3},\r
writeMetadataCase.getWriteMetadata().getMetadataMask());\r
\r
- instruction = flowMod.getInstruction().get(2);\r
+ instruction = flowMod.get(0).getInstruction().get(2);\r
Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
+ ".instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase", instruction.getInstructionChoice().getImplementedInterface().getName());\r
WriteActionsCase writeActionsCase = (WriteActionsCase) instruction.getInstructionChoice();\r
Assert.assertEquals("Wrong actions size", 0, writeActionsCase.getWriteActions().getAction().size());\r
- instruction = flowMod.getInstruction().get(3);\r
+ instruction = flowMod.get(0).getInstruction().get(3);\r
Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
+ ".instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase", instruction.getInstructionChoice().getImplementedInterface().getName());\r
ApplyActionsCase applyActionsCase = (ApplyActionsCase) instruction.getInstructionChoice();\r
Assert.assertEquals("Wrong actions size", 0, applyActionsCase.getApplyActions().getAction().size());\r
- instruction = flowMod.getInstruction().get(4);\r
+ instruction = flowMod.get(0).getInstruction().get(4);\r
Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
+ ".instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase", instruction.getInstructionChoice().getImplementedInterface().getName());\r
- instruction = flowMod.getInstruction().get(5);\r
+ instruction = flowMod.get(0).getInstruction().get(5);\r
Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"\r
+ ".instruction.rev130731.instruction.grouping.instruction.choice.MeterCase", instruction.getInstructionChoice().getImplementedInterface().getName());\r
MeterCase meterCase = (MeterCase) instruction.getInstructionChoice();\r