Signed-off-by: OHMURA Kei <ohmura....@lab.ntt.co.jp>
---
 ryu/lib/ofctl_v1_0.py |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/ryu/lib/ofctl_v1_0.py b/ryu/lib/ofctl_v1_0.py
index 2ec36c0..37533c8 100644
--- a/ryu/lib/ofctl_v1_0.py
+++ b/ryu/lib/ofctl_v1_0.py
@@ -53,6 +53,27 @@ def to_actions(dp, acts):
     return actions
 
 
+def action_to_str(a):
+    action_type = a.cls_action_type
+
+    if action_type == ofproto_v1_0.OFPAT_OUTPUT:
+        buf = 'OUTPUT:' + str(a.port)
+    elif action_type == ofproto_v1_0.OFPAT_SET_VLAN_VID:
+        buf = 'SET_VLAN_VID:' + str(a.vlan_vid)
+    elif action_type == ofproto_v1_0.OFPAT_SET_VLAN_PCP:
+        buf = 'SET_VLAN_PCP:' + str(a.vlan_pcp)
+    elif action_type == ofproto_v1_0.OFPAT_STRIP_VLAN:
+        buf = 'STRIP_VLAN'
+    elif action_type == ofproto_v1_0.OFPAT_SET_DL_SRC:
+        buf = 'SET_DL_SRC:' + haddr_to_str(a.dl_addr)
+    elif action_type == ofproto_v1_0.OFPAT_SET_DL_DST:
+        buf = 'SET_DL_DST:' + haddr_to_str(a.dl_addr)
+    else:
+        buf = 'UNKNOWN'
+
+    return buf
+
+
 def to_match(dp, attrs):
     ofp = dp.ofproto
 
@@ -155,10 +176,15 @@ def get_flow_stats(dp, waiters):
     flows = []
     for msg in msgs:
         for stats in msg.body:
+            actions = []
+            for a in stats.actions:
+                actions.append(action_to_str(a))
+
             s = {'priority': stats.priority,
                  'cookie': stats.cookie,
                  'idle_timeout': stats.idle_timeout,
                  'hard_timeout': stats.hard_timeout,
+                 'actions': actions,
                  'match': {'dl_dst': haddr_to_str(stats.match.dl_dst),
                            'dl_src': haddr_to_str(stats.match.dl_src),
                            'dl_type': stats.match.dl_type,
-- 
1.7.9.5


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to