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 | |
Toshio Koide | d7d550c | 2014-08-21 16:08:55 -0700 | [diff] [blame^] | 9 | import net.onrc.onos.api.flowmanager.FlowBatchOperation.Operator; |
| 10 | import net.onrc.onos.core.matchaction.MatchActionIdGenerator; |
Ray Milkey | 42ae1b5 | 2014-08-15 16:37:06 -0700 | [diff] [blame] | 11 | import net.onrc.onos.core.matchaction.MatchActionOperations; |
Toshio Koide | d7d550c | 2014-08-21 16:08:55 -0700 | [diff] [blame^] | 12 | import net.onrc.onos.core.matchaction.MatchActionOperationsIdGenerator; |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 13 | import net.onrc.onos.core.matchaction.action.Action; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 14 | import net.onrc.onos.core.matchaction.match.PacketMatch; |
| 15 | import net.onrc.onos.core.util.SwitchPort; |
| 16 | |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 17 | import com.google.common.collect.ImmutableList; |
| 18 | import com.google.common.collect.ImmutableSet; |
| 19 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 20 | /** |
Toshio Koide | 7894ca0 | 2014-08-15 14:30:13 -0700 | [diff] [blame] | 21 | * 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] | 22 | * layer. |
| 23 | * <p> |
| 24 | * NOTE: This class might generate the MatchActionPlan which includes the MAC |
| 25 | * address modifications or other the label-switching-like schemes. |
| 26 | */ |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 27 | public class SingleDstTreeFlow extends Flow { |
| 28 | private final PacketMatch match; |
| 29 | private final Set<SwitchPort> ingressPorts; |
| 30 | private final Tree tree; |
| 31 | private final List<Action> actions; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Creates new instance using Tree object. |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 35 | * <p> |
| 36 | * For now, the actions parameter must be the list of a single |
| 37 | * ModifyDstMacAction object and a single OutputAction object. But in the |
| 38 | * future, the parameter should accept any type of the list of IAction |
| 39 | * objects. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 40 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 41 | * @param id ID for this object |
| 42 | * @param match the traffic filter for the tree |
| 43 | * @param ingressPorts the set of ingress ports of the tree |
| 44 | * @param tree the Tree object specifying tree topology for this object |
| 45 | * @param actions the list of Action objects at the egress edge switch |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 46 | */ |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 47 | public SingleDstTreeFlow(FlowId id, PacketMatch match, |
| 48 | Collection<SwitchPort> ingressPorts, Tree tree, List<Action> actions) { |
| 49 | super(id); |
| 50 | this.match = checkNotNull(match); |
| 51 | this.ingressPorts = ImmutableSet.copyOf(checkNotNull(ingressPorts)); |
| 52 | this.tree = checkNotNull(tree); |
| 53 | this.actions = ImmutableList.copyOf(checkNotNull(actions)); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 54 | |
| 55 | // TODO: check if the tree is a MP2P tree. |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 56 | // TODO: check consistency among ingressPorts, tree, and actions. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 57 | } |
| 58 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 59 | /** |
| 60 | * Gets the ingress ports of the tree. |
| 61 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 62 | * @return the ingress ports of the tree |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 63 | */ |
| 64 | public Collection<SwitchPort> getIngressPorts() { |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 65 | return ingressPorts; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Gets the tree. |
| 70 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 71 | * @return the tree object |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 72 | */ |
| 73 | public Tree getTree() { |
| 74 | return tree; |
| 75 | } |
| 76 | |
| 77 | /** |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 78 | * Gets the list of actions at the egress edge switch. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 79 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 80 | * @return the list of actions at the egress edge switch |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 81 | */ |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 82 | public List<Action> getEgressActions() { |
| 83 | return actions; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 84 | } |
Toshio Koide | 5c5ca10 | 2014-08-19 00:49:52 -0700 | [diff] [blame] | 85 | |
| 86 | @Override |
| 87 | public PacketMatch getMatch() { |
| 88 | return match; |
| 89 | } |
| 90 | |
| 91 | @Override |
Toshio Koide | d7d550c | 2014-08-21 16:08:55 -0700 | [diff] [blame^] | 92 | public List<MatchActionOperations> compile(Operator op, |
| 93 | MatchActionIdGenerator maIdGenerator, |
| 94 | MatchActionOperationsIdGenerator maoIdGenerator) { |
Toshio Koide | 5c5ca10 | 2014-08-19 00:49:52 -0700 | [diff] [blame] | 95 | // TODO Auto-generated method stub |
| 96 | return null; |
| 97 | } |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 98 | } |