blob: 8ed1fb155866d05c4c0b91f6b13e216247c55fa6 [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
Ray Milkey42ae1b52014-08-15 16:37:06 -07009import net.onrc.onos.core.matchaction.MatchActionOperations;
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070010import net.onrc.onos.core.matchaction.action.Action;
Toshio Koidea03915e2014-07-01 18:39:52 -070011import net.onrc.onos.core.matchaction.match.PacketMatch;
12import net.onrc.onos.core.util.SwitchPort;
13
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070014import com.google.common.collect.ImmutableList;
15import com.google.common.collect.ImmutableSet;
16
Toshio Koidea03915e2014-07-01 18:39:52 -070017/**
Toshio Koide7894ca02014-08-15 14:30:13 -070018 * A Flow object expressing the multipoints-to-point tree flow for the packet
Toshio Koidea03915e2014-07-01 18:39:52 -070019 * layer.
20 * <p>
21 * NOTE: This class might generate the MatchActionPlan which includes the MAC
22 * address modifications or other the label-switching-like schemes.
23 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070024public class SingleDstTreeFlow extends Flow {
25 private final PacketMatch match;
26 private final Set<SwitchPort> ingressPorts;
27 private final Tree tree;
28 private final List<Action> actions;
Toshio Koidea03915e2014-07-01 18:39:52 -070029
30 /**
31 * Creates new instance using Tree object.
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070032 * <p>
33 * For now, the actions parameter must be the list of a single
34 * ModifyDstMacAction object and a single OutputAction object. But in the
35 * future, the parameter should accept any type of the list of IAction
36 * objects.
Toshio Koidea03915e2014-07-01 18:39:52 -070037 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070038 * @param id ID for this object
39 * @param match the traffic filter for the tree
40 * @param ingressPorts the set of ingress ports of the tree
41 * @param tree the Tree object specifying tree topology for this object
42 * @param actions the list of Action objects at the egress edge switch
Toshio Koidea03915e2014-07-01 18:39:52 -070043 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070044 public SingleDstTreeFlow(FlowId id, PacketMatch match,
45 Collection<SwitchPort> ingressPorts, Tree tree, List<Action> actions) {
46 super(id);
47 this.match = checkNotNull(match);
48 this.ingressPorts = ImmutableSet.copyOf(checkNotNull(ingressPorts));
49 this.tree = checkNotNull(tree);
50 this.actions = ImmutableList.copyOf(checkNotNull(actions));
Toshio Koidea03915e2014-07-01 18:39:52 -070051
52 // TODO: check if the tree is a MP2P tree.
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070053 // TODO: check consistency among ingressPorts, tree, and actions.
Toshio Koidea03915e2014-07-01 18:39:52 -070054 }
55
Toshio Koidea03915e2014-07-01 18:39:52 -070056 /**
57 * Gets the ingress ports of the tree.
58 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070059 * @return the ingress ports of the tree
Toshio Koidea03915e2014-07-01 18:39:52 -070060 */
61 public Collection<SwitchPort> getIngressPorts() {
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070062 return ingressPorts;
Toshio Koidea03915e2014-07-01 18:39:52 -070063 }
64
65 /**
66 * Gets the tree.
67 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070068 * @return the tree object
Toshio Koidea03915e2014-07-01 18:39:52 -070069 */
70 public Tree getTree() {
71 return tree;
72 }
73
74 /**
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070075 * Gets the list of actions at the egress edge switch.
Toshio Koidea03915e2014-07-01 18:39:52 -070076 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070077 * @return the list of actions at the egress edge switch
Toshio Koidea03915e2014-07-01 18:39:52 -070078 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070079 public List<Action> getEgressActions() {
80 return actions;
Toshio Koidea03915e2014-07-01 18:39:52 -070081 }
Toshio Koide5c5ca102014-08-19 00:49:52 -070082
83 @Override
84 public PacketMatch getMatch() {
85 return match;
86 }
87
88 @Override
89 public List<MatchActionOperations> compile(FlowBatchOperation.Operator op) {
90 // TODO Auto-generated method stub
91 return null;
92 }
Toshio Koidea03915e2014-07-01 18:39:52 -070093}