Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.flowmanager; |
| 2 | |
| 3 | import java.util.Collection; |
| 4 | import java.util.Collections; |
| 5 | import java.util.HashSet; |
| 6 | import java.util.Set; |
| 7 | |
| 8 | import net.onrc.onos.core.matchaction.MatchActionPlan; |
| 9 | import net.onrc.onos.core.matchaction.action.OutputAction; |
| 10 | import net.onrc.onos.core.matchaction.match.PacketMatch; |
| 11 | import 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 Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 20 | public class SingleDstTreeFlow implements Flow { |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 21 | protected final FlowId id; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 22 | 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 Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 38 | this.id = new FlowId(id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 39 | 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 Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 49 | public FlowId getId() { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 50 | 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 | } |