Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.flowmanager; |
| 2 | |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 3 | import static com.google.common.base.Preconditions.checkNotNull; |
| 4 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 5 | import java.util.Collection; |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 6 | import java.util.List; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 7 | import java.util.Set; |
| 8 | |
Ray Milkey | 42ae1b5 | 2014-08-15 16:37:06 -0700 | [diff] [blame] | 9 | import net.onrc.onos.core.matchaction.MatchActionOperations; |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 10 | import net.onrc.onos.core.matchaction.action.Action; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 11 | import net.onrc.onos.core.matchaction.match.PacketMatch; |
| 12 | import net.onrc.onos.core.util.SwitchPort; |
| 13 | |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 14 | import com.google.common.collect.ImmutableList; |
| 15 | import com.google.common.collect.ImmutableSet; |
| 16 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 17 | /** |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 18 | * A Flow object expressing the multipoints-to-point tree flow for the packet |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 19 | * 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 Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 24 | public 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 Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * Creates new instance using Tree object. |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 32 | * <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 Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 37 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 38 | * @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 Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 43 | */ |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 44 | 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 Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 51 | |
| 52 | // TODO: check if the tree is a MP2P tree. |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 53 | // TODO: check consistency among ingressPorts, tree, and actions. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public PacketMatch getMatch() { |
| 58 | return match; |
| 59 | } |
| 60 | |
| 61 | @Override |
Ray Milkey | 42ae1b5 | 2014-08-15 16:37:06 -0700 | [diff] [blame] | 62 | public MatchActionOperations compile() { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 63 | // TODO Auto-generated method stub |
| 64 | return null; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Gets the ingress ports of the tree. |
| 69 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 70 | * @return the ingress ports of the tree |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 71 | */ |
| 72 | public Collection<SwitchPort> getIngressPorts() { |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 73 | return ingressPorts; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Gets the tree. |
| 78 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 79 | * @return the tree object |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 80 | */ |
| 81 | public Tree getTree() { |
| 82 | return tree; |
| 83 | } |
| 84 | |
| 85 | /** |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 86 | * Gets the list of actions at the egress edge switch. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 87 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 88 | * @return the list of actions at the egress edge switch |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 89 | */ |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 90 | public List<Action> getEgressActions() { |
| 91 | return actions; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 92 | } |
| 93 | } |