blob: 38ac37f248404ea445d818c7c2cfc60f9a6f797d [file] [log] [blame]
Jonathan Hart8f6dc092014-04-18 15:56:43 -07001package net.onrc.onos.apps.sdnip;
Jonathan Hart309889c2013-08-13 23:26:24 +12002
3import org.openflow.protocol.OFFlowMod;
4
Jonathan Hart31e15f12014-04-10 10:33:00 -07005// TODO This functionality should be handled by ONOS's flow layer in future.
Jonathan Hart08ee8522013-09-22 17:34:43 +12006/**
Jonathan Hart31e15f12014-04-10 10:33:00 -07007 * 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 Hart08ee8522013-09-22 17:34:43 +12009 */
Jonathan Hart309889c2013-08-13 23:26:24 +120010public class PushedFlowMod {
Jonathan Hart738980f2014-04-04 10:11:15 -070011 private final long dpid;
Ray Milkey269ffb92014-04-03 14:43:30 -070012 private OFFlowMod flowMod;
13
Jonathan Hart31e15f12014-04-10 10:33:00 -070014 /**
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 Milkey269ffb92014-04-03 14:43:30 -070020 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 Hart31e15f12014-04-10 10:33:00 -070029 /**
30 * Gets the DPID of the switch the flow mod was pushed to.
31 *
32 * @return the DPID of the switch
33 */
Ray Milkey269ffb92014-04-03 14:43:30 -070034 public long getDpid() {
35 return dpid;
36 }
37
Jonathan Hart31e15f12014-04-10 10:33:00 -070038 /**
39 * Gets the OFFlowMod that was pushed to the switch.
40 *
41 * @return the OFFlowMod object
42 */
Ray Milkey269ffb92014-04-03 14:43:30 -070043 public OFFlowMod getFlowMod() {
44 return flowMod;
45 }
Ray Milkey0f913a02014-04-07 20:58:17 -070046}