diff options
author | Minoru TAKAHASHI <takahashi.minoru7@gmail.com> | 2015-11-09 13:57:23 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-11-13 15:35:34 +0900 |
commit | 6133901bb59b5d8053fc0b49d93a6c78c2570d86 (patch) | |
tree | 3947cb3f7b406b548981d7958a5bb22f30b9ff86 | |
parent | 0aefad7048079656cdaad138be58f017e6b4f1ce (diff) |
ofctl_v1_3: Fix unsuitable error log in mod_meter_entry()
When omit the parameter of "flags" in mod_meter_entry(), following error log will be shown.
example)
1.use mod_meter_entry() with omitting the parameter of "flags".
curl -X POST -d '{
"dpid": 1,
"meter_id": 1
}' http://localhost:8080/stats/meterentry/delete
2.following error log will be shown.
Unknown flags: 0
This patch fixes the problem.
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_3.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py index 81f9f704..94a3a338 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -1008,14 +1008,16 @@ def mod_meter_entry(dp, flow, cmd): 'BURST': dp.ofproto.OFPMF_BURST, 'STATS': dp.ofproto.OFPMF_STATS} - flow_flags = flow.get('flags') - if not isinstance(flow_flags, list): - flow_flags = [flow_flags] flags = 0 - for flag in flow_flags: - flags |= flags_convert.get(flag, 0) - if not flags: - LOG.error('Unknown flags: %s', flow.get('flags')) + if 'flags' in flow: + flow_flags = flow['flags'] + if not isinstance(flow_flags, list): + flow_flags = [flow_flags] + for flag in flow_flags: + if flag not in flags_convert: + LOG.error('Unknown flag: %s', flag) + continue + flags |= flags_convert.get(flag) meter_id = int(flow.get('meter_id', 0)) |