From a909fa3044d1873fd081eee65fec0829ab8b257a Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Thu, 21 Jul 2016 13:33:20 +0900 Subject: rest_qos: Fix to handle the case without QoS action 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 Signed-off-by: FUJITA Tomonori --- 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 89185a6e..bfc9e66d 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.'} -- cgit v1.2.3