Fix to allow RESTCONF PUTing of Flows 14/3314/14
authorTony Tkacik <ttkacik@cisco.com>
Sun, 1 Dec 2013 16:53:21 +0000 (17:53 +0100)
committerEd Warnicke <eaw@cisco.com>
Mon, 9 Dec 2013 22:58:19 +0000 (14:58 -0800)
- Due to a bug in the JAXB spec, which is propogated to
JAXRS, which forbids '/', even escaped, in path segments
in URLs... we can't use the nesting by refs under /flows.

- Therefore I've moved flow config to
nodes -> node -> table -> flow

- Making that change in the existing FlowConsumerImpl proved extremely
hard.  Due to the press of time I've introduced a very simple set of
FlowProvider, FlowCommitHandler, FlowTransaction, FlowTransactionValidator,
to cleanly separate the logic.  We can migrate over the validation rules as
need be.

PatchSet 11: Abstract the Transaction.  Add Groups.
PatchSet 12: Fixes for Meters

PatchSet 13: Yet another rebase

PatchSet 14: Squashing https://git.opendaylight.org/gerrit/#/c/3304/8

Must proceed: http://git.opendaylight.org/gerrit/3596/1
in openflowplugin

Change-Id: I1f1cd04a04f7a30630062725e63112cda4b049f1
Signed-off-by: Ed Warnicke <eaw@cisco.com>
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
34 files changed:
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/MDFlowMapping.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/ToSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestFromSalConversionsUtils.java
opendaylight/md-sal/compatibility/sal-compatibility/src/test/java/org/opendaylight/controller/sal/compatibility/test/TestToSalConversionsUtils.java
opendaylight/md-sal/forwardingrules-manager/pom.xml
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/forwardingrulesmanager/consumer/impl/FRMUtil.java
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowCommitHandler.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransactionValidator.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupCommitHandler.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransactionValidator.java [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterCommitHandler.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend [new file with mode: 0644]
opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransactionValidator.java [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-base/src/main/yang/action-types.yang [deleted file]
opendaylight/md-sal/model/model-flow-base/src/main/yang/group-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/match-types.yang
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-action-types.yang [new file with mode: 0644]
opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-flow-types.yang [moved from opendaylight/md-sal/model/model-flow-base/src/main/yang/flow-types.yang with 73% similarity]
opendaylight/md-sal/model/model-flow-service/src/main/yang/flow-node-inventory.yang
opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/pom.xml
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/BindingTestUtilities.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/MultipleAugmentationPuts.java [new file with mode: 0644]
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DOMCodecBug01Test.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/ChangeOriginatedInDomBrokerTest.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/AbstractTest.java

index 1e33481..6cf728c 100644 (file)
@@ -42,28 +42,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Remo
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInputBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionBuilder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder
@@ -80,9 +58,54 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder
 import java.util.Collections
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.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.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder
+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.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCaseBuilder
+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.FloodActionCaseBuilder
+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.HwPathActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCaseBuilder
+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.OutputActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCaseBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder
+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.SwPathActionCaseBuilder
+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.instruction.ApplyActionsCaseBuilder
 
 public class MDFlowMapping {
 
@@ -114,7 +137,7 @@ public class MDFlowMapping {
     public static def Instructions toApplyInstruction(ArrayList<Action> actions) {
         val it = new InstructionsBuilder;
         val applyActions = new InstructionBuilder;
-        applyActions.instruction = new ApplyActionsBuilder().setAction(actions).build()
+        applyActions.instruction = new ApplyActionsCaseBuilder().setApplyActions(new ApplyActionsBuilder().setAction(actions).build()).build()
         instruction = Collections.<Instruction>singletonList(applyActions.build)
         return it.build;
     }
@@ -153,37 +176,37 @@ public class MDFlowMapping {
 
     public static dispatch def toAction(Controller sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new ControllerActionBuilder().build();
+        actionBuilder.action = new ControllerActionCaseBuilder().setControllerAction(new ControllerActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(Drop sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new DropActionBuilder().build();
+        actionBuilder.action = new DropActionCaseBuilder().setDropAction(new DropActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(Flood sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new FloodActionBuilder().build();
+        actionBuilder.action = new FloodActionCaseBuilder().setFloodAction(new FloodActionBuilder().build).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(FloodAll sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new FloodAllActionBuilder().build();
+        actionBuilder.action = new FloodAllActionCaseBuilder().setFloodAllAction(new FloodAllActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(HwPath sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new HwPathActionBuilder().build();
+        actionBuilder.action = new HwPathActionCaseBuilder().setHwPathAction(new HwPathActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(Loopback sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new LoopbackActionBuilder().build();
+        actionBuilder.action = new LoopbackActionCaseBuilder().setLoopbackAction(new LoopbackActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
@@ -191,14 +214,14 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new OutputActionBuilder();
         outputNodeConnector = sourceAction.port.toUri;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new OutputActionCaseBuilder().setOutputAction(it.build()).build();
         return actionBuilder.build();
 
     }
 
     public static dispatch def toAction(PopVlan sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new PopVlanActionBuilder().build();
+        actionBuilder.action = new PopVlanActionCaseBuilder().build();
         return actionBuilder.build();
     }
 
@@ -209,7 +232,7 @@ public class MDFlowMapping {
         vlanId = new VlanId(sourceAction.vlanId);
         pcp = sourceAction.pcp;
         tag = sourceAction.tag;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new PushVlanActionCaseBuilder().setPushVlanAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -217,7 +240,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetDlDstActionBuilder();
         address = sourceAction.dlAddress.toMacAddress();
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetDlDstActionCaseBuilder().setSetDlDstAction(it.build()).build;
         return actionBuilder.build();
     }
 
@@ -225,7 +248,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetDlSrcActionBuilder();
         address = sourceAction.dlAddress.toMacAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetDlSrcActionCaseBuilder().setSetDlSrcAction(it.build()).build;
         return actionBuilder.build();
     }
 
@@ -233,7 +256,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetDlTypeActionBuilder();
         dlType = new EtherType(sourceAction.dlType as long);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetDlTypeActionCaseBuilder().setSetDlTypeAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -242,7 +265,7 @@ public class MDFlowMapping {
         val it = new SetNextHopActionBuilder();
         val inetAddress = sourceAction.address;
         address = inetAddress.toInetAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNextHopActionCaseBuilder().setSetNextHopAction(it.build).build();
         return actionBuilder.build();
     }
 
@@ -251,7 +274,7 @@ public class MDFlowMapping {
         val it = new SetNwDstActionBuilder();
         val inetAddress = sourceAction.address;
         address = inetAddress.toInetAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNwDstActionCaseBuilder().setSetNwDstAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -260,7 +283,7 @@ public class MDFlowMapping {
         val it = new SetNwSrcActionBuilder();
         val inetAddress = sourceAction.address;
         address = inetAddress.toInetAddress;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNwSrcActionCaseBuilder().setSetNwSrcAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -268,7 +291,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetNwTosActionBuilder();
         tos = sourceAction.nwTos;
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetNwTosActionCaseBuilder().setSetNwTosAction(it.build).build;
         return actionBuilder.build();
     }
 
@@ -276,7 +299,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetTpDstActionBuilder();
         port = new PortNumber(sourceAction.port);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetTpDstActionCaseBuilder().setSetTpDstAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -284,7 +307,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetTpSrcActionBuilder();
         port = new PortNumber(sourceAction.port);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetTpSrcActionCaseBuilder().setSetTpSrcAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -292,7 +315,7 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetVlanCfiActionBuilder();
         vlanCfi = new VlanCfi(sourceAction.cfi);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetVlanCfiActionCaseBuilder().setSetVlanCfiAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -301,7 +324,7 @@ public class MDFlowMapping {
 
         val it = new SetVlanIdActionBuilder();
         vlanId = new VlanId(sourceAction.vlanId);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetVlanIdActionCaseBuilder().setSetVlanIdAction(it.build()).build();
         return actionBuilder.build();
     }
 
@@ -309,13 +332,13 @@ public class MDFlowMapping {
         val actionBuilder = new ActionBuilder();
         val it = new SetVlanPcpActionBuilder();
         vlanPcp = new VlanPcp(sourceAction.pcp as short);
-        actionBuilder.action = it.build();
+        actionBuilder.action = new SetVlanPcpActionCaseBuilder().setSetVlanPcpAction(it.build).build;
         return actionBuilder.build();
     }
 
     public static dispatch def toAction(SwPath sourceAction) {
         val actionBuilder = new ActionBuilder();
-        actionBuilder.action = new SwPathActionBuilder().build();
+        actionBuilder.action = new SwPathActionCaseBuilder().setSwPathAction(new SwPathActionBuilder().build()).build();
         return actionBuilder.build();
     }
 
index b5ed3fe..a8349be 100644 (file)
@@ -35,38 +35,39 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 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.ActionList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCase;
 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.address.Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
@@ -147,8 +148,8 @@ public class ToSalConversionsUtils {
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) {
         if (source.getInstructions() != null) {
             for (Instruction instruction : source.getInstructions().getInstruction()) {
-                if (instruction.getInstruction() instanceof ActionList) {
-                    return (((ActionList) instruction.getInstruction()).getAction());
+                if (instruction.getInstruction() instanceof ApplyActionsCase) {
+                    return (((ApplyActionsCase) instruction.getInstruction()).getApplyActions().getAction());
                 }
             }
         }
@@ -162,119 +163,119 @@ public class ToSalConversionsUtils {
                org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action sourceAction = action
                     .getAction();
 
-            if (sourceAction instanceof ControllerAction) {
+            if (sourceAction instanceof ControllerActionCase) {
                 targetAction.add(new Controller());
-            } else if (sourceAction instanceof OutputAction) {
+            } else if (sourceAction instanceof OutputActionCase) {
 
-                Uri nodeConnector = ((OutputAction) sourceAction).getOutputNodeConnector();
+                Uri nodeConnector = ((OutputActionCase) sourceAction).getOutputAction().getOutputNodeConnector();
                 if (nodeConnector != null) {
                     //for (Uri uri : nodeConnectors) {
                         targetAction.add(new Output(fromNodeConnectorRef(nodeConnector)));
                     //}
                 }
-            } else if (sourceAction instanceof PopMplsAction) {
+            } else if (sourceAction instanceof PopMplsActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof PushMplsAction) {
+            } else if (sourceAction instanceof PushMplsActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof PushPbbAction) {
+            } else if (sourceAction instanceof PushPbbActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof SetMplsTtlAction) {
+            } else if (sourceAction instanceof SetMplsTtlActionCase) {
                 // TODO: define maping
                 // targetAction = //no action to map
-            } else if (sourceAction instanceof SetNwTtlAction) {
+            } else if (sourceAction instanceof SetNwTtlActionCase) {
                 // TODO: define maping
-            } else if (sourceAction instanceof SetQueueAction) {
+            } else if (sourceAction instanceof SetQueueActionCase) {
                 // TODO: define maping
                 // targetAction = //no action to map
-            } else if (sourceAction instanceof DropAction) {
+            } else if (sourceAction instanceof DropActionCase) {
                 targetAction.add(new Drop());
-            } else if (sourceAction instanceof FloodAction) {
+            } else if (sourceAction instanceof FloodActionCase) {
                 targetAction.add(new Flood());
-            } else if (sourceAction instanceof FloodAllAction) {
+            } else if (sourceAction instanceof FloodAllActionCase) {
                 targetAction.add(new FloodAll());
-            } else if (sourceAction instanceof HwPathAction) {
+            } else if (sourceAction instanceof HwPathActionCase) {
                 targetAction.add(new HwPath());
-            } else if (sourceAction instanceof LoopbackAction) {
+            } else if (sourceAction instanceof LoopbackActionCase) {
                 targetAction.add(new Loopback());
-            } else if (sourceAction instanceof PopVlanAction) {
+            } else if (sourceAction instanceof PopVlanActionCase) {
                 targetAction.add(new PopVlan());
-            } else if (sourceAction instanceof PushVlanAction) {
-                PushVlanAction pushVlanAction = (PushVlanAction) sourceAction;
-                PushVlan pushVlan = pushVlanFrom(pushVlanAction);
+            } else if (sourceAction instanceof PushVlanActionCase) {
+                PushVlanActionCase pushVlanAction = (PushVlanActionCase) sourceAction;
+                PushVlan pushVlan = pushVlanFrom(pushVlanAction.getPushVlanAction());
                 if (pushVlan != null) {
                     targetAction.add(pushVlan);
                 }
-            } else if (sourceAction instanceof SetDlDstAction) {
-                MacAddress addressL2Dest = ((SetDlDstAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetDlDstActionCase) {
+                MacAddress addressL2Dest = ((SetDlDstActionCase) sourceAction).getSetDlDstAction().getAddress();
                 if (addressL2Dest != null) {
                     targetAction.add(new SetDlDst(bytesFrom(addressL2Dest)));
                 }
-            } else if (sourceAction instanceof SetDlSrcAction) {
-                MacAddress addressL2Src = ((SetDlSrcAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetDlSrcActionCase) {
+                MacAddress addressL2Src = ((SetDlSrcActionCase) sourceAction).getSetDlSrcAction().getAddress();
                 if (addressL2Src != null) {
                     targetAction.add(new SetDlSrc(bytesFrom(addressL2Src)));
 
                 }
-            } else if (sourceAction instanceof SetDlTypeAction) {
-                EtherType dlType = ((SetDlTypeAction) sourceAction).getDlType();
+            } else if (sourceAction instanceof SetDlTypeActionCase) {
+                EtherType dlType = ((SetDlTypeActionCase) sourceAction).getSetDlTypeAction().getDlType();
                 if (dlType != null) {
                     Long dlTypeValue = dlType.getValue();
                     if (dlTypeValue != null) {
                         targetAction.add(new SetDlType(dlTypeValue.intValue()));
                     }
                 }
-            } else if (sourceAction instanceof SetNextHopAction) {
-                Address addressL3 = ((SetNextHopAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetNextHopActionCase) {
+                Address addressL3 = ((SetNextHopActionCase) sourceAction).getSetNextHopAction().getAddress();
 
                 InetAddress inetAddress = inetAddressFrom(addressL3);
                 if (inetAddress != null) {
                     targetAction.add(new SetNextHop(inetAddress));
                 }
-            } else if (sourceAction instanceof SetNwDstAction) {
-                Address addressL3 = ((SetNwDstAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetNwDstActionCase) {
+                Address addressL3 = ((SetNwDstActionCase) sourceAction).getSetNwDstAction().getAddress();
 
                 InetAddress inetAddress = inetAddressFrom(addressL3);
                 if (inetAddress != null) {
                     targetAction.add(new SetNwDst(inetAddress));
                 }
-            } else if (sourceAction instanceof SetNwSrcAction) {
-                Address addressL3 = ((SetNwSrcAction) sourceAction).getAddress();
+            } else if (sourceAction instanceof SetNwSrcActionCase) {
+                Address addressL3 = ((SetNwSrcActionCase) sourceAction).getSetNwSrcAction().getAddress();
 
                 InetAddress inetAddress = inetAddressFrom(addressL3);
                 if (inetAddress != null) {
                     targetAction.add(new SetNwSrc(inetAddress));
                 }
-            } else if (sourceAction instanceof SetNwTosAction) {
-                Integer tos = ((SetNwTosAction) sourceAction).getTos();
+            } else if (sourceAction instanceof SetNwTosActionCase) {
+                Integer tos = ((SetNwTosActionCase) sourceAction).getSetNwTosAction().getTos();
                 if (tos != null) {
                     targetAction.add(new SetNwTos(tos));
                 }
-            } else if (sourceAction instanceof SetTpDstAction) {
-                PortNumber port = ((SetTpDstAction) sourceAction).getPort();
+            } else if (sourceAction instanceof SetTpDstActionCase) {
+                PortNumber port = ((SetTpDstActionCase) sourceAction).getSetTpDstAction().getPort();
                 if (port != null) {
                     Integer portValue = port.getValue();
                     if (port.getValue() != null) {
                         targetAction.add(new SetTpDst(portValue));
                     }
                 }
-            } else if (sourceAction instanceof SetTpSrcAction) {
-                PortNumber port = ((SetTpSrcAction) sourceAction).getPort();
+            } else if (sourceAction instanceof SetTpSrcActionCase) {
+                PortNumber port = ((SetTpSrcActionCase) sourceAction).getSetTpSrcAction().getPort();
                 if (port != null) {
                     Integer portValue = port.getValue();
                     if (port.getValue() != null) {
                         targetAction.add(new SetTpSrc(portValue));
                     }
                 }
-            } else if (sourceAction instanceof SetVlanCfiAction) {
-                VlanCfi vlanCfi = ((SetVlanCfiAction) sourceAction).getVlanCfi();
+            } else if (sourceAction instanceof SetVlanCfiActionCase) {
+                VlanCfi vlanCfi = ((SetVlanCfiActionCase) sourceAction).getSetVlanCfiAction().getVlanCfi();
                 if (vlanCfi != null) {
                     Integer vlanCfiValue = vlanCfi.getValue();
                     if (vlanCfiValue != null) {
                         targetAction.add(new SetVlanCfi(vlanCfiValue));
                     }
                 }
-            } else if (sourceAction instanceof SetVlanIdAction) {
-                org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanID = ((SetVlanIdAction) sourceAction)
+            } else if (sourceAction instanceof SetVlanIdActionCase) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId vlanID = ((SetVlanIdActionCase) sourceAction).getSetVlanIdAction()
                         .getVlanId();
                 if (vlanID != null) {
                     Integer vlanIdValue = vlanID.getValue();
@@ -282,15 +283,15 @@ public class ToSalConversionsUtils {
                         targetAction.add(new SetVlanId(vlanIdValue));
                     }
                 }
-            } else if (sourceAction instanceof SetVlanPcpAction) {
-                VlanPcp vlanPcp = ((SetVlanPcpAction) sourceAction).getVlanPcp();
+            } else if (sourceAction instanceof SetVlanPcpActionCase) {
+                VlanPcp vlanPcp = ((SetVlanPcpActionCase) sourceAction).getSetVlanPcpAction().getVlanPcp();
                 if (vlanPcp != null) {
                     Short vlanPcpValue = vlanPcp.getValue();
                     if (vlanPcpValue != null) {
                         targetAction.add(new SetVlanPcp(vlanPcpValue));
                     }
                 }
-            } else if (sourceAction instanceof SwPathAction) {
+            } else if (sourceAction instanceof SwPathActionCase) {
                 targetAction.add(new SwPath());
             }
         }
@@ -315,7 +316,7 @@ public class ToSalConversionsUtils {
         return null;
     }
 
-    private static PushVlan pushVlanFrom(PushVlanAction pushVlanAction) {
+    private static PushVlan pushVlanFrom(org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanAction pushVlanAction) {
         final int tag;
         final int pcp;
         final int cfi;
index cb70174..b062b00 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match;
@@ -186,25 +187,25 @@ public class TestFromSalConversionsUtils {
 
     private void checkOdActions(
             List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions) {
-        checkOdAction(actions, FloodAction.class, false);
-        checkOdAction(actions, FloodAllAction.class, false);
-        checkOdAction(actions, HwPathAction.class, false);
-        checkOdAction(actions, LoopbackAction.class, false);
-        checkOdAction(actions, PopVlanAction.class, false);
-        checkOdAction(actions, PushVlanAction.class, true);
-        checkOdAction(actions, SetDlDstAction.class, true);
-        checkOdAction(actions, SetDlSrcAction.class, true);
-        checkOdAction(actions, SetDlTypeAction.class, true);
-        checkOdAction(actions, SetNwTosAction.class, true);
-        checkOdAction(actions, SetNwDstAction.class, true);
-        checkOdAction(actions, SetNwSrcAction.class, true);
-        checkOdAction(actions, SetNextHopAction.class, true);
-        checkOdAction(actions, SetTpDstAction.class, true);
-        checkOdAction(actions, SetTpSrcAction.class, true);
-        checkOdAction(actions, SetVlanCfiAction.class, true);
-        checkOdAction(actions, SetVlanIdAction.class, true);
-        checkOdAction(actions, SetVlanPcpAction.class, true);
-        checkOdAction(actions, SwPathAction.class, false);
+        checkOdAction(actions, FloodActionCase.class, false);
+        checkOdAction(actions, FloodAllActionCase.class, false);
+        checkOdAction(actions, HwPathActionCase.class, false);
+        checkOdAction(actions, LoopbackActionCase.class, false);
+        checkOdAction(actions, PopVlanActionCase.class, false);
+        checkOdAction(actions, PushVlanActionCase.class, true);
+        checkOdAction(actions, SetDlDstActionCase.class, true);
+        checkOdAction(actions, SetDlSrcActionCase.class, true);
+        checkOdAction(actions, SetDlTypeActionCase.class, true);
+        checkOdAction(actions, SetNwTosActionCase.class, true);
+        checkOdAction(actions, SetNwDstActionCase.class, true);
+        checkOdAction(actions, SetNwSrcActionCase.class, true);
+        checkOdAction(actions, SetNextHopActionCase.class, true);
+        checkOdAction(actions, SetTpDstActionCase.class, true);
+        checkOdAction(actions, SetTpSrcActionCase.class, true);
+        checkOdAction(actions, SetVlanCfiActionCase.class, true);
+        checkOdAction(actions, SetVlanIdActionCase.class, true);
+        checkOdAction(actions, SetVlanPcpActionCase.class, true);
+        checkOdAction(actions, SwPathActionCase.class, false);
     }
 
     private void checkOdAction(
@@ -216,26 +217,26 @@ public class TestFromSalConversionsUtils {
                     .getAction();
             if (cl.isInstance(innerAction)) {
                 numOfFoundActions++;
-                if (innerAction instanceof PushVlanAction) {
-                    assertEquals("Wrong value of cfi in PushVlanAction.", (Integer) 1, ((PushVlanAction) innerAction)
+                if (innerAction instanceof PushVlanActionCase) {
+                    assertEquals("Wrong value of cfi in PushVlanAction.", (Integer) 1, ((PushVlanActionCase) innerAction).getPushVlanAction()
                             .getCfi().getValue());
                     assertEquals("Wrong value of pcp in PushVlanAction.", (Integer) 7,
-                            ((PushVlanAction) innerAction).getPcp());
+                            ((PushVlanActionCase) innerAction).getPushVlanAction().getPcp());
                     assertEquals("Wrong value of tag in PushVlanAction.", (Integer) 0x8100,
-                            ((PushVlanAction) innerAction).getTag());
+                            ((PushVlanActionCase) innerAction).getPushVlanAction().getTag());
                     assertEquals("Wrong value of vlad ID in PushVlanAction.", (Integer) 4095,
-                            ((PushVlanAction) innerAction).getVlanId().getValue());
-                } else if (innerAction instanceof SetDlDstAction) {
+                            ((PushVlanActionCase) innerAction).getPushVlanAction().getVlanId().getValue());
+                } else if (innerAction instanceof SetDlDstActionCase) {
                     assertEquals("Wrong MAC destination address in SetDlDstAction.", "ff:ee:dd:cc:bb:aa", 
-                            ((SetDlDstAction) innerAction).getAddress().getValue());
-                } else if (innerAction instanceof SetDlSrcAction) {
+                            ((SetDlDstActionCase) innerAction).getSetDlDstAction().getAddress().getValue());
+                } else if (innerAction instanceof SetDlSrcActionCase) {
                     assertEquals("Wrong MAC source address in SetDlDstAction.", "ff:ee:dd:cc:bb:aa", 
-                            ((SetDlSrcAction) innerAction).getAddress().getValue());
-                } else if (innerAction instanceof SetDlTypeAction) {
+                            ((SetDlSrcActionCase) innerAction).getSetDlSrcAction().getAddress().getValue());
+                } else if (innerAction instanceof SetDlTypeActionCase) {
                     assertEquals("Wrong data link type in SetDlTypeAction.", (long) 513,
-                            (long) ((SetDlTypeAction) innerAction).getDlType().getValue());
-                } else if (innerAction instanceof SetNextHopAction) {
-                    Address address = ((SetNextHopAction) innerAction).getAddress();
+                            (long) ((SetDlTypeActionCase) innerAction).getSetDlTypeAction().getDlType().getValue());
+                } else if (innerAction instanceof SetNextHopActionCase) {
+                    Address address = ((SetNextHopActionCase) innerAction).getSetNextHopAction().getAddress();
                     boolean ipv4AddressFound = false;
                     if (address instanceof Ipv4) {
                         ipv4AddressFound = true;
@@ -243,10 +244,10 @@ public class TestFromSalConversionsUtils {
                                 .getIpv4Address().getValue());
                     }
                     assertTrue("Ipv4 address wasn't found.", ipv4AddressFound);
-                } else if (innerAction instanceof SetNwTosAction) {
-                    assertEquals("Wrong TOS in SetNwTosAction.", (Integer) 63, ((SetNwTosAction) innerAction).getTos());
-                } else if (innerAction instanceof SetNwDstAction) {
-                    Address address = ((SetNwDstAction) innerAction).getAddress();
+                } else if (innerAction instanceof SetNwTosActionCase) {
+                    assertEquals("Wrong TOS in SetNwTosAction.", (Integer) 63, ((SetNwTosActionCase) innerAction).getSetNwTosAction().getTos());
+                } else if (innerAction instanceof SetNwDstActionCase) {
+                    Address address = ((SetNwDstActionCase) innerAction).getSetNwDstAction().getAddress();
                     boolean ipv4AddressFound = false;
                     if (address instanceof Ipv4) {
                         ipv4AddressFound = true;
@@ -254,8 +255,8 @@ public class TestFromSalConversionsUtils {
                                 .getIpv4Address().getValue());
                     }
                     assertTrue("Ipv4 address wasn't found.", ipv4AddressFound);
-                } else if (innerAction instanceof SetNwSrcAction) {
-                    Address address = ((SetNwSrcAction) innerAction).getAddress();
+                } else if (innerAction instanceof SetNwSrcActionCase) {
+                    Address address = ((SetNwSrcActionCase) innerAction).getSetNwSrcAction().getAddress();
                     boolean ipv4AddressFound = false;
                     if (address instanceof Ipv4) {
                         ipv4AddressFound = true;
@@ -263,21 +264,21 @@ public class TestFromSalConversionsUtils {
                                 .getIpv4Address().getValue());
                     }
                     assertTrue("Ipv4 address wasn't found.", ipv4AddressFound);
-                } else if (innerAction instanceof SetTpDstAction) {
+                } else if (innerAction instanceof SetTpDstActionCase) {
                     assertEquals("Port number is incorrect in SetTpDstAction.", (Integer) 65534,
-                            ((SetTpDstAction) innerAction).getPort().getValue());
-                } else if (innerAction instanceof SetTpSrcAction) {
+                            ((SetTpDstActionCase) innerAction).getSetTpDstAction().getPort().getValue());
+                } else if (innerAction instanceof SetTpSrcActionCase) {
                     assertEquals("Port number is incorrect in SetTpSrcAction.", (Integer) 65535,
-                            ((SetTpSrcAction) innerAction).getPort().getValue());
-                } else if (innerAction instanceof SetVlanCfiAction) {
+                            ((SetTpSrcActionCase) innerAction).getSetTpSrcAction().getPort().getValue());
+                } else if (innerAction instanceof SetVlanCfiActionCase) {
                     assertEquals("Vlan cfi number is incorrect in SetVlanCfiAction.", (Integer) 1,
-                            ((SetVlanCfiAction) innerAction).getVlanCfi().getValue());
-                } else if (innerAction instanceof SetVlanIdAction) {
+                            ((SetVlanCfiActionCase) innerAction).getSetVlanCfiAction().getVlanCfi().getValue());
+                } else if (innerAction instanceof SetVlanIdActionCase) {
                     assertEquals("Vlan id number is incorrect in SetVlanIdAction.", (Integer) 4095,
-                            ((SetVlanIdAction) innerAction).getVlanId().getValue());
-                } else if (innerAction instanceof SetVlanPcpAction) {
+                            ((SetVlanIdActionCase) innerAction).getSetVlanIdAction().getVlanId().getValue());
+                } else if (innerAction instanceof SetVlanPcpActionCase) {
                     assertEquals("Vlan pcp number is incorrect in SetVlanPcpAction.", new Short((short) 7),
-                            ((SetVlanPcpAction) innerAction).getVlanPcp().getValue());
+                            ((SetVlanPcpActionCase) innerAction).getSetVlanPcpAction().getVlanPcp().getValue());
                 }
             }
         }
index 97e1660..793f3cc 100644 (file)
@@ -29,6 +29,34 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.Flow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.action._case.FloodActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.hw.path.action._case.HwPathActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.loopback.action._case.LoopbackActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.dst.action._case.SetDlDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.src.action._case.SetDlSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.dl.type.action._case.SetDlTypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.next.hop.action._case.SetNextHopActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.tos.action._case.SetNwTosActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.dst.action._case.SetTpDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.tp.src.action._case.SetTpSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.cfi.action._case.SetVlanCfiActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
+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.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
@@ -54,8 +82,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+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 com.google.common.net.InetAddresses;
 
@@ -282,31 +311,31 @@ public class TestToSalConversionsUtils {
     private Instructions prepareOdActions() {
         List<Action> odActions = new ArrayList<>();
 
-        ControllerActionBuilder controllerActionBuilder = new ControllerActionBuilder();
-        DropActionBuilder dropActionBuilder = new DropActionBuilder();
-        FloodActionBuilder floodActionBuilder = new FloodActionBuilder();
-        FloodAllActionBuilder floodAllActionBuilder = new FloodAllActionBuilder();
-        HwPathActionBuilder hwPathActionBuilder = new HwPathActionBuilder();
-        LoopbackActionBuilder loopbackActionBuilder = new LoopbackActionBuilder();
-        OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
-        PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
-        PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
-        PushMplsActionBuilder pushMplsActionBuilder = new PushMplsActionBuilder();
-        PushPbbActionBuilder pushPbbActionBuilder = new PushPbbActionBuilder();
-        PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder();
-        SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder();
-        SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder();
-        SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
-        SetMplsTtlActionBuilder setMplsTtlActionBuilder = new SetMplsTtlActionBuilder();
-        SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
-        SetNwTtlActionBuilder setNwTtlActionBuilder = new SetNwTtlActionBuilder();
-        SetQueueActionBuilder setQueueActionBuilder = new SetQueueActionBuilder();
-        SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
-        SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
-        SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
-        SetVlanIdActionBuilder setVlanIdActionBuilder = new SetVlanIdActionBuilder();
-        SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder();
-        SwPathActionBuilder swPathActionBuilder = new SwPathActionBuilder();
+        ControllerActionCaseBuilder controllerActionBuilder = new ControllerActionCaseBuilder();
+        DropActionCaseBuilder dropActionBuilder = new DropActionCaseBuilder();
+        FloodActionCaseBuilder floodActionBuilder = new FloodActionCaseBuilder();
+        FloodAllActionCaseBuilder floodAllActionBuilder = new FloodAllActionCaseBuilder();
+        HwPathActionCaseBuilder hwPathActionBuilder = new HwPathActionCaseBuilder();
+        LoopbackActionCaseBuilder loopbackActionBuilder = new LoopbackActionCaseBuilder();
+        OutputActionCaseBuilder outputActionBuilder = new OutputActionCaseBuilder();
+        PopMplsActionCaseBuilder popMplsActionBuilder = new PopMplsActionCaseBuilder();
+        PopVlanActionCaseBuilder popVlanActionBuilder = new PopVlanActionCaseBuilder();
+        PushMplsActionCaseBuilder pushMplsActionBuilder = new PushMplsActionCaseBuilder();
+        PushPbbActionCaseBuilder pushPbbActionBuilder = new PushPbbActionCaseBuilder();
+        PushVlanActionCaseBuilder pushVlanActionBuilder = new PushVlanActionCaseBuilder();
+        SetDlDstActionCaseBuilder setDlDstActionBuilder = new SetDlDstActionCaseBuilder();
+        SetDlSrcActionCaseBuilder setDlSrcActionBuilder = new SetDlSrcActionCaseBuilder();
+        SetDlTypeActionCaseBuilder setDlTypeActionBuilder = new SetDlTypeActionCaseBuilder();
+        SetMplsTtlActionCaseBuilder setMplsTtlActionBuilder = new SetMplsTtlActionCaseBuilder();
+        SetNwTosActionCaseBuilder setNwTosActionBuilder = new SetNwTosActionCaseBuilder();
+        SetNwTtlActionCaseBuilder setNwTtlActionBuilder = new SetNwTtlActionCaseBuilder();
+        SetQueueActionCaseBuilder setQueueActionBuilder = new SetQueueActionCaseBuilder();
+        SetTpDstActionCaseBuilder setTpDstActionBuilder = new SetTpDstActionCaseBuilder();
+        SetTpSrcActionCaseBuilder setTpSrcActionBuilder = new SetTpSrcActionCaseBuilder();
+        SetVlanCfiActionCaseBuilder setVlanCfiActionBuilder = new SetVlanCfiActionCaseBuilder();
+        SetVlanIdActionCaseBuilder setVlanIdActionBuilder = new SetVlanIdActionCaseBuilder();
+        SetVlanPcpActionCaseBuilder setVlanPcpActionBuilder = new SetVlanPcpActionCaseBuilder();
+        SwPathActionCaseBuilder swPathActionBuilder = new SwPathActionCaseBuilder();
 
         prepareActionOutput(outputActionBuilder);
         prepareActionPushVlan(pushVlanActionBuilder);
@@ -350,7 +379,7 @@ public class TestToSalConversionsUtils {
         odActions.add(new ActionBuilder().setAction(swPathActionBuilder.build()).build());
 
         
-        ApplyActions innerInst = new ApplyActionsBuilder().setAction(odActions).build();
+        ApplyActionsCase innerInst = new ApplyActionsCaseBuilder().setApplyActions(new ApplyActionsBuilder().setAction(odActions).build()).build();
         Instruction applyActions = new InstructionBuilder().setInstruction(innerInst).build();
         List<Instruction> instructions = Collections.singletonList(applyActions );
         InstructionsBuilder instBuilder = new InstructionsBuilder();
@@ -360,64 +389,77 @@ public class TestToSalConversionsUtils {
         return instBuilder.build();
     }
 
-    private void prepareActionSetVlanPcp(SetVlanPcpActionBuilder setVlanPcpActionBuilder) {
+    private void prepareActionSetVlanPcp(SetVlanPcpActionCaseBuilder wrapper) {
+        SetVlanPcpActionBuilder setVlanPcpActionBuilder = new SetVlanPcpActionBuilder();
         setVlanPcpActionBuilder.setVlanPcp(new VlanPcp((short) 7));
+        wrapper.setSetVlanPcpAction(setVlanPcpActionBuilder.build());
     }
 
-    private void prepareActionSetVladId(SetVlanIdActionBuilder setVlanIdActionBuilder) {
+    private void prepareActionSetVladId(SetVlanIdActionCaseBuilder wrapper) {
+        SetVlanIdActionBuilder setVlanIdActionBuilder = new SetVlanIdActionBuilder();
         setVlanIdActionBuilder.setVlanId(new VlanId(4095));
+        wrapper.setSetVlanIdAction(setVlanIdActionBuilder.build());
     }
 
-    private void prepareActionSetVlanCfi(SetVlanCfiActionBuilder setVlanCfiActionBuilder) {
+    private void prepareActionSetVlanCfi(SetVlanCfiActionCaseBuilder wrapper) {
+        SetVlanCfiActionBuilder setVlanCfiActionBuilder = new SetVlanCfiActionBuilder();
         setVlanCfiActionBuilder.setVlanCfi(new VlanCfi(1));
+        wrapper.setSetVlanCfiAction(setVlanCfiActionBuilder.build());
     }
 
-    private void prepareActionSetTpDst(SetTpDstActionBuilder setTpDstActionBuilder) {
+    private void prepareActionSetTpDst(SetTpDstActionCaseBuilder wrapper) {
+        SetTpDstActionBuilder setTpDstActionBuilder = new SetTpDstActionBuilder();
         setTpDstActionBuilder.setPort(new PortNumber(65535));
+        wrapper.setSetTpDstAction(setTpDstActionBuilder.build());
     }
 
-    private void prepareActionSetTpSrc(SetTpSrcActionBuilder setTpSrcActionBuilder) {
+    private void prepareActionSetTpSrc(SetTpSrcActionCaseBuilder wrapper) {
+        SetTpSrcActionBuilder setTpSrcActionBuilder = new SetTpSrcActionBuilder();
         setTpSrcActionBuilder.setPort(new PortNumber(65535));
+        wrapper.setSetTpSrcAction(setTpSrcActionBuilder.build());
     }
 
-    private void prepareActionSetNwTos(SetNwTosActionBuilder setNwTosActionBuilder) {
+    private void prepareActionSetNwTos(SetNwTosActionCaseBuilder wrapper) {
+        SetNwTosActionBuilder setNwTosActionBuilder = new SetNwTosActionBuilder();
         setNwTosActionBuilder.setTos(63);
+        wrapper.setSetNwTosAction(setNwTosActionBuilder.build());
     }
 
     private void prepareActionSetNwSrc(List<Action> odActions) {
         // test case for IPv4
         SetNwSrcActionBuilder setNwSrcActionBuilderIpv4 = new SetNwSrcActionBuilder();
         setNwSrcActionBuilderIpv4.setAddress(prapareIpv4Address("192.168.100.102"));
-        odActions.add(new ActionBuilder().setAction(setNwSrcActionBuilderIpv4.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwSrcActionBuilderIpv4.build()).build()).build());
 
         // test case for IPv6
         SetNwSrcActionBuilder setNwSrcActionBuilderIpv6 = new SetNwSrcActionBuilder();
         setNwSrcActionBuilderIpv6.setAddress(prapareIpv6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7336"));
-        odActions.add(new ActionBuilder().setAction(setNwSrcActionBuilderIpv6.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwSrcActionBuilderIpv6.build()).build()).build());
     }
 
     private void prepareActionSetNwDst(List<Action> odActions) {
         // test case for IPv4
+        
         SetNwDstActionBuilder setNwDstActionBuilderIpv4 = new SetNwDstActionBuilder();
         setNwDstActionBuilderIpv4.setAddress(prapareIpv4Address("192.168.100.101"));
-        odActions.add(new ActionBuilder().setAction(setNwDstActionBuilderIpv4.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilderIpv4.build()).build()).build());
 
         // test case for IPv6
         SetNwDstActionBuilder setNwDstActionBuilderIpv6 = new SetNwDstActionBuilder();
         setNwDstActionBuilderIpv6.setAddress(prapareIpv6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7335"));
-        odActions.add(new ActionBuilder().setAction(setNwDstActionBuilderIpv6.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilderIpv6.build()).build()).build());
     }
 
     private void prepareActionNextHop(List<Action> odActions) {
         // test case for IPv4
         SetNextHopActionBuilder setNextHopActionBuilderIpv4 = new SetNextHopActionBuilder();
         setNextHopActionBuilderIpv4.setAddress(prapareIpv4Address("192.168.100.100"));
-        odActions.add(new ActionBuilder().setAction(setNextHopActionBuilderIpv4.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilderIpv4.build()).build()).build());
 
         // test case for IPv6
         SetNextHopActionBuilder setNextHopActionBuilderIpv6 = new SetNextHopActionBuilder();
         setNextHopActionBuilderIpv6.setAddress(prapareIpv6Address("2001:0db8:85a3:0000:0000:8a2e:0370:7334"));
-        odActions.add(new ActionBuilder().setAction(setNextHopActionBuilderIpv6.build()).build());
+        odActions.add(new ActionBuilder().setAction(new SetNextHopActionCaseBuilder().setSetNextHopAction(setNextHopActionBuilderIpv6.build()).build()).build());
     }
 
     private Address prapareIpv4Address(String ipv4Address) {
@@ -432,27 +474,37 @@ public class TestToSalConversionsUtils {
         return ipv6Builder.build();
     }
 
-    private void prepareActionSetDlType(SetDlTypeActionBuilder setDlTypeActionBuilder) {
+    private void prepareActionSetDlType(SetDlTypeActionCaseBuilder wrapper) {
+        SetDlTypeActionBuilder setDlTypeActionBuilder = new SetDlTypeActionBuilder();
         setDlTypeActionBuilder.setDlType(new EtherType(513l));
+        wrapper.setSetDlTypeAction(setDlTypeActionBuilder.build());
     }
 
-    private void prepareActionSetDlSrc(SetDlSrcActionBuilder setDlSrcActionBuilder) {
+    private void prepareActionSetDlSrc(SetDlSrcActionCaseBuilder wrapper) {
+        SetDlSrcActionBuilder setDlSrcActionBuilder = new SetDlSrcActionBuilder();
         setDlSrcActionBuilder.setAddress(new MacAddress("24:77:03:7C:C5:F1"));
+        wrapper.setSetDlSrcAction(setDlSrcActionBuilder.build());
     }
 
-    private void prepareActionSetDlDst(SetDlDstActionBuilder setDlDstActionBuilder) {
+    private void prepareActionSetDlDst(SetDlDstActionCaseBuilder wrapper) {
+        SetDlDstActionBuilder setDlDstActionBuilder = new SetDlDstActionBuilder();
         setDlDstActionBuilder.setAddress(new MacAddress("3C:A9:F4:00:E0:C8"));
+        wrapper.setSetDlDstAction(setDlDstActionBuilder.build());
     }
 
-    private void prepareActionPushVlan(PushVlanActionBuilder pushVlanActionBuilder) {
+    private void prepareActionPushVlan(PushVlanActionCaseBuilder wrapper) {
+        PushVlanActionBuilder pushVlanActionBuilder = new PushVlanActionBuilder();
         pushVlanActionBuilder.setPcp(7); // 3 bits
         pushVlanActionBuilder.setCfi(new VlanCfi(1)); // 1 bit
         pushVlanActionBuilder.setVlanId(new VlanId(4095));
         pushVlanActionBuilder.setTag(0x8100); // 12 bit
+        wrapper.setPushVlanAction(pushVlanActionBuilder.build());
     }
 
-    private void prepareActionOutput(OutputActionBuilder outputActionBuilder) {       
+    private void prepareActionOutput(OutputActionCaseBuilder wrapper) {
+        OutputActionBuilder outputActionBuilder = new OutputActionBuilder();
         outputActionBuilder.setOutputNodeConnector(new Uri("uri1"));
+        wrapper.setOutputAction(outputActionBuilder.build());
     }
 
     private Match prepOdMatch(MtchType mt) {
index 597483e..e2948fd 100644 (file)
@@ -23,7 +23,7 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>
-                        <Bundle-Activator>org.opendaylight.controller.forwardingrulesmanager.consumer.impl.FRMConsumerImpl</Bundle-Activator>
+                        <Bundle-Activator>org.opendaylight.controller.frm.FRMActivator</Bundle-Activator>
                     </instructions>
                 </configuration>
             </plugin>
index 84b3e53..ab2e19e 100644 (file)
@@ -11,29 +11,23 @@ import org.opendaylight.controller.sal.utils.NetUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
 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.action.ControllerAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpAction;
-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.action.ControllerActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTable;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.Meter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatch;
@@ -43,6 +37,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ClearActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.MeterCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
 
 public class FRMUtil {
     protected static final Logger logger = LoggerFactory.getLogger(FRMUtil.class);
@@ -207,15 +208,15 @@ public class FRMUtil {
         for (Action curaction : actions) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action action = curaction
                     .getAction();
-            if (action instanceof ControllerAction) {
-                Integer length = ((ControllerAction) action).getMaxLength();
+            if (action instanceof ControllerActionCase) {
+                Integer length = ((ControllerActionCase) action).getControllerAction().getMaxLength();
                 if (length < 0 || length > 65294) {
                     logger.error("Controller: MaxLength is not valid");
                     return false;
                 }
-            } else if (action instanceof OutputAction) {
-                Integer length = ((OutputAction) action).getMaxLength();
-                Uri outputnodeconnector = ((OutputAction) action).getOutputNodeConnector();
+            } else if (action instanceof OutputActionCase) {
+                Integer length = ((OutputActionCase) action).getOutputAction().getMaxLength();
+                Uri outputnodeconnector = ((OutputActionCase) action).getOutputAction().getOutputNodeConnector();
                 if (length < 0 || length > 65294) {
                     logger.error("OutputAction: MaxLength is not valid");
                     return false;
@@ -240,62 +241,62 @@ public class FRMUtil {
                     }
 
                 }
-            } else if (action instanceof PushMplsAction) {
-                Integer ethertype = ((PushMplsAction) action).getEthernetType();
+            } else if (action instanceof PushMplsActionCase) {
+                Integer ethertype = ((PushMplsActionCase) action).getPushMplsAction().getEthernetType();
                 if (ethertype != null && ethertype != 0x8847 && ethertype != 0x8848) {
                     logger.error("Ether Type is not valid for PushMplsAction");
                     return false;
                 }
-            } else if (action instanceof PushPbbAction) {
-                Integer ethertype = ((PushPbbAction) action).getEthernetType();
+            } else if (action instanceof PushPbbActionCase) {
+                Integer ethertype = ((PushPbbActionCase) action).getPushPbbAction().getEthernetType();
                 if (ethertype != null && ethertype != 0x88E7) {
                     logger.error("Ether type is not valid for PushPbbAction");
                     return false;
                 }
-            } else if (action instanceof PushVlanAction) {
-                Integer ethertype = ((PushVlanAction) action).getEthernetType();
+            } else if (action instanceof PushVlanActionCase) {
+                Integer ethertype = ((PushVlanActionCase) action).getPushVlanAction().getEthernetType();
                 if (ethertype != null && ethertype != 0x8100 && ethertype != 0x88a8) {
                     logger.error("Ether Type is not valid for PushVlanAction");
                     return false;
                 }
-            } else if (action instanceof SetDlDstAction) {
-                MacAddress address = ((SetDlDstAction) action).getAddress();
+            } else if (action instanceof SetDlDstActionCase || action instanceof SetDlSrcActionCase) {
+                MacAddress address = ((SetDlDstActionCase) action).getSetDlDstAction().getAddress();
                 if (address != null && !isL2AddressValid(address.getValue())) {
                     logger.error("SetDlDstAction: Address not valid");
                     return false;
                 }
-            } else if (action instanceof SetDlSrcAction) {
-                MacAddress address = ((SetDlSrcAction) action).getAddress();
+            } else if (action instanceof SetDlSrcActionCase) {
+                MacAddress address = ((SetDlSrcActionCase) action).getSetDlSrcAction().getAddress();
                 if (address != null && !isL2AddressValid(address.getValue())) {
                     logger.error("SetDlSrcAction: Address not valid");
                     return false;
                 }
-            } else if (action instanceof SetQueueAction) {
-                String queue = ((SetQueueAction) action).getQueue();
+            } else if (action instanceof SetQueueActionCase) {
+                String queue = ((SetQueueActionCase) action).getSetQueueAction().getQueue();
                 if (queue != null && !isQueueValid(queue)) {
                     logger.error("Queue Id not valid");
                     return false;
                 }
-            } else if (action instanceof SetTpDstAction) {
-                PortNumber port = ((SetTpDstAction) action).getPort();
+            } else if (action instanceof SetTpDstActionCase) {
+                PortNumber port = ((SetTpDstActionCase) action).getSetTpDstAction().getPort();
                 if (port != null && !isPortValid(port)) {
                     logger.error("Port not valid");
                 }
-            } else if (action instanceof SetTpSrcAction) {
-                PortNumber port = ((SetTpSrcAction) action).getPort();
+            } else if (action instanceof SetTpSrcActionCase) {
+                PortNumber port = ((SetTpSrcActionCase) action).getSetTpSrcAction().getPort();
                 if (port != null && !isPortValid(port)) {
                     logger.error("Port not valid");
                 }
-            } else if (action instanceof SetVlanIdAction) {
-                VlanId vlanid = ((SetVlanIdAction) action).getVlanId();
-                if (vlanid != null && !isVlanIdValid(vlanid.getValue().toString())) {
-                    logger.error("Vlan ID is not in the range 0 - 4095");
+            } else if (action instanceof SetVlanIdActionCase) {
+                VlanId vlanid = ((SetVlanIdActionCase) action).getSetVlanIdAction().getVlanId();
+                if (vlanid != null && !isVlanIdValid(vlanid.toString())) {
+                    logger.error("Vlan ID %s is not in the range 0 - 4095");
                     return false;
                 }
-            } else if (action instanceof SetVlanPcpAction) {
-                VlanPcp vlanpcp = ((SetVlanPcpAction) action).getVlanPcp();
-                if (vlanpcp != null && !isVlanPriorityValid(vlanpcp.getValue().toString())) {
-                    logger.error("Vlan priority is not in the range 0 - 7");
+            } else if (action instanceof SetVlanPcpActionCase) {
+                VlanPcp vlanpcp = ((SetVlanPcpActionCase) action).getSetVlanPcpAction().getVlanPcp();
+                if (vlanpcp != null && !isVlanPriorityValid(vlanpcp.toString())) {
+                    logger.error("Vlan priority %s is not in the range 0 - 7");
                     return false;
                 }
             }
@@ -315,35 +316,35 @@ public class FRMUtil {
         for (Instruction instruction : instructionsList) {
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curInstruction = instruction
                     .getInstruction();
-            if (curInstruction instanceof GoToTable) {
+            if (curInstruction instanceof GoToTableCase) {
 
-                Short tableid = ((GoToTable) curInstruction).getTableId();
+                Short tableid = ((GoToTableCase) curInstruction).getGoToTable().getTableId();
                 if (tableid < 0) {
                     logger.error("table id is not valid");
                     return false;
                 }
             }
 
-            else if (curInstruction instanceof WriteActions) {
+            else if (curInstruction instanceof WriteActionsCase) {
 
-                List<Action> action = ((WriteActions) curInstruction).getAction();
+                List<Action> action = ((WriteActionsCase) curInstruction).getWriteActions().getAction();
                 validateActions(action);
 
             }
 
-            else if (curInstruction instanceof ApplyActions) {
-                List<Action> action = ((ApplyActions) curInstruction).getAction();
+            else if (curInstruction instanceof ApplyActionsCase) {
+                List<Action> action = ((ApplyActionsCase) curInstruction).getApplyActions().getAction();
                 validateActions(action);
             }
 
-            else if (curInstruction instanceof ClearActions) {
-                List<Action> action = ((ClearActions) curInstruction).getAction();
+            else if (curInstruction instanceof ClearActionsCase) {
+                List<Action> action = ((ClearActionsCase) curInstruction).getClearActions().getAction();
                 validateActions(action);
             }
 
-            else if (curInstruction instanceof Meter) {
+            else if (curInstruction instanceof MeterCase) {
 
-                String meter = ((Meter) curInstruction).getMeter();
+                MeterId meter = ((MeterCase) curInstruction).getMeter().getMeterId();
                 if (meter != null && !isValidMeter(meter)) {
                     logger.error("Meter Id is not valid");
                     return false;
@@ -355,7 +356,7 @@ public class FRMUtil {
         return true;
     }
 
-    public static boolean isValidMeter(String meter) {
+    public static boolean isValidMeter(MeterId meter) {
         // TODO
         return true;
     }
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/AbstractTransaction.xtend
new file mode 100644 (file)
index 0000000..9f45a11
--- /dev/null
@@ -0,0 +1,99 @@
+package org.opendaylight.controller.frm
+
+import java.util.Collections
+import java.util.HashSet
+import java.util.Map.Entry
+import java.util.Set
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.controller.sal.common.util.Rpcs
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yangtools.yang.common.RpcError
+
+abstract class AbstractTransaction implements DataCommitTransaction<InstanceIdentifier<?extends DataObject>, DataObject> {
+        
+    @Property
+    val DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        _modification = modification;
+    }
+    
+    def void validate() throws IllegalStateException
+    
+    override finish() throws IllegalStateException {
+        validate()
+        callRpcs();
+        return Rpcs.getRpcResult(true, null, Collections.<RpcError>emptySet());     
+    }
+    
+    override getModification() {
+        return _modification;
+    }
+    
+    override rollback() throws IllegalStateException {
+        rollbackRpcs();
+        return Rpcs.getRpcResult(true, null, Collections.<RpcError>emptySet());
+    }
+    
+    def private callRpcs() {
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> createdEntries = _modification.getCreatedConfigurationData().entrySet();
+
+        /*
+         * This little dance is because updatedEntries contains both created and modified entries
+         * The reason I created a new HashSet is because the collections we are returned are immutable.
+         */
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> updatedEntries = new HashSet<Entry<InstanceIdentifier<? extends DataObject>, DataObject>>();
+        updatedEntries.addAll(_modification.getUpdatedConfigurationData().entrySet());
+        updatedEntries.removeAll(createdEntries);
+
+        val Set<InstanceIdentifier<? extends DataObject>> removeEntriesInstanceIdentifiers = _modification.getRemovedConfigurationData();
+        for (Entry<InstanceIdentifier<? extends DataObject >, DataObject> entry : createdEntries) {
+            add(entry.key,entry.value);
+        }
+        for (Entry<InstanceIdentifier<?>, DataObject> entry : updatedEntries) {
+                val originalFlow = _modification.originalConfigurationData.get(entry.key);
+                val updatedFlow = entry.value
+                update(entry.key, originalFlow ,updatedFlow);
+        }
+
+        for (InstanceIdentifier<?> instanceId : removeEntriesInstanceIdentifiers ) {
+            val removeValue = _modification.getOriginalConfigurationData.get(instanceId);
+                remove(instanceId,removeValue);
+        }
+    }
+    
+    def void remove(InstanceIdentifier<?> identifier, DataObject remove)
+    
+    def void update(InstanceIdentifier<?> identifier, DataObject original, DataObject update)
+    
+    def void add(InstanceIdentifier<?> identifier, DataObject add)
+    
+    def private rollbackRpcs() {
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> createdEntries = _modification.getCreatedConfigurationData().entrySet();
+
+        /*
+         * This little dance is because updatedEntries contains both created and modified entries
+         * The reason I created a new HashSet is because the collections we are returned are immutable.
+         */
+        val Set<Entry<InstanceIdentifier<? extends DataObject>, DataObject>> updatedEntries = new HashSet<Entry<InstanceIdentifier<? extends DataObject>, DataObject>>();
+        updatedEntries.addAll(_modification.getUpdatedConfigurationData().entrySet());
+        updatedEntries.removeAll(createdEntries);
+
+        val Set<InstanceIdentifier<? >> removeEntriesInstanceIdentifiers = _modification.getRemovedConfigurationData();
+        for (Entry<InstanceIdentifier<?>, DataObject> entry : createdEntries) {
+            remove(entry.key,entry.value); // because we are rolling back, remove what we would have added.            
+        }
+        for (Entry<InstanceIdentifier<?>, DataObject> entry : updatedEntries) {
+            val originalFlow = _modification.originalConfigurationData.get(entry.key);
+            val updatedFlow = entry.value
+            update(entry.key, updatedFlow ,originalFlow);// because we are rolling back, replace the updated with the original
+        }
+
+        for (InstanceIdentifier<?> instanceId : removeEntriesInstanceIdentifiers ) {
+            val removeValue = _modification.getOriginalConfigurationData.get(instanceId);
+            add(instanceId,removeValue);// because we are rolling back, add what we would have removed.
+        }
+    }    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/FRMActivator.xtend
new file mode 100644 (file)
index 0000000..8ec9d79
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * 
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.controller.frm
+
+import org.opendaylight.controller.frm.flow.FlowProvider
+import org.opendaylight.controller.frm.group.GroupProvider
+import org.opendaylight.controller.frm.meter.MeterProvider
+import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.osgi.framework.BundleContext
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService
+
+class FRMActivator extends AbstractBindingAwareProvider {
+
+    static var FlowProvider provider = new FlowProvider();
+    static var GroupProvider groupProvider = new GroupProvider();
+    static var MeterProvider meterProvider = new MeterProvider();
+
+    override onSessionInitiated(ProviderContext session) {
+        provider.dataService = session.getSALService(DataProviderService)
+        provider.salFlowService = session.getRpcService(SalFlowService);
+        provider.start();
+        
+        groupProvider.dataService = session.getSALService(DataProviderService)
+        groupProvider.salGroupService = session.getRpcService(SalGroupService)
+        groupProvider.start();
+        
+        meterProvider.dataService = session.getSALService(DataProviderService)
+        meterProvider.salMeterService = session.getRpcService(SalMeterService)
+        meterProvider.start();
+    }
+
+    override protected stopImpl(BundleContext context) {
+        provider.close();
+        groupProvider.close();
+        meterProvider.close();
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowCommitHandler.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowCommitHandler.xtend
new file mode 100644 (file)
index 0000000..03095fa
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.frm.flow
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+
+class FlowCommitHandler implements DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> {
+       
+    @Property
+    val SalFlowService salFlowService;
+    
+    new(SalFlowService manager) {
+        _salFlowService = manager;
+    }
+    
+    override requestCommit(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        return new FlowTransaction(modification,salFlowService);
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowProvider.xtend
new file mode 100644 (file)
index 0000000..e664c7b
--- /dev/null
@@ -0,0 +1,50 @@
+package org.opendaylight.controller.frm.flow
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
+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.table.Flow
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+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.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.slf4j.LoggerFactory
+
+class FlowProvider implements AutoCloseable {
+    
+    @Property
+    DataProviderService dataService;
+    
+    @Property
+    SalFlowService salFlowService;
+    
+    FlowCommitHandler commitHandler
+
+    Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject>> commitHandlerRegistration;
+    
+    static val LOG = LoggerFactory.getLogger(FlowProvider);
+    
+    def void start() {
+        commitHandler = new FlowCommitHandler(salFlowService)
+        val InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder(Nodes)
+            .child(Node)
+            .augmentation(FlowCapableNode)
+            .child(Table)
+            .child(Flow)
+            .toInstance();
+        commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler);
+        LOG.info("Flow Config Provider started.");
+    }
+
+    protected def startChange() {
+        return dataService.beginTransaction;
+    }
+    
+    override close() throws Exception {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransaction.xtend
new file mode 100644 (file)
index 0000000..5203d3c
--- /dev/null
@@ -0,0 +1,72 @@
+package org.opendaylight.controller.frm.flow
+
+import org.opendaylight.controller.frm.AbstractTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+
+class FlowTransaction extends AbstractTransaction {
+    
+    @Property
+    val SalFlowService salFlowService;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalFlowService salFlowService) {
+        super(modification)
+        _salFlowService = salFlowService;
+    }
+    
+    override remove(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Flow) {
+            val flow = (obj as Flow)
+            val tableInstanceId = instanceId.firstIdentifierOf(Table);
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new RemoveFlowInputBuilder(flow);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowTable(new FlowTableRef(tableInstanceId));
+            _salFlowService.removeFlow(builder.build());            
+        }
+    }
+    
+    override update(InstanceIdentifier<?> instanceId, DataObject originalObj, DataObject updatedObj) {
+        if(originalObj instanceof Flow && updatedObj instanceof Flow) {
+            val originalFlow = (originalObj as Flow)
+            val updatedFlow = (updatedObj as Flow)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new UpdateFlowInputBuilder();
+            builder.setNode(new NodeRef(nodeInstanceId));
+            val ufb = new UpdatedFlowBuilder(updatedFlow);
+            builder.setUpdatedFlow((ufb.build()));
+            val ofb = new OriginalFlowBuilder(originalFlow);
+            builder.setOriginalFlow(ofb.build());      
+            _salFlowService.updateFlow(builder.build());
+           
+        }
+    }
+    
+    override add(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Flow) {
+            val flow = (obj as Flow)
+            val tableInstanceId = instanceId.firstIdentifierOf(Table);
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new AddFlowInputBuilder(flow);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            builder.setFlowTable(new FlowTableRef(tableInstanceId));
+            _salFlowService.addFlow(builder.build());            
+        }
+    }
+    
+    override validate() throws IllegalStateException {
+        FlowTransactionValidator.validate(this)
+    }  
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransactionValidator.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/flow/FlowTransactionValidator.java
new file mode 100644 (file)
index 0000000..f6ffdb8
--- /dev/null
@@ -0,0 +1,9 @@
+package org.opendaylight.controller.frm.flow;
+
+public class FlowTransactionValidator {
+
+    public static void validate(FlowTransaction transaction) throws IllegalStateException {
+        // NOOP
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupCommitHandler.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupCommitHandler.xtend
new file mode 100644 (file)
index 0000000..2c5f42b
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.frm.group
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+class GroupCommitHandler implements DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> {
+       
+    @Property
+    val SalGroupService groupService;
+    
+    new(SalGroupService groupService) {
+        _groupService = groupService;
+    }
+    
+    override requestCommit(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        return new GroupTransaction(modification,groupService);
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupProvider.xtend
new file mode 100644 (file)
index 0000000..a75a668
--- /dev/null
@@ -0,0 +1,48 @@
+package org.opendaylight.controller.frm.group
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group
+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.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.slf4j.LoggerFactory
+
+class GroupProvider implements AutoCloseable {
+    
+    @Property
+    DataProviderService dataService;
+    
+    @Property
+    SalGroupService salGroupService;
+    
+    GroupCommitHandler commitHandler
+
+    Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject>> commitHandlerRegistration;
+    
+    static val LOG = LoggerFactory.getLogger(GroupProvider);
+    
+    def void start() {
+        commitHandler = new GroupCommitHandler(salGroupService)
+        val InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder(Nodes)
+            .child(Node)
+            .augmentation(FlowCapableNode)
+            .child(Group)
+            .toInstance();
+        commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler);
+        LOG.info("Group Config Provider started.");
+    }
+
+    protected def startChange() {
+        return dataService.beginTransaction;
+    }
+    
+    override close() throws Exception {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransaction.xtend
new file mode 100644 (file)
index 0000000..54382ea
--- /dev/null
@@ -0,0 +1,75 @@
+package org.opendaylight.controller.frm.group
+
+import org.opendaylight.controller.frm.AbstractTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowTableRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder
+
+class GroupTransaction extends AbstractTransaction {
+    
+    @Property
+    val SalGroupService groupService;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalGroupService groupService) {
+        super(modification)
+        _groupService = groupService;
+    }
+    
+    override remove(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Group) {
+            val group = (obj as Group)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new RemoveGroupInputBuilder(group);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _groupService.removeGroup(builder.build());            
+        }
+    }
+    
+    override update(InstanceIdentifier<?> instanceId, DataObject originalObj, DataObject updatedObj) {
+        if(originalObj instanceof Group && updatedObj instanceof Group) {
+            val originalGroup = (originalObj as Group)
+            val updatedGroup = (updatedObj as Group)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new UpdateGroupInputBuilder();
+            builder.setNode(new NodeRef(nodeInstanceId));
+            val ufb = new UpdatedGroupBuilder(updatedGroup);
+            builder.setUpdatedGroup((ufb.build()));
+            val ofb = new OriginalGroupBuilder(originalGroup);
+            builder.setOriginalGroup(ofb.build());      
+            _groupService.updateGroup(builder.build());
+           
+        }
+    }
+    
+    override add(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Group) {
+            val group = (obj as Group)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new AddGroupInputBuilder(group);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _groupService.addGroup(builder.build());            
+        }
+    }
+    
+    override validate() throws IllegalStateException {
+        GroupTransactionValidator.validate(this)
+    }  
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransactionValidator.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/group/GroupTransactionValidator.java
new file mode 100644 (file)
index 0000000..a264c33
--- /dev/null
@@ -0,0 +1,9 @@
+package org.opendaylight.controller.frm.group;
+
+public class GroupTransactionValidator {
+
+    public static void validate(GroupTransaction transaction) throws IllegalStateException {
+        // NOOP
+    }
+
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterCommitHandler.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterCommitHandler.xtend
new file mode 100644 (file)
index 0000000..dd8d4c7
--- /dev/null
@@ -0,0 +1,22 @@
+package org.opendaylight.controller.frm.meter
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+class FlowCommitHandler implements DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> {
+       
+    @Property
+    val SalMeterService salMeterService;
+    
+    new(SalMeterService manager) {
+        _salMeterService = manager;
+    }
+    
+    override requestCommit(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
+        return new MeterTransaction(modification,salMeterService);
+    }
+    
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterProvider.xtend
new file mode 100644 (file)
index 0000000..75d29d5
--- /dev/null
@@ -0,0 +1,48 @@
+package org.opendaylight.controller.frm.meter
+
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler
+import org.opendaylight.controller.sal.binding.api.data.DataProviderService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter
+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.meter.service.rev130918.SalMeterService
+import org.opendaylight.yangtools.concepts.Registration
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.slf4j.LoggerFactory
+
+class MeterProvider implements AutoCloseable {
+    
+    @Property
+    DataProviderService dataService;
+    
+    @Property
+    SalMeterService salMeterService;
+    
+    FlowCommitHandler commitHandler
+
+    Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>,DataObject>> commitHandlerRegistration;
+    
+    static val LOG = LoggerFactory.getLogger(MeterProvider);
+    
+    def void start() {
+        commitHandler = new FlowCommitHandler(salMeterService)
+        val InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder(Nodes)
+            .child(Node)
+            .augmentation(FlowCapableNode)
+            .child(Meter)
+            .toInstance();
+        commitHandlerRegistration = dataService.registerCommitHandler(path,commitHandler);
+        LOG.info("Meter Config Provider started.");
+    }
+
+    protected def startChange() {
+        return dataService.beginTransaction;
+    }
+    
+    override close() throws Exception {
+        throw new UnsupportedOperationException("TODO: auto-generated method stub")
+    }
+    
+}
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransaction.xtend
new file mode 100644 (file)
index 0000000..3ed1f40
--- /dev/null
@@ -0,0 +1,66 @@
+package org.opendaylight.controller.frm.meter
+
+import org.opendaylight.controller.frm.AbstractTransaction
+import org.opendaylight.controller.md.sal.common.api.data.DataModification
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter
+import org.opendaylight.yangtools.yang.binding.DataObject
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+
+class MeterTransaction extends AbstractTransaction {
+    
+    @Property
+    val SalMeterService salMeterService;
+    
+    new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalMeterService salMeterService) {
+        super(modification)
+        _salMeterService = salMeterService;
+    }
+    
+    override remove(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Meter) {
+            val meter = (obj as Meter)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new RemoveMeterInputBuilder(meter);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _salMeterService.removeMeter(builder.build());            
+        }
+    }
+    
+    override update(InstanceIdentifier<?> instanceId, DataObject originalObj, DataObject updatedObj) {
+        if(originalObj instanceof Meter && updatedObj instanceof Meter) {
+            val originalMeter = (originalObj as Meter)
+            val updatedMeter = (updatedObj as Meter)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new UpdateMeterInputBuilder();
+            builder.setNode(new NodeRef(nodeInstanceId));
+            val ufb = new UpdatedMeterBuilder(updatedMeter);
+            builder.setUpdatedMeter((ufb.build()));
+            val ofb = new OriginalMeterBuilder(originalMeter);
+            builder.setOriginalMeter(ofb.build());      
+            _salMeterService.updateMeter(builder.build());
+           
+        }
+    }
+    
+    override add(InstanceIdentifier<?> instanceId, DataObject obj) {
+        if(obj instanceof Meter) {
+            val meter = (obj as Meter)
+            val nodeInstanceId = instanceId.firstIdentifierOf(Node);
+            val builder = new AddMeterInputBuilder(meter);
+            builder.setNode(new NodeRef(nodeInstanceId));
+            _salMeterService.addMeter(builder.build());            
+        }
+    }
+    
+    override validate() throws IllegalStateException {
+        MeterTransactionValidator.validate(this)
+    }  
+}
\ No newline at end of file
diff --git a/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransactionValidator.java b/opendaylight/md-sal/forwardingrules-manager/src/main/java/org/opendaylight/controller/frm/meter/MeterTransactionValidator.java
new file mode 100644 (file)
index 0000000..d8afd2a
--- /dev/null
@@ -0,0 +1,9 @@
+package org.opendaylight.controller.frm.meter;
+
+public class MeterTransactionValidator {
+
+    public static void validate(MeterTransaction transaction) throws IllegalStateException {
+        // NOOP
+    }
+
+}
diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/action-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/action-types.yang
deleted file mode 100644 (file)
index 3850dd5..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
-module opendaylight-action-types {
-    namespace "urn:opendaylight:action:types";
-    prefix action;
-
-    import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
-    import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
-    import opendaylight-l2-types {prefix l2t; revision-date "2013-08-27";}
-    import opendaylight-match-types {prefix match; revision-date "2013-10-26";}
-    
-    revision "2013-11-12" {
-        description "Initial revision of action service";
-    }
-    
-    typedef vlan-cfi {
-        type int32;    
-    }
-
-    grouping address {
-        choice address {
-            case ipv4 {
-                leaf ipv4-address {
-                    type inet:ipv4-prefix;
-                }
-            }
-            case ipv6 {
-                leaf ipv6-address {
-                    type inet:ipv6-prefix;
-                }
-            }
-        }
-    }  
-    
-    grouping action-list {
-        list action {
-            key "order";
-            leaf order {
-                type int32;
-            }
-            uses action;
-        }
-    }
-    
-    grouping action {
-        choice action {
-            case output-action {
-                leaf output-node-connector {
-                    type inet:uri;
-                }
-                
-                leaf max-length {
-                    type uint16 {
-                        range "0..65294";
-                    }
-                }                
-            }
-
-            case controller-action {
-                leaf max-length {
-                    type uint16 {
-                        range "0..65294";
-                    }
-                }
-            }
-            
-            case set-field {
-                container match {
-                    uses match:match;
-                }
-            }
-            
-            case set-queue-action {
-                leaf queue {
-                    type string; 
-                }
-                
-                leaf queue-id {
-                    type uint32; 
-                }
-            }
-
-            case pop-mpls-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-            }
-
-            case set-mpls-ttl-action {
-                leaf mpls-ttl {
-                    type uint8;
-                }
-            }
-
-            case set-nw-ttl-action {
-                leaf nw-ttl {
-                    type uint8;
-                }
-            }
-
-            case push-pbb-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-            }
-
-            case pop-pbb-action {
-                
-            }
-            
-            case push-mpls-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-            }
-            
-            case dec-mpls-ttl {
-            }
-            
-            case dec-nw-ttl {
-            }
-            
-            case drop-action {
-            }
-            
-            case flood-action {
-            }
-            
-            case flood-all-action {
-            }
-            
-            case hw-path-action {
-            }
-            
-            case loopback-action {
-            }
-            
-            case pop-vlan-action {
-            }
-            
-            case push-vlan-action {
-                leaf ethernet-type {
-                    type uint16; // TODO: define ethertype type
-                }
-                leaf tag {               // TPID - 16 bits
-                    type int32;
-                } 
-                leaf pcp {               // PCP - 3 bits
-                    type int32;
-                }
-                leaf cfi {               // CFI - 1 bit (drop eligible)
-                    type vlan-cfi;
-                }
-                leaf vlan-id {           // VID - 12 bits
-                    type l2t:vlan-id;
-                }
-//                leaf tci {               //TCI = [PCP + CFI + VID]
-//                }
-//                leaf header {            //header = [TPID + TCI] 
-//                }
-            }
-            
-            case copy-ttl-out {
-            }
-            
-            case copy-ttl-in {
-            }
-            
-            case set-dl-dst-action {
-                leaf address {
-                    type yang:mac-address;
-                }
-            }
-            
-            case set-dl-src-action {
-                leaf address {
-                    type yang:mac-address;
-                }
-            }
-            case group-action {
-                leaf group {
-                    type string;
-                }
-                
-                leaf group-id {
-                    type uint32;
-                }
-            }
-            
-            case set-dl-type-action {
-                leaf dl-type {
-                    type l2t:ether-type;
-                }
-            }
-            
-            case set-next-hop-action {
-                uses address;
-            }
-            
-            case set-nw-dst-action {
-                uses address;            
-            }
-            
-            case set-nw-src-action{
-                uses address;            
-            }
-            
-            case set-nw-tos-action {
-                leaf tos {
-                    type int32;
-                }
-            }
-            
-            case set-tp-dst-action {
-                leaf port {
-                    type inet:port-number;
-                }                
-            }
-            case set-tp-src-action {
-                leaf port {
-                    type inet:port-number;
-                }                
-            }
-            case set-vlan-cfi-action {
-                leaf vlan-cfi {
-                    type vlan-cfi;
-                }
-            }
-            
-            case set-vlan-id-action {
-                leaf vlan-id {
-                    type l2t:vlan-id;
-                } 
-            }
-            
-            case set-vlan-pcp-action {
-                leaf vlan-pcp {
-                    type l2t:vlan-pcp;
-                }            
-            }
-            
-            case sw-path-action {            
-            }  
-        }
-    }
-}
\ No newline at end of file
index f03e28b..8c874e2 100644 (file)
@@ -236,4 +236,12 @@ module opendaylight-group-types {
        uses group-features;
     }
     
+    grouping groups {
+        list group {
+            key "group-id";                  
+        
+            uses group;
+        }
+    }
+    
 }
\ No newline at end of file
index 5ba92ab..7dcd254 100644 (file)
@@ -91,6 +91,11 @@ module opendaylight-match-types {
             description "IP ECN (2 bits in ToS field).";
             type uint8; 
         }
+        
+        leaf ip-proto {                
+           description "IP Proto (IPv4 or IPv6 Protocol Number).";             
+              type inet:ip-version;            
+               }
     } 
     
     grouping "ipv4-match-fields" {
diff --git a/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-action-types.yang b/opendaylight/md-sal/model/model-flow-base/src/main/yang/opendaylight-action-types.yang
new file mode 100644 (file)
index 0000000..81303d6
--- /dev/null
@@ -0,0 +1,343 @@
+module opendaylight-action-types {
+    namespace "urn:opendaylight:action:types";
+    prefix action;
+
+    import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
+    import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+    import opendaylight-l2-types {prefix l2t; revision-date "2013-08-27";}
+    import opendaylight-match-types {prefix match; revision-date "2013-10-26";}
+    
+    revision "2013-11-12" {
+        description "Initial revision of action service";
+    }
+    
+    typedef vlan-cfi {
+        type int32;    
+    }
+
+    grouping address {
+        choice address {
+            case ipv4 {
+                leaf ipv4-address {
+                    type inet:ipv4-prefix;
+                }
+            }
+            case ipv6 {
+                leaf ipv6-address {
+                    type inet:ipv6-prefix;
+                }
+            }
+        }
+    }  
+    
+    grouping action-list {
+        list action {
+            key "order";
+            leaf order {
+                type int32;
+            }
+            uses action;
+        }
+    }
+    
+    grouping action {
+        choice action {
+            case output-action-case {
+                container output-action {
+                    leaf output-node-connector {
+                        type inet:uri;
+                    }
+                    
+                    leaf max-length {
+                        type uint16 {
+                            range "0..65294";
+                        }
+                    }
+                }
+            }
+
+            case controller-action-case {
+                container controller-action {
+                 leaf max-length {
+                     type uint16 {
+                         range "0..65294";
+                     }
+                 }
+             }
+            }
+             
+
+
+            case set-field-case {
+                container set-field {
+                     uses match:match;
+                 }
+             }
+             
+
+            case set-queue-action-case {
+                container set-queue-action {
+                 leaf queue {
+                     type string; 
+                 }
+                 leaf queue-id {
+                     type uint32; 
+                 }
+             }
+            }
+
+           case pop-mpls-action-case {
+                container pop-mpls-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+             }
+            }
+
+            case set-mpls-ttl-action-case {
+                container set-mpls-ttl-action {
+                 leaf mpls-ttl {
+                     type uint8;
+                 }
+             }
+            }
+
+            case set-nw-ttl-action-case {
+                container set-nw-ttl-action {
+                 leaf nw-ttl {
+                     type uint8;
+                 }
+             }
+            }
+
+            case push-pbb-action-case {
+                container push-pbb-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+             }
+            }
+
+            case pop-pbb-action-case {
+                container pop-pbb-action {
+                 
+             }
+            }
+             
+
+            case push-mpls-action-case {
+                container push-mpls-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+             }
+            }
+             
+
+            case dec-mpls-ttl-case {
+                container dec-mpls-ttl {
+                }
+             }
+             
+
+            case dec-nw-ttl-case {
+                container dec-nw-ttl {
+                }
+             }
+             
+
+            case drop-action-case {
+                container drop-action {
+                }
+             }
+             
+
+            case flood-action-case {
+                container flood-action {
+                }
+             }
+             
+
+            case flood-all-action-case {
+                container flood-all-action {
+                }
+             }
+             
+
+            case hw-path-action-case {
+                container hw-path-action {
+                }
+             }
+             
+
+            case loopback-action-case {
+                container loopback-action {
+                }
+             }
+             
+
+            case pop-vlan-action-case {
+                container pop-vlan-action {
+                }
+             }
+             
+            
+            
+            case push-vlan-action-case {
+                container push-vlan-action {
+                 leaf ethernet-type {
+                     type uint16; // TODO: define ethertype type
+                 }
+                leaf tag {               // TPID - 16 bits
+                    type int32;
+                } 
+                leaf pcp {               // PCP - 3 bits
+                    type int32;
+                }
+                leaf cfi {               // CFI - 1 bit (drop eligible)
+                    type vlan-cfi;
+                }
+                leaf vlan-id {           // VID - 12 bits
+                    type l2t:vlan-id;
+                }
+//                leaf tci {               //TCI = [PCP + CFI + VID]
+//                }
+//                leaf header {            //header = [TPID + TCI] 
+//                }
+                }
+             }
+            
+            case copy-ttl-out-case {
+                container copy-ttl-out {
+                }
+             }
+             
+
+            case copy-ttl-in-case {
+                container copy-ttl-in {
+                }
+             }
+             
+
+            case set-dl-dst-action-case {
+                container set-dl-dst-action {
+                 leaf address {
+                     type yang:mac-address;
+                 }
+             }
+            }
+             
+
+            case set-dl-src-action-case {
+                container set-dl-src-action {
+                 leaf address {
+                     type yang:mac-address;
+                 }
+             }
+
+            }
+            case group-action-case {
+                container group-action {
+                 leaf group {
+                     type string;
+                 }
+                
+                leaf group-id {
+                    type uint32;
+                }
+             }
+            }
+            
+            case set-dl-type-action-case {
+                container set-dl-type-action {
+                 leaf dl-type {
+                     type l2t:ether-type;
+                 }
+             }
+            }
+             
+
+            case set-next-hop-action-case {
+                container set-next-hop-action {
+                 uses address;
+             }
+            }
+             
+
+            case set-nw-dst-action-case {
+                container set-nw-dst-action {
+                 uses address;            
+             }
+            }
+             
+
+            case set-nw-src-action-case {
+                container set-nw-src-action {
+                 uses address;            
+             }
+            }
+             
+
+            case set-nw-tos-action-case {
+                container set-nw-tos-action {
+                 leaf tos {
+                     type int32;
+                 }
+             }
+            }
+             
+
+            case set-tp-dst-action-case {
+                container set-tp-dst-action {
+                 leaf port {
+                     type inet:port-number;
+                 }                
+             }
+
+            }
+            case set-tp-src-action-case {
+                container set-tp-src-action {
+                 leaf port {
+                     type inet:port-number;
+                 }                
+             }
+
+            }
+            case set-vlan-cfi-action-case {
+                container set-vlan-cfi-action {
+                 leaf vlan-cfi {
+                     type vlan-cfi;
+                 }
+             }
+            }
+             
+
+            case set-vlan-id-action-case {
+                container set-vlan-id-action {
+                 leaf vlan-id {
+                     type l2t:vlan-id;
+                 } 
+             }
+            }
+             
+
+            case set-vlan-pcp-action-case {
+                container set-vlan-pcp-action {
+                 leaf vlan-pcp {
+                     type l2t:vlan-pcp;
+                 }            
+             }
+            }
+             
+
+            case sw-path-action-case {            
+                container sw-path-action {
+                }  
+             }  
+         }
+     }
+}
\ No newline at end of file
@@ -6,6 +6,7 @@ module opendaylight-flow-types {
     import ietf-yang-types {prefix yang; revision-date "2010-09-24";}    
     import opendaylight-match-types {prefix match; revision-date "2013-10-26";}
     import opendaylight-action-types {prefix action;}
+    import opendaylight-meter-types {prefix meter; revision-date "2013-09-18";}
 
     revision "2013-10-26" {
         description "Initial revision of flow service";
@@ -21,46 +22,54 @@ module opendaylight-flow-types {
         }
     }
 
-    grouping instruction {
-        choice instruction {
-            case go-to-table {
-                leaf table_id {
-                    type uint8;
-                }
+     grouping instruction {
+         choice instruction {
+            case go-to-table-case {
+                container go-to-table {
+                 leaf table_id {
+                     type uint8;
+                 }
+             }
             }
-            
-            case write-metadata {
-                leaf metadata {
-                    type uint64;
-                }
-                
-                leaf metadata-mask {
-                    type uint64;
-                }
+             
+            case write-metadata-case {
+                container write-metadata {
+                 leaf metadata {
+                     type uint64;
+                 }
+                 
+                 leaf metadata-mask {
+                     type uint64;
+                 }
+             }
             }
-            
-            case write-actions {
-                uses action:action-list;
+             
+            case write-actions-case {
+                container write-actions {
+                 uses action:action-list;
+             }
             }
-            
-            case apply-actions {
-                uses action:action-list;
+             
+            case apply-actions-case {
+                container apply-actions {
+                 uses action:action-list;
+             }
             }
-            
-            case clear-actions {
-                uses action:action-list;
+             
+            case clear-actions-case {
+                container clear-actions {
+                 uses action:action-list;
+             }
             }
-            
-            case meter {
-                leaf meter {
-                    type string;
-                }
-                
-                leaf meter-id {
-                    type uint32;
-                }
-            }   
-        }
+             
+            case meter-case {
+                container meter {
+                     leaf meter-id {
+                        type meter:meter-id;
+                     } 
+                 }
+             }
+         }
     }
     
     typedef flow-mod-flags {
@@ -161,7 +170,7 @@ module opendaylight-flow-types {
     grouping flow-statistics {
         leaf packet-count {
             type yang:counter64;
-        } 
+        }
 
         leaf byte-count {
             type yang:counter64;
index 005f7c3..d717e87 100644 (file)
@@ -7,6 +7,10 @@ module flow-node-inventory {
     import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
     import opendaylight-port-types {prefix port;revision-date "2013-09-25";}
     import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
+    import opendaylight-table-types {prefix table;revision-date "2013-10-26";}
+    import opendaylight-flow-types {prefix flow;revision-date "2013-10-26";}
+    import opendaylight-group-types {prefix group;revision-date "2013-10-18";}
+    import opendaylight-meter-types {prefix meter;revision-date "2013-09-18";}
     
     revision "2013-08-19" {
         description "Flow Capable Node extensions to the Inventory model";
@@ -34,9 +38,37 @@ module flow-node-inventory {
         }
     }
 
-    grouping table {
-
+    typedef flow-id {
+        type uint32; // Note: This doesn't really belong here, and not sure if unint32 is right
+    }
 
+    grouping tables {
+        list table {
+            key "id"; 
+    
+            leaf id {
+                    type uint8;
+            }            
+    
+            uses table:table-features;
+    
+            list flow {
+                key "id"; 
+    
+                leaf id {
+                    type flow-id;
+                }           
+    
+                uses flow:flow;
+            }
+        }
+    }
+    
+    grouping meters {
+        list meter {
+            key "meter-id";
+            uses meter:meter;
+        }
     }
 
     grouping flow-node {
@@ -57,16 +89,10 @@ module flow-node-inventory {
             type string;
         }
 
-        container tables {
-            uses feature;
-            list table {
-                uses table;
-            }
-        }
-        
-        container group-tables {
-            uses feature;
-        }
+        uses tables;
+        uses group:groups;
+        uses meters;
+        // TODO: ports
         
         container supported-match-types {
             list match-type {
diff --git a/opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang b/opendaylight/md-sal/model/model-inventory/src/main/yang/opendaylight-inventory-config.yang
new file mode 100644 (file)
index 0000000..aaaedc1
--- /dev/null
@@ -0,0 +1,23 @@
+module opendaylight-inventory-config {
+    namespace "urn:opendaylight:inventory:config";
+    prefix inv-config;
+
+    import yang-ext {prefix ext; revision-date "2013-07-09";}
+    import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
+    import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+    import opendaylight-inventory {prefix inv; revision-date "2013-08-19";}
+
+
+    revision "2013-08-19" {
+        description "Initial revision of Inventory model";
+    }
+    /** Base structure **/
+    container nodes {
+        list node {
+            key "id";
+            ext:context-instance "node-context";
+
+            uses inv:node;
+        }
+    }    
+}
\ No newline at end of file
index ac84aab..f9f7209 100644 (file)
             <version>${slf4j.version}</version>
             <scope>test</scope>
         </dependency>
+            <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-inet-types</artifactId>
+            <version>2010.09.24.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+               <groupId>org.opendaylight.controller.model</groupId>
+               <artifactId>model-flow-base</artifactId>
+               <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+               <groupId>org.opendaylight.controller.model</groupId>
+               <artifactId>model-flow-service</artifactId>
+               <version>1.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+               <groupId>org.opendaylight.controller.model</groupId>
+               <artifactId>model-flow-statistics</artifactId>
+               <version>1.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 </project>
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java
new file mode 100644 (file)
index 0000000..bff77be
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.controller.sal.binding.test;
+
+import junit.framework.Assert;
+
+
+import org.opendaylight.yangtools.yang.binding.Augmentable;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+public class AugmentationVerifier<T extends Augmentable<T>> {
+
+    private T object;
+
+    public AugmentationVerifier(T objectToVerify) {
+        this.object = objectToVerify;
+    }
+
+    public AugmentationVerifier<T> assertHasAugmentation(Class<? extends Augmentation<T>> augmentation) {
+        assertHasAugmentation(object, augmentation);
+        return (AugmentationVerifier<T>) this;
+    }
+
+    public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
+            Class<? extends Augmentation<T>> augmentation) {
+        Assert.assertNotNull(object);
+        Assert.assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", object.getAugmentation(augmentation));
+    }
+
+    public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
+        return new AugmentationVerifier<T>(obj);
+    }
+
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/BindingTestUtilities.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/BindingTestUtilities.java
new file mode 100644 (file)
index 0000000..7d14919
--- /dev/null
@@ -0,0 +1,5 @@
+package org.opendaylight.controller.sal.binding.test;
+
+public class BindingTestUtilities {
+
+}
diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/MultipleAugmentationPuts.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/MultipleAugmentationPuts.java
new file mode 100644 (file)
index 0000000..6d1a699
--- /dev/null
@@ -0,0 +1,210 @@
+package org.opendaylight.controller.sal.binding.test.bugfix;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataChangeEvent;
+import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
+import org.opendaylight.controller.sal.binding.test.AugmentationVerifier;
+import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
+import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter32;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter64;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
+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.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatisticsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.MeterStatisticsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.Duration;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.DurationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsKey;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.data.api.CompositeNode;
+
+import com.google.common.collect.FluentIterable;
+
+import static org.junit.Assert.*;
+
+public class MultipleAugmentationPuts extends AbstractDataServiceTest implements DataChangeListener {
+
+    private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
+    private static final String NODE_ID = "openflow:1";
+
+    private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
+
+    private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
+            NODE_ID);
+
+    private static final InstanceIdentifier<Nodes> NODES_INSTANCE_ID_BA = InstanceIdentifier.builder(Nodes.class) //
+            .toInstance();
+
+    private static final InstanceIdentifier<Node> NODE_INSTANCE_ID_BA = InstanceIdentifier
+            .builder(NODES_INSTANCE_ID_BA) //
+            .child(Node.class, NODE_KEY).toInstance();
+
+    private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier NODE_INSTANCE_ID_BI = //
+    org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
+            .node(Nodes.QNAME) //
+            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
+            .toInstance();
+    private DataChangeEvent<InstanceIdentifier<?>, DataObject> receivedChangeEvent;
+
+    /**
+     * Test for Bug 148
+     * 
+     * @throws Exception
+     */
+    @Test
+    public void testAugmentSerialization() throws Exception {
+
+        baDataService.registerDataChangeListener(NODES_INSTANCE_ID_BA, this);
+
+        Node flowCapableNode = createTestNode(FlowCapableNode.class, flowCapableNodeAugmentation());
+        commitNodeAndVerifyTransaction(flowCapableNode);
+
+        assertNotNull(receivedChangeEvent);
+        verifyNode((Nodes) receivedChangeEvent.getUpdatedOperationalSubtree(), flowCapableNode);
+
+        Nodes nodes = checkForNodes();
+        verifyNode(nodes, flowCapableNode).assertHasAugmentation(FlowCapableNode.class);
+        ;
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+        Node meterStatsNode = createTestNode(NodeMeterStatistics.class, nodeMeterStatistics());
+        commitNodeAndVerifyTransaction(meterStatsNode);
+
+        assertNotNull(receivedChangeEvent);
+        verifyNode((Nodes) receivedChangeEvent.getUpdatedOperationalSubtree(), meterStatsNode);
+
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+
+        Node mergedNode = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
+
+        AugmentationVerifier.from(mergedNode) //
+                .assertHasAugmentation(FlowCapableNode.class) //
+                .assertHasAugmentation(NodeMeterStatistics.class);
+
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+
+        Node meterStatsNodeWithDuration = createTestNode(NodeMeterStatistics.class, nodeMeterStatistics(5, true));
+        commitNodeAndVerifyTransaction(meterStatsNodeWithDuration);
+
+        
+        Node nodeWithUpdatedList = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
+        AugmentationVerifier.from(nodeWithUpdatedList) //
+                .assertHasAugmentation(FlowCapableNode.class) //
+                .assertHasAugmentation(NodeMeterStatistics.class);
+        
+        List<MeterStats> meterStats = nodeWithUpdatedList.getAugmentation(NodeMeterStatistics.class).getMeterStatistics().getMeterStats();
+        assertNotNull(meterStats);
+        assertFalse(meterStats.isEmpty());
+        assertBindingIndependentVersion(NODE_INSTANCE_ID_BI);
+        testNodeRemove();
+    }
+
+    private <T extends Augmentation<Node>> Node createTestNode(Class<T> augmentationClass, T augmentation) {
+        NodeBuilder nodeBuilder = new NodeBuilder();
+        nodeBuilder.setId(new NodeId(NODE_ID));
+        nodeBuilder.setKey(NODE_KEY);
+        nodeBuilder.addAugmentation(augmentationClass, augmentation);
+        return nodeBuilder.build();
+    }
+
+    private DataModificationTransaction commitNodeAndVerifyTransaction(Node original) throws Exception {
+        DataModificationTransaction transaction = baDataService.beginTransaction();
+        transaction.putOperationalData(NODE_INSTANCE_ID_BA, original);
+        RpcResult<TransactionStatus> result = transaction.commit().get();
+        assertEquals(TransactionStatus.COMMITED, result.getResult());
+        return transaction;
+    }
+
+    private void testNodeRemove() throws Exception {
+        DataModificationTransaction transaction = baDataService.beginTransaction();
+        transaction.removeOperationalData(NODE_INSTANCE_ID_BA);
+        RpcResult<TransactionStatus> result = transaction.commit().get();
+        assertEquals(TransactionStatus.COMMITED, result.getResult());
+
+        Node node = (Node) baDataService.readOperationalData(NODE_INSTANCE_ID_BA);
+        assertNull(node);
+    }
+
+    private AugmentationVerifier<Node> verifyNode(Nodes nodes, Node original) {
+        assertNotNull(nodes);
+        assertNotNull(nodes.getNode());
+        assertEquals(1, nodes.getNode().size());
+        Node readedNode = nodes.getNode().get(0);
+        assertEquals(original.getId(), readedNode.getId());
+        assertEquals(original.getKey(), readedNode.getKey());
+        return new AugmentationVerifier<Node>(readedNode);
+    }
+
+    private void assertBindingIndependentVersion(org.opendaylight.yangtools.yang.data.api.InstanceIdentifier nodeId) {
+        CompositeNode node = biDataService.readOperationalData(nodeId);
+        assertNotNull(node);
+    }
+
+    private Nodes checkForNodes() {
+        return (Nodes) baDataService.readOperationalData(NODES_INSTANCE_ID_BA);
+    }
+
+    private NodeMeterStatistics nodeMeterStatistics() {
+        return nodeMeterStatistics(10, false);
+    }
+
+    private NodeMeterStatistics nodeMeterStatistics(int count, boolean setDuration) {
+        NodeMeterStatisticsBuilder nmsb = new NodeMeterStatisticsBuilder();
+        MeterStatisticsBuilder meterStats = new MeterStatisticsBuilder();
+
+        List<MeterStats> stats = new ArrayList<>(count);
+        for (int i = 0; i <= count; i++) {
+            MeterStatsBuilder statistic = new MeterStatsBuilder();
+            statistic.setKey(new MeterStatsKey(new MeterId((long) i)));
+            statistic.setByteInCount(new Counter64(BigInteger.valueOf(34590 + i)));
+            statistic.setFlowCount(new Counter32(4569L + i));
+
+            if (setDuration) {
+                DurationBuilder duration = new DurationBuilder();
+                duration.setNanosecond(new Counter32(70L));
+                statistic.setDuration(duration.build());
+            }
+
+            stats.add(statistic.build());
+        }
+        meterStats.setMeterStats(stats);
+        nmsb.setMeterStatistics(meterStats.build());
+        return nmsb.build();
+    }
+
+    private FlowCapableNode flowCapableNodeAugmentation() {
+        FlowCapableNodeBuilder fnub = new FlowCapableNodeBuilder();
+        fnub.setHardware("Hardware Foo");
+        fnub.setManufacturer("Manufacturer Foo");
+        fnub.setSerialNumber("Serial Foo");
+        fnub.setDescription("Description Foo");
+        fnub.setSoftware("JUnit emulated");
+        FlowCapableNode fnu = fnub.build();
+        return fnu;
+    }
+
+    @Override
+    public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+        receivedChangeEvent = change;
+    }
+
+}
index 5a98767..56fbb9a 100644 (file)
@@ -11,13 +11,16 @@ import java.util.concurrent.Executors;
 
 
 
+
+
+
+
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionBuilder;
+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.pop.mpls.action._case.PopMplsActionBuilder;
 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.flow.config.rev130819.Flows;
@@ -26,7 +29,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.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.ApplyActionsBuilder;
+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;
@@ -177,13 +181,11 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
         List<Action> actionList = new ArrayList<>();
         PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
         popMplsAction.setEthernetType(34);
-        actionList.add(new ActionBuilder().setAction(popMplsAction.build()).setOrder(10).build());
+        actionList.add(new ActionBuilder().setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsAction.build()).build()).setOrder(10).build());
 
         applyActions.setAction(actionList );
-        
-
 
-        instruction.setInstruction(applyActions.build());
+        instruction.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(applyActions.build()).build());
 
 
         List<Instruction> instructionList = Collections.<Instruction>singletonList(instruction.build());
@@ -207,7 +209,6 @@ public class DOMCodecBug01Test extends AbstractDataServiceTest {
         match.setLayer4Match(new TcpMatchBuilder().build());
         flow.setMatch(match.build());
         
-        System.out.println("Putting the configuration Data................");
         path1 = InstanceIdentifier.builder(Flows.class).child(Flow.class, key).toInstance();
        // DataObject cls = (DataObject) modification.readConfigurationData(path1);
         modification.putConfigurationData(path1, flow.build());
index 7111501..ea36f81 100644 (file)
@@ -4,32 +4,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-
-
-
-
-
-
-
-
-
-
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Future;
 
-
-
-
-
-
-
-
-
-
-
 import org.junit.Test;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
@@ -37,16 +17,27 @@ import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.sal.binding.impl.connect.dom.CommitHandlersTransactions;
 import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
 import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
+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.dec.nw.ttl._case.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpVersion;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
 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.flow.config.rev130819.Flows;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey;
+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.FlowCapableNode;
+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;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+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.ApplyActionsBuilder;
+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.inventory.rev130819.NodeId;
@@ -56,7 +47,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 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.VlanId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
 import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -72,13 +66,16 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
     private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
     private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
     private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
-    private static final long FLOW_ID = 1234;
-    private static final String NODE_ID = "node:1";
-    
-    private DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modificationCapture;
+    private static final QName TABLE_ID_QNAME = QName.create(Table.QNAME, "id");
 
+    private static final String NODE_ID = "node:1";
+    private static final FlowId FLOW_ID = new FlowId(1234L);
+    private static final Short TABLE_ID = Short.valueOf((short) 0);
 
     private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
+    private static final FlowKey FLOW_KEY = new FlowKey(FLOW_ID);
+
+    private DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modificationCapture;
 
     private static final Map<QName, Object> NODE_KEY_BI = Collections.<QName, Object> singletonMap(NODE_ID_QNAME,
             NODE_ID);
@@ -93,34 +90,41 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
             .toInstance();
     private static final NodeRef NODE_REF = new NodeRef(NODE_INSTANCE_ID_BA);
 
-    private static final FlowKey FLOW_KEY = new FlowKey(FLOW_ID, NODE_REF);
-
     private static final Map<QName, Object> FLOW_KEY_BI = //
-    ImmutableMap.<QName, Object> of(FLOW_ID_QNAME, FLOW_ID, FLOW_NODE_QNAME, NODE_INSTANCE_ID_BI);
+    ImmutableMap.<QName, Object> of(FLOW_ID_QNAME, FLOW_ID.getValue());
+
+    private static final Map<QName, Object> TABLE_KEY_BI = //
+    ImmutableMap.<QName, Object> of(TABLE_ID_QNAME, TABLE_ID);;
 
     private static final org.opendaylight.yangtools.yang.data.api.InstanceIdentifier FLOW_INSTANCE_ID_BI = //
     org.opendaylight.yangtools.yang.data.api.InstanceIdentifier.builder() //
-            .node(Flows.QNAME) //
+            .node(Nodes.QNAME) //
+            .nodeWithKey(Node.QNAME, NODE_KEY_BI) //
+            .nodeWithKey(Table.QNAME, TABLE_KEY_BI) //
             .nodeWithKey(Flow.QNAME, FLOW_KEY_BI) //
             .toInstance();
-    
-    private static final InstanceIdentifier<Flows> FLOWS_PATH_BA = //
-            InstanceIdentifier.builder(Flows.class) //
-                    .toInstance();
-            
-    
+    private static final TableKey TABLE_KEY_BA = new TableKey((short) 0);
+
+    private static final InstanceIdentifier<Flow> FLOWS_PATH_BA = //
+    InstanceIdentifier.builder(NODE_INSTANCE_ID_BA) //
+            .augmentation(FlowCapableNode.class) //
+            .child(Table.class, TABLE_KEY_BA) //
+            .child(Flow.class) //
+            .toInstance();
+
     private static final InstanceIdentifier<Flow> FLOW_INSTANCE_ID_BA = //
-    InstanceIdentifier.builder(Flows.class) //
+    InstanceIdentifier.builder(FLOWS_PATH_BA.firstIdentifierOf(Table.class)) //
             .child(Flow.class, FLOW_KEY) //
             .toInstance();
-    
+
     @Test
     public void simpleModifyOperation() throws Exception {
+
         assertNull(biDataService.readConfigurationData(FLOW_INSTANCE_ID_BI));
-        
+
         registerCommitHandler();
-        
-        CompositeNode domflow = createXmlFlow();
+
+        CompositeNode domflow = createTestFlow();
         DataModificationTransaction biTransaction = biDataService.beginTransaction();
         biTransaction.putConfigurationData(FLOW_INSTANCE_ID_BI, domflow);
         RpcResult<TransactionStatus> biResult = biTransaction.commit().get();
@@ -130,62 +134,78 @@ public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
         assertNotNull(flow);
         assertNotNull(flow.getMatch());
         assertEquals(TransactionStatus.COMMITED, biResult.getResult());
-        
-    }
 
-    
+    }
 
     private void registerCommitHandler() {
         DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject> flowTestCommitHandler = new DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>() {
-            
-            
+
             @Override
             public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<InstanceIdentifier<? extends DataObject>, DataObject> requestCommit(
                     DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification) {
                 modificationCapture = modification;
                 return CommitHandlersTransactions.allwaysSuccessfulTransaction(modification);
             }
-            
-            
+
         };
-        Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> registration = baDataService.registerCommitHandler(FLOWS_PATH_BA, flowTestCommitHandler);
+        Registration<DataCommitHandler<InstanceIdentifier<? extends DataObject>, DataObject>> registration = baDataService
+                .registerCommitHandler(FLOWS_PATH_BA, flowTestCommitHandler);
         assertNotNull(registration);
     }
-    
-    private CompositeNode createXmlFlow() {
-        
-        FlowBuilder flow = new FlowBuilder();
-        MatchBuilder match = new MatchBuilder();
-        VlanMatchBuilder vlanBuilder = new VlanMatchBuilder();
-        VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
-        VlanId vlanId = new VlanId(10);
-        vlanBuilder.setVlanId(vlanIdBuilder.setVlanId(vlanId).build());
-        match.setVlanMatch(vlanBuilder.build());
 
+    private CompositeNode createTestFlow() {
+        FlowBuilder flow = new FlowBuilder();
         flow.setKey(FLOW_KEY);
+        Short tableId = 0;
+        flow.setTableId(tableId);
+        MatchBuilder match = new MatchBuilder();
+        match.setIpMatch(new IpMatchBuilder().setIpProto(IpVersion.Ipv4).build());
+        Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
+        // ipv4Match.setIpv4Destination(new Ipv4Prefix(cliInput.get(4)));
+        Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24");
+        ipv4Match.setIpv4Destination(prefix);
+        Ipv4Match i4m = ipv4Match.build();
+        match.setLayer3Match(i4m);
         flow.setMatch(match.build());
-        flow.setNode(NODE_REF);
-        InstructionsBuilder instructions = new InstructionsBuilder();
-        InstructionBuilder instruction = new InstructionBuilder();
-        instruction.setOrder(10);
-        ApplyActionsBuilder applyActions = new ApplyActionsBuilder();
-        List<Action> actionList = new ArrayList<>();
-        PopMplsActionBuilder popMplsAction = new PopMplsActionBuilder();
-        popMplsAction.setEthernetType(34);
-        actionList.add(new ActionBuilder().setAction(popMplsAction.build()).setOrder(0).build());
 
-        applyActions.setAction(actionList );
-        
 
 
-        instruction.setInstruction(applyActions.build());
+        // Create a drop action
+        /*
+         * Note: We are mishandling drop actions DropAction dropAction = new
+         * DropActionBuilder().build(); ActionBuilder ab = new ActionBuilder();
+         * ab.setAction(dropAction);
+         */
+
+        DecNwTtl decNwTtl = new DecNwTtlBuilder().build();
+        ActionBuilder ab = new ActionBuilder();
+        ActionKey actionKey = new ActionKey(0);
+        ab.setKey(actionKey );
+        ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
+
+        // Add our drop action to a list
+        List<Action> actionList = new ArrayList<Action>();
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        InstructionBuilder ib = new InstructionBuilder();
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
 
+        // Put our Instruction in a list of Instructions
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        instructions.add(ib.build());
+        isb.setInstruction(instructions);
 
-        List<Instruction> instructionList = Collections.<Instruction>singletonList(instruction.build());
-        instructions.setInstruction(instructionList );
+        // Add our instructions to the flow
+        flow.setInstructions(isb.build());
 
-        flow.setInstructions(instructions.build());
-        
+        flow.setPriority(2);
+        flow.setFlowName("Foo Name");
         CompositeNode domFlow = mappingService.toDataDom(flow.build());
         return domFlow;
     }
index 338561a..9b81429 100644 (file)
@@ -59,14 +59,14 @@ public abstract class AbstractTest {
                 mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(), //
                 systemProperty("osgi.bundles.defaultStartLevel").value("4"),
 
-                
-                
                 mdSalCoreBundles(),
 
                 bindingAwareSalBundles(),
                 configMinumumBundles(),
                 // BASE Models
-                baseModelBundles(), flowCapableModelBundles(), junitAndMockitoBundles());
+                baseModelBundles(), 
+                flowCapableModelBundles(), 
+                junitAndMockitoBundles());
     }
     
 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.