Here is added queue status request to ofctl.

Signed-off-by: Kiyonari Harigae <[email protected]>
---
 ryu/lib/ofctl_v1_2.py | 22 ++++++++++++++++++++++
 ryu/lib/ofctl_v1_3.py | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/ryu/lib/ofctl_v1_2.py b/ryu/lib/ofctl_v1_2.py
index ea24fe9..76e5520 100644
--- a/ryu/lib/ofctl_v1_2.py
+++ b/ryu/lib/ofctl_v1_2.py
@@ -504,6 +504,28 @@ def get_desc_stats(dp, waiters):
     return desc
 
 
+def get_queue_stats(dp, waiters):
+    ofp = dp.ofproto
+    stats = dp.ofproto_parser.OFPQueueStatsRequest(dp, 0, ofp.OFPP_ANY,
+                                                   ofp.OFPQ_ALL)
+    msgs = []
+    send_stats_request(dp, stats, waiters, msgs)
+
+    s = []
+    for msg in msgs:
+        stats = msg.body
+        for stat in stats:
+            s.append({'duration_nsec': stat.duration_nsec,
+                      'duration_sec': stat.duration_sec,
+                      'port_no': stat.port_no,
+                      'queue_id': stat.queue_id,
+                      'tx_bytes': stat.tx_bytes,
+                      'tx_errors': stat.tx_errors,
+                      'tx_packets': stat.tx_packets})
+    desc = {str(dp.id): s}
+    return desc
+
+
 def get_flow_stats(dp, waiters):
     table_id = dp.ofproto.OFPTT_ALL
     out_port = dp.ofproto.OFPP_ANY
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py
index 63356cd..d97da8a 100644
--- a/ryu/lib/ofctl_v1_3.py
+++ b/ryu/lib/ofctl_v1_3.py
@@ -554,6 +554,28 @@ def get_desc_stats(dp, waiters):
     return desc
 
 
+def get_queue_stats(dp, waiters):
+    ofp = dp.ofproto
+    stats = dp.ofproto_parser.OFPQueueStatsRequest(dp, 0, ofp.OFPP_ANY,
+                                                   ofp.OFPQ_ALL)
+    msgs = []
+    send_stats_request(dp, stats, waiters, msgs)
+
+    s = []
+    for msg in msgs:
+        stats = msg.body
+        for stat in stats:
+            s.append({'duration_nsec': stat.duration_nsec,
+                      'duration_sec': stat.duration_sec,
+                      'port_no': stat.port_no,
+                      'queue_id': stat.queue_id,
+                      'tx_bytes': stat.tx_bytes,
+                      'tx_errors': stat.tx_errors,
+                      'tx_packets': stat.tx_packets})
+    desc = {str(dp.id): s}
+    return desc
+
+
 def get_flow_stats(dp, waiters):
     table_id = dp.ofproto.OFPTT_ALL
     flags = 0
-- 
1.7.12.4 (Apple Git-37)


------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to