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/PathFlow.java b/src/main/java/net/onrc/onos/api/flowmanager/PathFlow.java
index d1b10f6..0cc35ce 100644
--- a/src/main/java/net/onrc/onos/api/flowmanager/PathFlow.java
+++ b/src/main/java/net/onrc/onos/api/flowmanager/PathFlow.java
@@ -1,64 +1,41 @@
package net.onrc.onos.api.flowmanager;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.util.List;
-import net.onrc.onos.core.matchaction.MatchActionOperations;
import net.onrc.onos.core.matchaction.action.Action;
-import net.onrc.onos.core.matchaction.match.Match;
import net.onrc.onos.core.util.PortNumber;
/**
- * A path flow.
- * <p>
- * TODO: Think this: Should this class be an abstract class? Is it enough to
- * have only the PacketPathFlow and OpticalPathFlow classes?
+ * An abstract class expressing a path flow.
*/
-public class PathFlow implements Flow {
- protected final FlowId id;
- protected Match match;
- protected PortNumber ingressPort;
- protected Path path;
- protected List<Action> egressActions;
+public abstract class PathFlow extends Flow {
+ private final PortNumber ingressPort;
+ private final Path path;
+ private final List<Action> egressActions;
/**
- * Constructor.
+ * Creates the new flow instance.
*
- * @param id ID for this new PathFlow object.
- * @param match Match object at the ingress node of the path.
- * @param ingressPort The ingress port number at the ingress node of the
- * path.
- * @param path Path between ingress and egress edge node.
- * @param egressActions The list of Action objects at the egress edge node.
+ * @param id ID for this new PathFlow object
+ * @param ingressPort the ingress port number at the ingress node of the
+ * path
+ * @param path the Path between ingress and egress edge node
+ * @param egressActions the list of Action objects at the egress edge node
*/
- public PathFlow(String id,
- Match match, PortNumber ingressPort, Path path, List<Action> egressActions) {
- this.id = new FlowId(id);
- this.match = match;
- this.ingressPort = ingressPort;
- this.path = path;
- this.egressActions = egressActions;
- }
-
- @Override
- public FlowId getId() {
- return id;
- }
-
- @Override
- public Match getMatch() {
- return match;
- }
-
- @Override
- public MatchActionOperations compile() {
- // TODO Auto-generated method stub
- return null;
+ public PathFlow(FlowId id,
+ PortNumber ingressPort, Path path, List<Action> egressActions) {
+ super(id);
+ this.ingressPort = checkNotNull(ingressPort);
+ this.path = checkNotNull(path);
+ this.egressActions = checkNotNull(egressActions);
}
/**
* Gets the ingress port number at the ingress node of the path.
*
- * @return The ingress port number at the ingress node of the path.
+ * @return the ingress port number at the ingress node of the path
*/
public PortNumber getIngressPortNumber() {
return ingressPort;
@@ -67,7 +44,7 @@
/**
* Gets the path from ingress to egress edge node.
*
- * @return The path object from ingress to egress edge node.
+ * @return the path object from ingress to egress edge node
*/
public Path getPath() {
return path;
@@ -76,7 +53,7 @@
/**
* Gets the list of Action objects at the egress edge node.
*
- * @return The list of Action objects at the egress edge node.
+ * @return the list of Action objects at the egress edge node
*/
public List<Action> getEgressActions() {
return egressActions;