blob: 943140d07038133499baab742c801e2affadcbe2 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.api.flowmanager;
2
Toshio Koide9aa4c0f2014-08-11 16:06:44 -07003import static com.google.common.base.Preconditions.checkNotNull;
4
Toshio Koide2c67a2d2014-08-27 11:30:56 -07005import java.util.LinkedList;
Toshio Koidea03915e2014-07-01 18:39:52 -07006import java.util.List;
7
Toshio Koided8b077a2014-08-13 10:47:21 -07008import net.onrc.onos.core.matchaction.action.Action;
Toshio Koidea03915e2014-07-01 18:39:52 -07009import net.onrc.onos.core.util.PortNumber;
10
11/**
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070012 * An abstract class expressing a path flow.
Toshio Koidea03915e2014-07-01 18:39:52 -070013 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070014public abstract class PathFlow extends Flow {
15 private final PortNumber ingressPort;
16 private final Path path;
17 private final List<Action> egressActions;
Toshio Koidea03915e2014-07-01 18:39:52 -070018
19 /**
Toshio Koide2c67a2d2014-08-27 11:30:56 -070020 * Default constructor for Kryo deserialization.
21 */
22 @Deprecated
23 protected PathFlow() {
24 ingressPort = null;
25 path = null;
26 egressActions = null;
27 }
28
29 /**
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070030 * Creates the new flow instance.
Toshio Koidea03915e2014-07-01 18:39:52 -070031 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070032 * @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 Koidea03915e2014-07-01 18:39:52 -070037 */
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070038 public PathFlow(FlowId id,
39 PortNumber ingressPort, Path path, List<Action> egressActions) {
40 super(id);
41 this.ingressPort = checkNotNull(ingressPort);
Toshio Koide2c67a2d2014-08-27 11:30:56 -070042 this.path = new Path(checkNotNull(path));
43 this.egressActions = new LinkedList<>(checkNotNull(egressActions));
Toshio Koidea03915e2014-07-01 18:39:52 -070044 }
45
46 /**
47 * Gets the ingress port number at the ingress node of the path.
48 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070049 * @return the ingress port number at the ingress node of the path
Toshio Koidea03915e2014-07-01 18:39:52 -070050 */
51 public PortNumber getIngressPortNumber() {
52 return ingressPort;
53 }
54
55 /**
56 * Gets the path from ingress to egress edge node.
57 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070058 * @return the path object from ingress to egress edge node
Toshio Koidea03915e2014-07-01 18:39:52 -070059 */
60 public Path getPath() {
61 return path;
62 }
63
64 /**
Toshio Koided8b077a2014-08-13 10:47:21 -070065 * Gets the list of Action objects at the egress edge node.
Toshio Koidea03915e2014-07-01 18:39:52 -070066 *
Toshio Koide9aa4c0f2014-08-11 16:06:44 -070067 * @return the list of Action objects at the egress edge node
Toshio Koidea03915e2014-07-01 18:39:52 -070068 */
Toshio Koided8b077a2014-08-13 10:47:21 -070069 public List<Action> getEgressActions() {
Toshio Koidec963a8d2014-07-21 17:47:48 -070070 return egressActions;
Toshio Koidea03915e2014-07-01 18:39:52 -070071 }
72}