Jonathan Hart | aa38097 | 2014-04-03 10:24:46 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.intent; |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 2 | |
Jonathan Hart | 23701d1 | 2014-04-03 10:45:48 -0700 | [diff] [blame] | 3 | import net.onrc.onos.core.util.FlowEntryAction; |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 4 | |
| 5 | /** |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 6 | * @author Brian O'Connor <bocon@onlab.us> |
Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | class ForwardAction extends Action { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 10 | protected long dstPort; |
Brian O'Connor | 67c6e66 | 2014-02-17 15:20:44 -0800 | [diff] [blame] | 11 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 12 | public ForwardAction(long dstPort) { |
| 13 | this.dstPort = dstPort; |
| 14 | } |
Brian O'Connor | 6dc44e9 | 2014-02-24 21:23:46 -0800 | [diff] [blame] | 15 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 16 | public String toString() { |
| 17 | return Long.toString(dstPort); |
| 18 | } |
| 19 | |
| 20 | @Override |
| 21 | public FlowEntryAction getFlowEntryAction() { |
| 22 | FlowEntryAction action = new FlowEntryAction(); |
| 23 | action.setActionOutput(new net.onrc.onos.core.util.Port((short) dstPort)); |
| 24 | return action; |
| 25 | } |
| 26 | |
| 27 | public int hashCode() { |
| 28 | return (int) dstPort; |
| 29 | } |
| 30 | |
| 31 | public boolean equals(Object o) { |
| 32 | if (!(o instanceof ForwardAction)) { |
| 33 | return false; |
| 34 | } |
| 35 | ForwardAction action = (ForwardAction) o; |
| 36 | return this.dstPort == action.dstPort; |
| 37 | } |
Brian O'Connor | 6dc44e9 | 2014-02-24 21:23:46 -0800 | [diff] [blame] | 38 | } |