Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.flowcache; |
| 2 | |
| 3 | import net.floodlightcontroller.core.FloodlightContext; |
| 4 | import org.openflow.protocol.OFMatchWithSwDpid; |
| 5 | |
| 6 | /** |
| 7 | * OFMatchReconcile class to indicate result of a flow-reconciliation. |
| 8 | */ |
| 9 | public class OFMatchReconcile { |
| 10 | |
| 11 | /** |
| 12 | * The enum ReconcileAction. Specifies the result of reconciliation of a |
| 13 | * flow. |
| 14 | */ |
| 15 | public enum ReconcileAction { |
| 16 | |
| 17 | /** Delete the flow-mod from the switch */ |
| 18 | DROP, |
| 19 | /** Leave the flow-mod as-is. */ |
| 20 | NO_CHANGE, |
| 21 | /** Program this new flow mod. */ |
| 22 | NEW_ENTRY, |
| 23 | /** |
| 24 | * Reprogram the flow mod as the path of the flow might have changed, |
| 25 | * for example when a host is moved or when a link goes down. */ |
| 26 | UPDATE_PATH, |
| 27 | /* Flow is now in a different BVS */ |
| 28 | APP_INSTANCE_CHANGED, |
| 29 | /* Delete the flow-mod - used to delete, for example, drop flow-mods |
| 30 | * when the source and destination are in the same BVS after a |
| 31 | * configuration change */ |
| 32 | DELETE |
| 33 | } |
| 34 | |
| 35 | /** The open flow match after reconciliation. */ |
| 36 | public OFMatchWithSwDpid ofmWithSwDpid; |
| 37 | /** flow mod. priority */ |
| 38 | public short priority; |
| 39 | /** Action of this flow-mod PERMIT or DENY */ |
| 40 | public byte action; |
| 41 | /** flow mod. cookie */ |
| 42 | public long cookie; |
| 43 | /** The application instance name. */ |
| 44 | public String appInstName; |
| 45 | /** |
| 46 | * The new application instance name. This is null unless the flow |
| 47 | * has moved to a different BVS due to BVS config change or device |
| 48 | * move to a different switch port etc.*/ |
| 49 | public String newAppInstName; |
| 50 | /** The reconcile action. */ |
| 51 | public ReconcileAction rcAction; |
| 52 | |
| 53 | // The context for the reconcile action |
| 54 | public FloodlightContext cntx; |
| 55 | |
| 56 | /** |
| 57 | * Instantiates a new oF match reconcile object. |
| 58 | */ |
| 59 | public OFMatchReconcile() { |
| 60 | ofmWithSwDpid = new OFMatchWithSwDpid(); |
| 61 | rcAction = ReconcileAction.NO_CHANGE; |
| 62 | cntx = new FloodlightContext(); |
| 63 | } |
| 64 | |
| 65 | public OFMatchReconcile(OFMatchReconcile copy) { |
| 66 | ofmWithSwDpid = |
| 67 | new OFMatchWithSwDpid(copy.ofmWithSwDpid.getOfMatch(), |
| 68 | copy.ofmWithSwDpid.getSwitchDataPathId()); |
| 69 | priority = copy.priority; |
| 70 | action = copy.action; |
| 71 | cookie = copy.cookie; |
| 72 | appInstName = copy.appInstName; |
| 73 | newAppInstName = copy.newAppInstName; |
| 74 | rcAction = copy.rcAction; |
| 75 | cntx = new FloodlightContext(); |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public String toString() { |
| 80 | return "OFMatchReconcile [" + ofmWithSwDpid + " priority=" + priority + " action=" + action + |
| 81 | " cookie=" + cookie + " appInstName=" + appInstName + " newAppInstName=" + newAppInstName + |
| 82 | " ReconcileAction=" + rcAction + "]"; |
| 83 | } |
| 84 | } |