summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWASE Yusuke <iwase.yusuke0@gmail.com>2016-07-21 13:33:20 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2016-07-27 14:30:47 +0900
commita909fa3044d1873fd081eee65fec0829ab8b257a (patch)
treece12468ac831586f108a8fec27b473f7740810fc
parentc631c46163d0b484daaeaf4d951581cdf9820fc4 (diff)
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 <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/app/rest_qos.py14
1 files 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.'}