blob: 92533cbac7ce3e0bc7692c526dc3ea1331c4605e [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
56 @Override
57 public PacketMatch getMatch() {
58 return match;
59 }
60
61 @Override
Ray Milkey42ae1b52014-08-15 16:37:06 -070062 public MatchActionOperations compile() {
Toshio Koidea03915e2014-07-01 18:39:52 -070063 // TODO Auto-generated method stub
64 return null;
65 }
66
67 /**
68 * Gets the ingress ports of the tree.
69 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070070 * @return the ingress ports of the tree
Toshio Koidea03915e2014-07-01 18:39:52 -070071 */
72 public Collection<SwitchPort> getIngressPorts() {
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070073 return ingressPorts;
Toshio Koidea03915e2014-07-01 18:39:52 -070074 }
75
76 /**
77 * Gets the tree.
78 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070079 * @return the tree object
Toshio Koidea03915e2014-07-01 18:39:52 -070080 */
81 public Tree getTree() {
82 return tree;
83 }
84
85 /**
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070086 * Gets the list of actions at the egress edge switch.
Toshio Koidea03915e2014-07-01 18:39:52 -070087 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070088 * @return the list of actions at the egress edge switch
Toshio Koidea03915e2014-07-01 18:39:52 -070089 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070090 public List<Action> getEgressActions() {
91 return actions;
Toshio Koidea03915e2014-07-01 18:39:52 -070092 }
93}