blob: 58c5b38359b5fa7c0418385929cad95d4454864a [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.api.flowmanager;
2
3import java.util.Collection;
4import java.util.Collections;
5import java.util.HashSet;
6import java.util.Set;
7
8import net.onrc.onos.core.matchaction.MatchActionPlan;
9import net.onrc.onos.core.matchaction.action.OutputAction;
10import net.onrc.onos.core.matchaction.match.PacketMatch;
11import net.onrc.onos.core.util.SwitchPort;
12
13/**
14 * An IFlow object expressing the multipoints-to-point tree flow for the packet
15 * layer.
16 * <p>
17 * NOTE: This class might generate the MatchActionPlan which includes the MAC
18 * address modifications or other the label-switching-like schemes.
19 */
Toshio Koidefad1cd52014-08-07 17:10:07 -070020public class SingleDstTreeFlow implements Flow {
Toshio Koide025a9152014-07-21 11:00:34 -070021 protected final FlowId id;
Toshio Koidea03915e2014-07-01 18:39:52 -070022 protected PacketMatch match;
23 protected Set<SwitchPort> ingressPorts;
24 protected Tree tree;
25 protected OutputAction outputAction;
26
27 /**
28 * Creates new instance using Tree object.
29 *
30 * @param id ID for this object.
31 * @param match Traffic filter for the tree.
32 * @param ingressPorts A set of ingress ports of the tree.
33 * @param tree Tree object specifying tree topology for this object.
34 * @param outputAction OutputAction object at the egress edge switch.
35 */
36 public SingleDstTreeFlow(String id, PacketMatch match,
37 Collection<SwitchPort> ingressPorts, Tree tree, OutputAction outputAction) {
Toshio Koide025a9152014-07-21 11:00:34 -070038 this.id = new FlowId(id);
Toshio Koidea03915e2014-07-01 18:39:52 -070039 this.match = match;
40 this.ingressPorts = new HashSet<SwitchPort>(ingressPorts);
41 this.tree = tree;
42 this.outputAction = outputAction;
43
44 // TODO: check if the tree is a MP2P tree.
45 // TODO: check consistency among inPorts, tree, and action.
46 }
47
48 @Override
Toshio Koide025a9152014-07-21 11:00:34 -070049 public FlowId getId() {
Toshio Koidea03915e2014-07-01 18:39:52 -070050 return id;
51 }
52
53 @Override
54 public PacketMatch getMatch() {
55 return match;
56 }
57
58 @Override
59 public MatchActionPlan compile() {
60 // TODO Auto-generated method stub
61 return null;
62 }
63
64 /**
65 * Gets the ingress ports of the tree.
66 *
67 * @return The ingress ports of the tree.
68 */
69 public Collection<SwitchPort> getIngressPorts() {
70 return Collections.unmodifiableCollection(ingressPorts);
71 }
72
73 /**
74 * Gets the tree.
75 *
76 * @return The tree object.
77 */
78 public Tree getTree() {
79 return tree;
80 }
81
82 /**
83 * Gets the output action for the tree.
84 *
85 * @return The OutputAction object.
86 */
87 public OutputAction getOutputAction() {
88 return outputAction;
89 }
90}