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 | 2c67a2d | 2014-08-27 11:30:56 -0700 | [diff] [blame] | 5 | import java.util.LinkedList; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 6 | import java.util.List; |
| 7 | |
Toshio Koide | d8b077a | 2014-08-13 10:47:21 -0700 | [diff] [blame] | 8 | import net.onrc.onos.core.matchaction.action.Action; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 9 | import net.onrc.onos.core.util.PortNumber; |
| 10 | |
| 11 | /** |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 12 | * An abstract class expressing a path flow. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 13 | */ |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 14 | public abstract class PathFlow extends Flow { |
| 15 | private final PortNumber ingressPort; |
| 16 | private final Path path; |
| 17 | private final List<Action> egressActions; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 18 | |
| 19 | /** |
Toshio Koide | 2c67a2d | 2014-08-27 11:30:56 -0700 | [diff] [blame] | 20 | * Default constructor for Kryo deserialization. |
| 21 | */ |
| 22 | @Deprecated |
| 23 | protected PathFlow() { |
| 24 | ingressPort = null; |
| 25 | path = null; |
| 26 | egressActions = null; |
| 27 | } |
| 28 | |
| 29 | /** |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 30 | * Creates the new flow instance. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 31 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 32 | * @param id ID for this new PathFlow object |
| 33 | * @param ingressPort the ingress port number at the ingress node of the |
| 34 | * path |
| 35 | * @param path the Path between ingress and egress edge node |
| 36 | * @param egressActions the list of Action objects at the egress edge node |
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 | public PathFlow(FlowId id, |
| 39 | PortNumber ingressPort, Path path, List<Action> egressActions) { |
| 40 | super(id); |
| 41 | this.ingressPort = checkNotNull(ingressPort); |
Toshio Koide | 2c67a2d | 2014-08-27 11:30:56 -0700 | [diff] [blame] | 42 | this.path = new Path(checkNotNull(path)); |
| 43 | this.egressActions = new LinkedList<>(checkNotNull(egressActions)); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Gets the ingress port number at the ingress node of the path. |
| 48 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 49 | * @return the ingress port number at the ingress node of the path |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 50 | */ |
| 51 | public PortNumber getIngressPortNumber() { |
| 52 | return ingressPort; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Gets the path from ingress to egress edge node. |
| 57 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 58 | * @return the path object from ingress to egress edge node |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 59 | */ |
| 60 | public Path getPath() { |
| 61 | return path; |
| 62 | } |
| 63 | |
| 64 | /** |
Toshio Koide | d8b077a | 2014-08-13 10:47:21 -0700 | [diff] [blame] | 65 | * Gets the list of Action objects at the egress edge node. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 66 | * |
Toshio Koide | 9aa4c0f | 2014-08-11 16:06:44 -0700 | [diff] [blame] | 67 | * @return the list of Action objects at the egress edge node |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 68 | */ |
Toshio Koide | d8b077a | 2014-08-13 10:47:21 -0700 | [diff] [blame] | 69 | public List<Action> getEgressActions() { |
Toshio Koide | c963a8d | 2014-07-21 17:47:48 -0700 | [diff] [blame] | 70 | return egressActions; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 71 | } |
| 72 | } |