Only use single Apply Actions instruction 48/11448/2
authorDave Tucker <djt@redhat.com>
Mon, 22 Sep 2014 16:37:36 +0000 (17:37 +0100)
committerDave Tucker <djt@redhat.com>
Mon, 22 Sep 2014 18:05:00 +0000 (19:05 +0100)
There should only be one Apply Actions instruction in an Instruction Set
Fixes bug 2029

Change-Id: I415a00c36e951b4b228cde60633b6361df23f77d
Signed-off-by: Dave Tucker <djt@redhat.com>
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/ArpResponderService.java
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/services/RoutingService.java

index 299bb5e6b0710015c50813a01353a5f0f9e6da33..fb431ae65b8c7b0d2ad38e14453d16f658ac633b 100644 (file)
@@ -23,14 +23,17 @@ import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractSer
 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.OF13Provider;
 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
 import org.opendaylight.ovsdb.utils.mdsal.openflow.ActionUtils;
-import org.opendaylight.ovsdb.utils.mdsal.openflow.InstructionUtils;
 import org.opendaylight.ovsdb.utils.mdsal.openflow.MatchUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+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.list.ActionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
 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;
@@ -63,56 +66,66 @@ public class ArpResponderService extends AbstractServiceInstance implements ArpP
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = Lists.newArrayList();
         InstructionBuilder ib = new InstructionBuilder();
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        ActionBuilder ab = new ActionBuilder();
+        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = Lists.newArrayList();
 
         MatchUtils.createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId));
         MatchUtils.createEtherTypeMatch(matchBuilder, new EtherType(Constants.ARP_ETHERTYPE));
 
         // Move Eth Src to Eth Dst
-        ib.setInstruction(InstructionUtils.applyActionIns(ActionUtils.nxMoveEthSrcToEthDstAction()));
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.nxMoveEthSrcToEthDstAction());
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
 
         // Set Eth Src
-        InstructionUtils.createDlSrcInstructions(ib, macAddress);
-        ib.setOrder(1);
-        ib.setKey(new InstructionKey(1));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.setDlSrcAction(new MacAddress(macAddress)));
+        ab.setOrder(1);
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
 
         // Set ARP OP
-        ib.setInstruction(InstructionUtils.applyActionIns(ActionUtils.nxLoadArpOpAction(BigInteger.valueOf(0x02L))));
-        ib.setOrder(2);
-        ib.setKey(new InstructionKey(2));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.nxLoadArpOpAction(BigInteger.valueOf(0x02L)));
+        ab.setOrder(2);
+        ab.setKey(new ActionKey(2));
+        actionList.add(ab.build());
 
         // Move ARP SHA to ARP THA
-        ib.setInstruction(InstructionUtils.applyActionIns(ActionUtils.nxMoveArpShaToArpThaAction()));
-        ib.setOrder(3);
-        ib.setKey(new InstructionKey(3));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.nxMoveArpShaToArpThaAction());
+        ab.setOrder(3);
+        ab.setKey(new ActionKey(3));
+        actionList.add(ab.build());
 
         // Move ARP SPA to ARP TPA
-        ib.setInstruction(InstructionUtils.applyActionIns(ActionUtils.nxMoveArpSpaToArpTpaAction()));
-        ib.setOrder(4);
-        ib.setKey(new InstructionKey(4));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.nxMoveArpSpaToArpTpaAction());
+        ab.setOrder(4);
+        ab.setKey(new ActionKey(4));
+        actionList.add(ab.build());
 
         // Load Mac to ARP SHA
-        ib.setInstruction(InstructionUtils.applyActionIns(ActionUtils.nxLoadArpShaAction(macAddress)));
-        ib.setOrder(5);
-        ib.setKey(new InstructionKey(5));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.nxLoadArpShaAction(macAddress));
+        ab.setOrder(5);
+        ab.setKey(new ActionKey(5));
+        actionList.add(ab.build());
 
         // Load IP to ARP SPA
-        ib.setInstruction(InstructionUtils.applyActionIns(ActionUtils.nxLoadArpSpaAction(ipAddress.getHostAddress())));
-        ib.setOrder(6);
-        ib.setKey(new InstructionKey(6));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.nxLoadArpSpaAction(ipAddress.getHostAddress()));
+        ab.setOrder(6);
+        ab.setKey(new ActionKey(6));
+        actionList.add(ab.build());
 
         // Output of InPort
-        ib.setInstruction(InstructionUtils.applyActionIns(ActionUtils.outputAction(new NodeConnectorId(nodeName + ":INPORT"))));
-        ib.setOrder(7);
-        ib.setKey(new InstructionKey(7));
+        ab.setAction(ActionUtils.outputAction(new NodeConnectorId(nodeName + ":INPORT")));
+        ab.setOrder(7);
+        ab.setKey(new ActionKey(7));
+        actionList.add(ab.build());
+
+        // Create Apply Actions Instruction
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
 
         FlowBuilder flowBuilder = new FlowBuilder();
index eaec19af98bc7ddb5445f7ea01a8de909333b12f..592518685c80b21398ce5744485d763462a58ff7 100644 (file)
@@ -23,15 +23,19 @@ import org.opendaylight.ovsdb.openstack.netvirt.api.RoutingProvider;
 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.OF13Provider;
 import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
-import org.opendaylight.ovsdb.utils.mdsal.openflow.InstructionUtils;
+import org.opendaylight.ovsdb.utils.mdsal.openflow.ActionUtils;
 import org.opendaylight.ovsdb.utils.mdsal.openflow.MatchUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+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.list.ActionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
 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;
@@ -61,27 +65,37 @@ public class RoutingService extends AbstractServiceInstance implements RoutingPr
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = Lists.newArrayList();
         InstructionBuilder ib = new InstructionBuilder();
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        ActionBuilder ab = new ActionBuilder();
+        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = Lists.newArrayList();
 
         String prefixString = address.getHostAddress() + "/" + mask;
         MatchUtils.createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId));
         MatchUtils.createDstL3IPv4Match(matchBuilder, new Ipv4Prefix(prefixString));
 
         // Set source Mac address
-        InstructionUtils.createDlSrcInstructions(ib, new MacAddress(macAddress));
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.setDlSrcAction(new MacAddress(macAddress)));
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
 
         // DecTTL
-        InstructionUtils.createDecNwTtlInstructions(ib);
-        ib.setOrder(1);
-        ib.setKey(new InstructionKey(1));
+        ab.setAction(ActionUtils.decNwTtlAction());
+        ab.setOrder(1);
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
+
+        // Create Apply Actions Instruction
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
 
         // Goto Next Table
         ib = getMutablePipelineInstructionBuilder();
-        ib.setOrder(2);
-        ib.setKey(new InstructionKey(2));
+        ib.setOrder(1);
+        ib.setKey(new InstructionKey(1));
         instructions.add(ib.build());
 
         FlowBuilder flowBuilder = new FlowBuilder();
@@ -125,23 +139,34 @@ public class RoutingService extends AbstractServiceInstance implements RoutingPr
         InstructionsBuilder isb = new InstructionsBuilder();
         List<Instruction> instructions = Lists.newArrayList();
         InstructionBuilder ib = new InstructionBuilder();
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        ActionBuilder ab = new ActionBuilder();
+        List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = Lists.newArrayList();
+
 
         // Set source Mac address
-        InstructionUtils.createDlSrcInstructions(ib, new MacAddress(macAddress));
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
+        ab.setAction(ActionUtils.setDlSrcAction(new MacAddress(macAddress)));
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
 
         // DecTTL
-        InstructionUtils.createDecNwTtlInstructions(ib);
-        ib.setOrder(1);
-        ib.setKey(new InstructionKey(1));
+        ab.setAction(ActionUtils.decNwTtlAction());
+        ab.setOrder(1);
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
+
+        // Create Apply Actions Instruction
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
         instructions.add(ib.build());
 
         // Goto Next Table
         ib = getMutablePipelineInstructionBuilder();
-        ib.setOrder(2);
-        ib.setKey(new InstructionKey(2));
+        ib.setOrder(1);
+        ib.setKey(new InstructionKey(1));
         instructions.add(ib.build());
 
         FlowBuilder flowBuilder = new FlowBuilder();