Jonathan Hart | 8f6dc09 | 2014-04-18 15:56:43 -0700 | [diff] [blame] | 1 | package net.onrc.onos.apps.sdnip; |
Jonathan Hart | 309889c | 2013-08-13 23:26:24 +1200 | [diff] [blame] | 2 | |
| 3 | import org.openflow.protocol.OFFlowMod; |
| 4 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 5 | // TODO This functionality should be handled by ONOS's flow layer in future. |
Jonathan Hart | 08ee852 | 2013-09-22 17:34:43 +1200 | [diff] [blame] | 6 | /** |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 7 | * Collects together the DPID and OFFlowMod of a pushed flow mod. This |
| 8 | * information is used if the flow mod has to be deleted in the future. |
Jonathan Hart | 08ee852 | 2013-09-22 17:34:43 +1200 | [diff] [blame] | 9 | */ |
Jonathan Hart | 309889c | 2013-08-13 23:26:24 +1200 | [diff] [blame] | 10 | public class PushedFlowMod { |
Jonathan Hart | 738980f | 2014-04-04 10:11:15 -0700 | [diff] [blame] | 11 | private final long dpid; |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 12 | private OFFlowMod flowMod; |
| 13 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 14 | /** |
| 15 | * Class constructor, taking a DPID and a flow mod. |
| 16 | * |
| 17 | * @param dpid the DPID of the switch the flow mod was pushed to |
| 18 | * @param flowMod the OFFlowMod that was pushed to the switch |
| 19 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 20 | public PushedFlowMod(long dpid, OFFlowMod flowMod) { |
| 21 | this.dpid = dpid; |
| 22 | try { |
| 23 | this.flowMod = flowMod.clone(); |
| 24 | } catch (CloneNotSupportedException e) { |
| 25 | this.flowMod = flowMod; |
| 26 | } |
| 27 | } |
| 28 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 29 | /** |
| 30 | * Gets the DPID of the switch the flow mod was pushed to. |
| 31 | * |
| 32 | * @return the DPID of the switch |
| 33 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 34 | public long getDpid() { |
| 35 | return dpid; |
| 36 | } |
| 37 | |
Jonathan Hart | 31e15f1 | 2014-04-10 10:33:00 -0700 | [diff] [blame] | 38 | /** |
| 39 | * Gets the OFFlowMod that was pushed to the switch. |
| 40 | * |
| 41 | * @return the OFFlowMod object |
| 42 | */ |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 43 | public OFFlowMod getFlowMod() { |
| 44 | return flowMod; |
| 45 | } |
Ray Milkey | 0f913a0 | 2014-04-07 20:58:17 -0700 | [diff] [blame] | 46 | } |