Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.matchaction; |
| 2 | |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 3 | import java.util.List; |
| 4 | |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 5 | import net.onrc.onos.api.batchoperation.BatchOperationTarget; |
Toshio Koide | d8b077a | 2014-08-13 10:47:21 -0700 | [diff] [blame] | 6 | import net.onrc.onos.core.matchaction.action.Action; |
Toshio Koide | d8b077a | 2014-08-13 10:47:21 -0700 | [diff] [blame] | 7 | import net.onrc.onos.core.matchaction.match.Match; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 8 | import net.onrc.onos.core.util.SwitchPort; |
| 9 | |
| 10 | /** |
| 11 | * A filter and actions for traffic. |
| 12 | */ |
Toshio Koide | fad1cd5 | 2014-08-07 17:10:07 -0700 | [diff] [blame] | 13 | public class MatchAction implements BatchOperationTarget { |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 14 | private final MatchActionId id; |
| 15 | private final SwitchPort port; |
| 16 | private final Match match; |
| 17 | private final List<Action> actions; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * Constructor. |
| 21 | * |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 22 | * @param id ID for this MatchAction object |
| 23 | * @param port switch DPID |
| 24 | * @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 Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 26 | */ |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 27 | public MatchAction(String id, SwitchPort port, Match match, List<Action> actions) { |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 28 | this.id = new MatchActionId(id); |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 29 | this.port = port; |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 30 | this.match = match; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 31 | this.actions = actions; |
| 32 | } |
| 33 | |
| 34 | /** |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 35 | * Gets ID for this object. |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 36 | * |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 37 | * @return the ID for this object |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 38 | */ |
Toshio Koide | 025a915 | 2014-07-21 11:00:34 -0700 | [diff] [blame] | 39 | public MatchActionId getId() { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 40 | return id; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Gets the switch-port which is the target of this match-action. |
| 45 | * |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 46 | * @return the target switch-port of this match-action |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 47 | */ |
| 48 | public SwitchPort getSwitchPort() { |
| 49 | return port; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Gets the traffic filter of the match-action. |
| 54 | * |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 55 | * @return the traffic filter |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 56 | */ |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 57 | public Match getMatch() { |
| 58 | return match; |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Gets the list of actions of the match-action. |
| 63 | * |
Toshio Koide | 80db184 | 2014-08-11 17:08:32 -0700 | [diff] [blame] | 64 | * @return the list of actions |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 65 | */ |
Toshio Koide | d8b077a | 2014-08-13 10:47:21 -0700 | [diff] [blame] | 66 | public List<Action> getActions() { |
Toshio Koide | a03915e | 2014-07-01 18:39:52 -0700 | [diff] [blame] | 67 | return actions; |
| 68 | } |
| 69 | } |