Update the Flow classes.
- Changed all Flow classes to use FlowId object on its constructor for their ID.
- Implement equals() and hashCode() for all Flow classes based on FlowId.
- Changed SingleDstTreeFlow class to accept the list of Action objects on its constructor.
- Updated the Tree class's constructor to accept the list of links.
- This task is a part of ONOS-1841, ONOS-1694, ONOS-1741.
Change-Id: I930007ce7f92b5bbde4efef9eb9ab893c356abf1
diff --git a/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java b/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java
index af403ed..92533cb 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/SingleDstTreeFlow.java
@@ -1,15 +1,19 @@
package net.onrc.onos.api.flowmanager;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import net.onrc.onos.core.matchaction.MatchActionOperations;
-import net.onrc.onos.core.matchaction.action.OutputAction;
+import net.onrc.onos.core.matchaction.action.Action;
import net.onrc.onos.core.matchaction.match.PacketMatch;
import net.onrc.onos.core.util.SwitchPort;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
/**
* A Flow object expressing the multipoints-to-point tree flow for the packet
* layer.
@@ -17,37 +21,36 @@
* NOTE: This class might generate the MatchActionPlan which includes the MAC
* address modifications or other the label-switching-like schemes.
*/
-public class SingleDstTreeFlow implements Flow {
- protected final FlowId id;
- protected PacketMatch match;
- protected Set<SwitchPort> ingressPorts;
- protected Tree tree;
- protected OutputAction outputAction;
+public class SingleDstTreeFlow extends Flow {
+ private final PacketMatch match;
+ private final Set<SwitchPort> ingressPorts;
+ private final Tree tree;
+ private final List<Action> actions;
/**
* Creates new instance using Tree object.
+ * <p>
+ * For now, the actions parameter must be the list of a single
+ * ModifyDstMacAction object and a single OutputAction object. But in the
+ * future, the parameter should accept any type of the list of IAction
+ * objects.
*
- * @param id ID for this object.
- * @param match Traffic filter for the tree.
- * @param ingressPorts A set of ingress ports of the tree.
- * @param tree Tree object specifying tree topology for this object.
- * @param outputAction OutputAction object at the egress edge switch.
+ * @param id ID for this object
+ * @param match the traffic filter for the tree
+ * @param ingressPorts the set of ingress ports of the tree
+ * @param tree the Tree object specifying tree topology for this object
+ * @param actions the list of Action objects at the egress edge switch
*/
- public SingleDstTreeFlow(String id, PacketMatch match,
- Collection<SwitchPort> ingressPorts, Tree tree, OutputAction outputAction) {
- this.id = new FlowId(id);
- this.match = match;
- this.ingressPorts = new HashSet<SwitchPort>(ingressPorts);
- this.tree = tree;
- this.outputAction = outputAction;
+ public SingleDstTreeFlow(FlowId id, PacketMatch match,
+ Collection<SwitchPort> ingressPorts, Tree tree, List<Action> actions) {
+ super(id);
+ this.match = checkNotNull(match);
+ this.ingressPorts = ImmutableSet.copyOf(checkNotNull(ingressPorts));
+ this.tree = checkNotNull(tree);
+ this.actions = ImmutableList.copyOf(checkNotNull(actions));
// TODO: check if the tree is a MP2P tree.
- // TODO: check consistency among inPorts, tree, and action.
- }
-
- @Override
- public FlowId getId() {
- return id;
+ // TODO: check consistency among ingressPorts, tree, and actions.
}
@Override
@@ -64,27 +67,27 @@
/**
* Gets the ingress ports of the tree.
*
- * @return The ingress ports of the tree.
+ * @return the ingress ports of the tree
*/
public Collection<SwitchPort> getIngressPorts() {
- return Collections.unmodifiableCollection(ingressPorts);
+ return ingressPorts;
}
/**
* Gets the tree.
*
- * @return The tree object.
+ * @return the tree object
*/
public Tree getTree() {
return tree;
}
/**
- * Gets the output action for the tree.
+ * Gets the list of actions at the egress edge switch.
*
- * @return The OutputAction object.
+ * @return the list of actions at the egress edge switch
*/
- public OutputAction getOutputAction() {
- return outputAction;
+ public List<Action> getEgressActions() {
+ return actions;
}
}