diff options
author | Minoru TAKAHASHI <takahashi.minoru7@gmail.com> | 2016-03-25 16:58:27 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2016-03-27 22:29:35 +0900 |
commit | 61306439db5aaa3b53eefbaf281ba08ce83ff947 (patch) | |
tree | b8832fed216f94c967e465fb707d5ebfa99e8f9d | |
parent | 5246068fe8af0905f1a801d0561b17a6d211364d (diff) |
lib/ofctl_v1_4: Fix json format of queue_desc_reply
Signed-off-by: Minoru TAKAHASHI <takahashi.minoru7@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/ofctl_v1_4.py | 9 | ||||
-rw-r--r-- | ryu/tests/unit/lib/ofctl_json/of14/5-64-ofp_queue_desc_reply.packet.json | 108 |
2 files changed, 55 insertions, 62 deletions
diff --git a/ryu/lib/ofctl_v1_4.py b/ryu/lib/ofctl_v1_4.py index 05a266e9..faad3e04 100644 --- a/ryu/lib/ofctl_v1_4.py +++ b/ryu/lib/ofctl_v1_4.py @@ -415,9 +415,8 @@ def get_queue_desc_stats(dp, waiters, port_no=None, queue_id=None): send_stats_request(dp, stats, waiters, msgs) configs = [] - for config in msgs: - queue_list = [] - for queue in config.body: + for msg in msgs: + for queue in msg.body: q = queue.to_jsondict()[queue.__class__.__name__] prop_list = [] for prop in queue.properties: @@ -426,9 +425,7 @@ def get_queue_desc_stats(dp, waiters, port_no=None, queue_id=None): p['type'] = t if t != prop.type else 'UNKNOWN' prop_list.append(p) q['properties'] = prop_list - queue_list.append(q) - c = {'body': queue_list} - configs.append(c) + configs.append(q) configs = {str(dp.id): configs} return configs diff --git a/ryu/tests/unit/lib/ofctl_json/of14/5-64-ofp_queue_desc_reply.packet.json b/ryu/tests/unit/lib/ofctl_json/of14/5-64-ofp_queue_desc_reply.packet.json index 6b6b4400..ca6e87f2 100644 --- a/ryu/tests/unit/lib/ofctl_json/of14/5-64-ofp_queue_desc_reply.packet.json +++ b/ryu/tests/unit/lib/ofctl_json/of14/5-64-ofp_queue_desc_reply.packet.json @@ -1,65 +1,61 @@ { "1": [ { - "body": [ + "len": 32, + "port_no": 7, + "properties": [ { - "len": 32, - "port_no": 7, - "properties": [ - { - "data": [], - "exp_type": 0, - "experimenter": 101, - "length": 12, - "type": "EXPERIMENTER" - } - ], - "queue_id": 0 - }, + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + } + ], + "queue_id": 0 + }, + { + "len": 88, + "port_no": 8, + "properties": [ + { + "length": 8, + "rate": 300, + "type": "MIN_RATE" + }, + { + "length": 8, + "rate": 900, + "type": "MAX_RATE" + }, + { + "data": [], + "exp_type": 0, + "experimenter": 101, + "length": 12, + "type": "EXPERIMENTER" + }, + { + "data": [ + 1 + ], + "exp_type": 1, + "experimenter": 101, + "length": 16, + "type": "EXPERIMENTER" + }, { - "len": 88, - "port_no": 8, - "properties": [ - { - "length": 8, - "rate": 300, - "type": "MIN_RATE" - }, - { - "length": 8, - "rate": 900, - "type": "MAX_RATE" - }, - { - "data": [], - "exp_type": 0, - "experimenter": 101, - "length": 12, - "type": "EXPERIMENTER" - }, - { - "data": [ - 1 - ], - "exp_type": 1, - "experimenter": 101, - "length": 16, - "type": "EXPERIMENTER" - }, - { - "data": [ - 1, - 2 - ], - "exp_type": 2, - "experimenter": 101, - "length": 20, - "type": "EXPERIMENTER" - } - ], - "queue_id": 1 + "data": [ + 1, + 2 + ], + "exp_type": 2, + "experimenter": 101, + "length": 20, + "type": "EXPERIMENTER" } - ] + ], + "queue_id": 1 } ] } |