blob: 89f1efd66f670b0d15e485df25784981bdd68555 [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;
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -07009import net.onrc.onos.core.matchaction.MatchActionId;
Ray Milkey42ae1b52014-08-15 16:37:06 -070010import net.onrc.onos.core.matchaction.MatchActionOperations;
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -070011import net.onrc.onos.core.matchaction.MatchActionOperationsId;
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;
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -070015import net.onrc.onos.core.util.IdGenerator;
Toshio Koidea03915e2014-07-01 18:39:52 -070016import net.onrc.onos.core.util.SwitchPort;
17
Pavlin Radoslavovb05aac92014-08-26 18:26:10 -070018import org.apache.commons.lang3.tuple.Pair;
19
Toshio Koidea03915e2014-07-01 18:39:52 -070020/**
Toshio Koide7894ca02014-08-15 14:30:13 -070021 * A Flow object expressing the point-to-multipoints tree flow for the packet
Toshio Koidea03915e2014-07-01 18:39:52 -070022 * layer.
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070023 * <p>
24 * NOTE: This class is not fully supported for the August release.
Toshio Koidea03915e2014-07-01 18:39:52 -070025 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070026public class SingleSrcTreeFlow extends Flow {
Toshio Koidea03915e2014-07-01 18:39:52 -070027 protected PacketMatch match;
28 protected SwitchPort ingressPort;
29 protected Tree tree;
30 protected Set<Pair<Dpid, OutputAction>> outputActions;
31
32 /**
33 * Creates new instance using Tree object.
34 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070035 * @param id ID for this object
36 * @param match the traffic filter for the tree
37 * @param ingressPort an ingress port of the tree
38 * @param tree the tree object specifying tree topology for this object
39 * @param outputActions the set of the pairs of the switch DPID and
40 * OutputAction object at the egress edge switchs
Toshio Koidea03915e2014-07-01 18:39:52 -070041 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070042 public SingleSrcTreeFlow(FlowId id, PacketMatch match,
Toshio Koidea03915e2014-07-01 18:39:52 -070043 SwitchPort ingressPort, Tree tree, Set<Pair<Dpid, OutputAction>> outputActions) {
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070044 super(id);
45 this.match = checkNotNull(match);
46 this.ingressPort = checkNotNull(ingressPort);
47 this.tree = checkNotNull(tree);
48 this.outputActions = checkNotNull(outputActions);
Toshio Koidea03915e2014-07-01 18:39:52 -070049
50 // TODO: check if the tree is a P2MP tree.
51 // TODO: check consistency among rootPort, tree, and actions.
52 }
53
Toshio Koidea03915e2014-07-01 18:39:52 -070054 /**
55 * Gets the ingress port (the root) of the tree.
56 *
57 * @return The ingress port of the tree.
58 */
59 public SwitchPort getIngressPort() {
60 return ingressPort;
61 }
62
63 /**
64 * Gets the tree.
65 *
66 * @return The tree object.
67 */
68 public Tree getTree() {
69 return tree;
70 }
71
72 /**
73 * Gets the output actions for the tree.
74 *
75 * @return The set of the pairs of Dpid and OutputAction object.
76 */
Toshio Koidec963a8d2014-07-21 17:47:48 -070077 public Set<Pair<Dpid, OutputAction>> getOutputActions() {
Toshio Koidea03915e2014-07-01 18:39:52 -070078 return outputActions;
79 }
Toshio Koide5c5ca102014-08-19 00:49:52 -070080
81 @Override
82 public PacketMatch getMatch() {
83 return match;
84 }
85
86 @Override
Toshio Koided7d550c2014-08-21 16:08:55 -070087 public List<MatchActionOperations> compile(Operator op,
Sho SHIMIZU7cd8a422014-08-27 16:05:21 -070088 IdGenerator<MatchActionId> maIdGenerator,
89 IdGenerator<MatchActionOperationsId> maoIdGenerator) {
Toshio Koide5c5ca102014-08-19 00:49:52 -070090 // TODO Auto-generated method stub
91 return null;
92 }
Toshio Koidea03915e2014-07-01 18:39:52 -070093}