Currently, rest_qos.py might fail to parse the actions field in
the QoS rules when the actions field does not have any actions
for the QoS (SET_FIELD, METER, SET_QUEUE).

This patch fixes this problem.

Signed-off-by: IWASE Yusuke <iwase.yusu...@gmail.com>
---
 ryu/app/rest_qos.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ryu/app/rest_qos.py b/ryu/app/rest_qos.py
index 89185a6..bfc9e66 100644
--- a/ryu/app/rest_qos.py
+++ b/ryu/app/rest_qos.py
@@ -1127,20 +1127,20 @@ class Match(object):
 class Action(object):
 
     @staticmethod
-    def to_rest(openflow):
-        if REST_ACTION in openflow:
+    def to_rest(flow):
+        if REST_ACTION in flow:
             actions = []
-            for action in openflow[REST_ACTION]:
-                field_value = re.search('SET_FIELD: {ip_dscp:(\d+)', action)
+            for act in flow[REST_ACTION]:
+                field_value = re.search('SET_FIELD: \{ip_dscp:(\d+)', act)
                 if field_value:
                     actions.append({REST_ACTION_MARK: field_value.group(1)})
-                meter_value = re.search('METER:(\d+)', action)
+                meter_value = re.search('METER:(\d+)', act)
                 if meter_value:
                     actions.append({REST_ACTION_METER: meter_value.group(1)})
-                queue_value = re.search('SET_QUEUE:(\d+)', action)
+                queue_value = re.search('SET_QUEUE:(\d+)', act)
                 if queue_value:
                     actions.append({REST_ACTION_QUEUE: queue_value.group(1)})
-                action = {REST_ACTION: actions}
+            action = {REST_ACTION: actions}
         else:
             action = {REST_ACTION: 'Unknown action type.'}
 
-- 
2.7.4


------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to