blob: 3e70f4b30ffd72fbb93973c527361268d69b4c17 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.api.flowmanager;
2
Toshio Koide9aa4c0f2014-08-11 16:06:44 -07003import static com.google.common.base.Preconditions.checkNotNull;
4
Toshio Koide5c5ca102014-08-19 00:49:52 -07005import java.util.List;
Toshio Koidea03915e2014-07-01 18:39:52 -07006import java.util.Set;
7
Toshio Koided7d550c2014-08-21 16:08:55 -07008import net.onrc.onos.api.flowmanager.FlowBatchOperation.Operator;
9import net.onrc.onos.core.matchaction.MatchActionIdGenerator;
Ray Milkey42ae1b52014-08-15 16:37:06 -070010import net.onrc.onos.core.matchaction.MatchActionOperations;
Toshio Koided7d550c2014-08-21 16:08:55 -070011import net.onrc.onos.core.matchaction.MatchActionOperationsIdGenerator;
Toshio Koidea03915e2014-07-01 18:39:52 -070012import net.onrc.onos.core.matchaction.action.OutputAction;
13import net.onrc.onos.core.matchaction.match.PacketMatch;
14import net.onrc.onos.core.util.Dpid;
Toshio Koidea03915e2014-07-01 18:39:52 -070015import net.onrc.onos.core.util.SwitchPort;
16
Pavlin Radoslavovb05aac92014-08-26 18:26:10 -070017import org.apache.commons.lang3.tuple.Pair;
18
Toshio Koidea03915e2014-07-01 18:39:52 -070019/**
Toshio Koide7894ca02014-08-15 14:30:13 -070020 * A Flow object expressing the point-to-multipoints tree flow for the packet
Toshio Koidea03915e2014-07-01 18:39:52 -070021 * layer.
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070022 * <p>
23 * NOTE: This class is not fully supported for the August release.
Toshio Koidea03915e2014-07-01 18:39:52 -070024 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070025public class SingleSrcTreeFlow extends Flow {
Toshio Koidea03915e2014-07-01 18:39:52 -070026 protected PacketMatch match;
27 protected SwitchPort ingressPort;
28 protected Tree tree;
29 protected Set<Pair<Dpid, OutputAction>> outputActions;
30
31 /**
32 * Creates new instance using Tree object.
33 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070034 * @param id ID for this object
35 * @param match the traffic filter for the tree
36 * @param ingressPort an ingress port of the tree
37 * @param tree the tree object specifying tree topology for this object
38 * @param outputActions the set of the pairs of the switch DPID and
39 * OutputAction object at the egress edge switchs
Toshio Koidea03915e2014-07-01 18:39:52 -070040 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070041 public SingleSrcTreeFlow(FlowId id, PacketMatch match,
Toshio Koidea03915e2014-07-01 18:39:52 -070042 SwitchPort ingressPort, Tree tree, Set<Pair<Dpid, OutputAction>> outputActions) {
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070043 super(id);
44 this.match = checkNotNull(match);
45 this.ingressPort = checkNotNull(ingressPort);
46 this.tree = checkNotNull(tree);
47 this.outputActions = checkNotNull(outputActions);
Toshio Koidea03915e2014-07-01 18:39:52 -070048
49 // TODO: check if the tree is a P2MP tree.
50 // TODO: check consistency among rootPort, tree, and actions.
51 }
52
Toshio Koidea03915e2014-07-01 18:39:52 -070053 /**
54 * Gets the ingress port (the root) of the tree.
55 *
56 * @return The ingress port of the tree.
57 */
58 public SwitchPort getIngressPort() {
59 return ingressPort;
60 }
61
62 /**
63 * Gets the tree.
64 *
65 * @return The tree object.
66 */
67 public Tree getTree() {
68 return tree;
69 }
70
71 /**
72 * Gets the output actions for the tree.
73 *
74 * @return The set of the pairs of Dpid and OutputAction object.
75 */
Toshio Koidec963a8d2014-07-21 17:47:48 -070076 public Set<Pair<Dpid, OutputAction>> getOutputActions() {
Toshio Koidea03915e2014-07-01 18:39:52 -070077 return outputActions;
78 }
Toshio Koide5c5ca102014-08-19 00:49:52 -070079
80 @Override
81 public PacketMatch getMatch() {
82 return match;
83 }
84
85 @Override
Toshio Koided7d550c2014-08-21 16:08:55 -070086 public List<MatchActionOperations> compile(Operator op,
87 MatchActionIdGenerator maIdGenerator,
88 MatchActionOperationsIdGenerator maoIdGenerator) {
Toshio Koide5c5ca102014-08-19 00:49:52 -070089 // TODO Auto-generated method stub
90 return null;
91 }
Toshio Koidea03915e2014-07-01 18:39:52 -070092}