Add support for specifying the actions when a Flow is created by the user.
The user could either:
(a) Specify each action per Flow Entry (when the Flow Entries are provided
by the user).
(b) Specify the additional actions (apart of ACTION_OUTPUT) for the
first Flow Entry. E.g., if the Flow Entry is overwriting various
fields. Those actions are stored in the Flow Path header, so
they can be used after the Flow Entries are created by
the ONOS Shortest Path computation.
diff --git a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
index 9f197a7..7bc0aac 100644
--- a/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
+++ b/src/test/java/net/onrc/onos/ofcontroller/flowmanager/FlowManagerTest.java
@@ -1086,7 +1086,7 @@
flowEntry1.setOutPort(new Port((short) 11));
flowEntry1.setFlowEntryId(new FlowEntryId(1));
flowEntry1.setFlowEntryMatch(new FlowEntryMatch());
- flowEntry1.setFlowEntryActions(new ArrayList<FlowEntryAction>());
+ flowEntry1.setFlowEntryActions(new FlowEntryActions());
flowEntry1.setFlowEntryErrorState(new FlowEntryErrorState());
FlowEntry flowEntry2 = new FlowEntry();
@@ -1096,7 +1096,7 @@
flowEntry2.setOutPort(new Port((short) 2));
flowEntry2.setFlowEntryId(new FlowEntryId(2));
flowEntry2.setFlowEntryMatch(new FlowEntryMatch());
- flowEntry2.setFlowEntryActions(new ArrayList<FlowEntryAction>());
+ flowEntry2.setFlowEntryActions(new FlowEntryActions());
flowEntry2.setFlowEntryErrorState(new FlowEntryErrorState());
DataPath dataPath = new DataPath();
@@ -1147,6 +1147,11 @@
// instantiate required objects
FlowManager fm = new FlowManager();
+ FlowEntryAction action = new FlowEntryAction();
+ action.setActionOutput(new Port((short)2));
+ FlowEntryActions actions = new FlowEntryActions();
+ actions.addAction(action);
+
// setup expectations
expectInitWithContext();
expect(iFlowEntry.getFlowEntryId()).andReturn(new FlowEntryId(123).toString());
@@ -1164,7 +1169,7 @@
expect(iFlowEntry.getMatchIpToS()).andReturn(new Byte((byte)0x3));
expect(iFlowEntry.getMatchSrcTcpUdpPort()).andReturn(new Short((short)40000));
expect(iFlowEntry.getMatchDstTcpUdpPort()).andReturn(new Short((short)80));
- expect(iFlowEntry.getActionOutputPort()).andReturn(new Short((short) 2));
+ expect(iFlowEntry.getActions()).andReturn(actions.toString());
expect(floodlightProvider.getOFMessageFactory()).andReturn(basicFactory);
expect(basicFactory.getMessage(OFType.FLOW_MOD)).andReturn(new OFFlowMod());
expect(iofSwitch.getStringId()).andReturn(new Dpid(100).toString());