blob: 5121f8bb9704512861b0a853ed5fd86f7cead49b [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001package net.floodlightcontroller.flowcache;
2
3
4import org.openflow.protocol.OFMatchWithSwDpid;
5
6/**
7 * Used in BigFlowCacheQueryResp as query result.
8 * Used to return one flow when queried by one of the big flow cache APIs.
9 * One of these QRFlowCacheObj is returned for each combination of
10 * priority and action.
11 *
12 * @author subrata
13 */
14public class QRFlowCacheObj {
15
16 /** The open flow match object. */
17 public OFMatchWithSwDpid ofmWithSwDpid;
18 /** The flow-mod priority. */
19 public short priority;
20 /** flow-mod cookie */
21 public long cookie;
22 /** The action - PERMIT or DENY. */
23 public byte action;
24 /** The reserved byte to align with 8 bytes. */
25 public byte reserved;
26
27 /**
28 * Instantiates a new flow cache query object.
29 *
30 * @param priority the priority
31 * @param action the action
32 */
33 public QRFlowCacheObj(short priority, byte action, long cookie) {
34 ofmWithSwDpid = new OFMatchWithSwDpid();
35 this.action = action;
36 this.priority = priority;
37 this.cookie = cookie;
38 }
39
40 /**
41 * Populate a given OFMatchReconcile object from the values of this
42 * class.
43 *
44 * @param ofmRc the given OFMatchReconcile object
45 * @param appInstName the application instance name
46 * @param rcAction the reconcile action
47 */
48 public void toOFMatchReconcile(OFMatchReconcile ofmRc,
49 String appInstName, OFMatchReconcile.ReconcileAction rcAction) {
50 ofmRc.ofmWithSwDpid = ofmWithSwDpid; // not copying
51 ofmRc.appInstName = appInstName;
52 ofmRc.rcAction = rcAction;
53 ofmRc.priority = priority;
54 ofmRc.cookie = cookie;
55 ofmRc.action = action;
56 }
57
58 @Override
59 public String toString() {
60 String str = "ofmWithSwDpid: " + this.ofmWithSwDpid.toString() + " ";
61 str += "priority: " + this.priority + " ";
62 str += "cookie: " + this.cookie + " ";
63 str += "action: " + this.action + " ";
64 str += "reserved: " + this.reserved + " ";
65 return str;
66 }
67}