blob: 60be78f33f4cf17cfbb489fd62c2aec82d058722 [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 Koidea03915e2014-07-01 18:39:52 -07005import java.util.Collection;
Toshio Koide9aa4c0f2014-08-11 16:06:44 -07006import java.util.List;
Toshio Koidea03915e2014-07-01 18:39:52 -07007import java.util.Set;
8
Toshio Koided7d550c2014-08-21 16:08:55 -07009import net.onrc.onos.api.flowmanager.FlowBatchOperation.Operator;
10import net.onrc.onos.core.matchaction.MatchActionIdGenerator;
Ray Milkey42ae1b52014-08-15 16:37:06 -070011import net.onrc.onos.core.matchaction.MatchActionOperations;
Toshio Koided7d550c2014-08-21 16:08:55 -070012import net.onrc.onos.core.matchaction.MatchActionOperationsIdGenerator;
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070013import net.onrc.onos.core.matchaction.action.Action;
Toshio Koidea03915e2014-07-01 18:39:52 -070014import net.onrc.onos.core.matchaction.match.PacketMatch;
15import net.onrc.onos.core.util.SwitchPort;
16
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070017import com.google.common.collect.ImmutableList;
18import com.google.common.collect.ImmutableSet;
19
Toshio Koidea03915e2014-07-01 18:39:52 -070020/**
Toshio Koide7894ca02014-08-15 14:30:13 -070021 * A Flow object expressing the multipoints-to-point tree flow for the packet
Toshio Koidea03915e2014-07-01 18:39:52 -070022 * layer.
23 * <p>
24 * NOTE: This class might generate the MatchActionPlan which includes the MAC
25 * address modifications or other the label-switching-like schemes.
26 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070027public class SingleDstTreeFlow extends Flow {
28 private final PacketMatch match;
29 private final Set<SwitchPort> ingressPorts;
30 private final Tree tree;
31 private final List<Action> actions;
Toshio Koidea03915e2014-07-01 18:39:52 -070032
33 /**
34 * Creates new instance using Tree object.
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070035 * <p>
36 * For now, the actions parameter must be the list of a single
37 * ModifyDstMacAction object and a single OutputAction object. But in the
38 * future, the parameter should accept any type of the list of IAction
39 * objects.
Toshio Koidea03915e2014-07-01 18:39:52 -070040 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070041 * @param id ID for this object
42 * @param match the traffic filter for the tree
43 * @param ingressPorts the set of ingress ports of the tree
44 * @param tree the Tree object specifying tree topology for this object
45 * @param actions the list of Action objects at the egress edge switch
Toshio Koidea03915e2014-07-01 18:39:52 -070046 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070047 public SingleDstTreeFlow(FlowId id, PacketMatch match,
48 Collection<SwitchPort> ingressPorts, Tree tree, List<Action> actions) {
49 super(id);
50 this.match = checkNotNull(match);
51 this.ingressPorts = ImmutableSet.copyOf(checkNotNull(ingressPorts));
52 this.tree = checkNotNull(tree);
53 this.actions = ImmutableList.copyOf(checkNotNull(actions));
Toshio Koidea03915e2014-07-01 18:39:52 -070054
55 // TODO: check if the tree is a MP2P tree.
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070056 // TODO: check consistency among ingressPorts, tree, and actions.
Toshio Koidea03915e2014-07-01 18:39:52 -070057 }
58
Toshio Koidea03915e2014-07-01 18:39:52 -070059 /**
60 * Gets the ingress ports of the tree.
61 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070062 * @return the ingress ports of the tree
Toshio Koidea03915e2014-07-01 18:39:52 -070063 */
64 public Collection<SwitchPort> getIngressPorts() {
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070065 return ingressPorts;
Toshio Koidea03915e2014-07-01 18:39:52 -070066 }
67
68 /**
69 * Gets the tree.
70 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070071 * @return the tree object
Toshio Koidea03915e2014-07-01 18:39:52 -070072 */
73 public Tree getTree() {
74 return tree;
75 }
76
77 /**
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070078 * Gets the list of actions at the egress edge switch.
Toshio Koidea03915e2014-07-01 18:39:52 -070079 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070080 * @return the list of actions at the egress edge switch
Toshio Koidea03915e2014-07-01 18:39:52 -070081 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070082 public List<Action> getEgressActions() {
83 return actions;
Toshio Koidea03915e2014-07-01 18:39:52 -070084 }
Toshio Koide5c5ca102014-08-19 00:49:52 -070085
86 @Override
87 public PacketMatch getMatch() {
88 return match;
89 }
90
91 @Override
Toshio Koided7d550c2014-08-21 16:08:55 -070092 public List<MatchActionOperations> compile(Operator op,
93 MatchActionIdGenerator maIdGenerator,
94 MatchActionOperationsIdGenerator maoIdGenerator) {
Toshio Koide5c5ca102014-08-19 00:49:52 -070095 // TODO Auto-generated method stub
96 return null;
97 }
Toshio Koidea03915e2014-07-01 18:39:52 -070098}