blob: 7c3a22d48f94832c4f9d869505b2fbacaf00d1e4 [file] [log] [blame]
Toshio Koidea03915e2014-07-01 18:39:52 -07001package net.onrc.onos.core.matchaction;
2
Toshio Koidea03915e2014-07-01 18:39:52 -07003import java.util.List;
4
Toshio Koidefad1cd52014-08-07 17:10:07 -07005import net.onrc.onos.api.batchoperation.BatchOperationTarget;
Toshio Koided8b077a2014-08-13 10:47:21 -07006import net.onrc.onos.core.matchaction.action.Action;
Toshio Koided8b077a2014-08-13 10:47:21 -07007import net.onrc.onos.core.matchaction.match.Match;
Toshio Koidea03915e2014-07-01 18:39:52 -07008import net.onrc.onos.core.util.SwitchPort;
9
10/**
11 * A filter and actions for traffic.
12 */
Brian O'Connordee2e6b2014-08-12 11:34:51 -070013public final class MatchAction implements BatchOperationTarget {
Toshio Koide80db1842014-08-11 17:08:32 -070014 private final MatchActionId id;
15 private final SwitchPort port;
16 private final Match match;
17 private final List<Action> actions;
Toshio Koidea03915e2014-07-01 18:39:52 -070018
19 /**
20 * Constructor.
21 *
Toshio Koide80db1842014-08-11 17:08:32 -070022 * @param id ID for this MatchAction object
Brian O'Connordee2e6b2014-08-12 11:34:51 -070023 * @param port switch port to apply changes to
Toshio Koide80db1842014-08-11 17:08:32 -070024 * @param match the Match object as match condition on the port
25 * @param actions the list of Action objects as actions on the switch
Toshio Koidea03915e2014-07-01 18:39:52 -070026 */
Toshio Koide80db1842014-08-11 17:08:32 -070027 public MatchAction(String id, SwitchPort port, Match match, List<Action> actions) {
Toshio Koide025a9152014-07-21 11:00:34 -070028 this.id = new MatchActionId(id);
Toshio Koidea03915e2014-07-01 18:39:52 -070029 this.port = port;
Toshio Koide80db1842014-08-11 17:08:32 -070030 this.match = match;
Toshio Koidea03915e2014-07-01 18:39:52 -070031 this.actions = actions;
32 }
33
34 /**
Toshio Koide80db1842014-08-11 17:08:32 -070035 * Gets ID for this object.
Toshio Koidea03915e2014-07-01 18:39:52 -070036 *
Toshio Koide80db1842014-08-11 17:08:32 -070037 * @return the ID for this object
Toshio Koidea03915e2014-07-01 18:39:52 -070038 */
Toshio Koide025a9152014-07-21 11:00:34 -070039 public MatchActionId getId() {
Toshio Koidea03915e2014-07-01 18:39:52 -070040 return id;
41 }
42
43 /**
44 * Gets the switch-port which is the target of this match-action.
45 *
Toshio Koide80db1842014-08-11 17:08:32 -070046 * @return the target switch-port of this match-action
Toshio Koidea03915e2014-07-01 18:39:52 -070047 */
48 public SwitchPort getSwitchPort() {
49 return port;
50 }
51
52 /**
53 * Gets the traffic filter of the match-action.
54 *
Toshio Koide80db1842014-08-11 17:08:32 -070055 * @return the traffic filter
Toshio Koidea03915e2014-07-01 18:39:52 -070056 */
Toshio Koide80db1842014-08-11 17:08:32 -070057 public Match getMatch() {
58 return match;
Toshio Koidea03915e2014-07-01 18:39:52 -070059 }
60
61 /**
62 * Gets the list of actions of the match-action.
63 *
Toshio Koide80db1842014-08-11 17:08:32 -070064 * @return the list of actions
Toshio Koidea03915e2014-07-01 18:39:52 -070065 */
Toshio Koided8b077a2014-08-13 10:47:21 -070066 public List<Action> getActions() {
Toshio Koidea03915e2014-07-01 18:39:52 -070067 return actions;
68 }
69}