From 311b9404f4874a1499c30340da5019adbe3c5cb1 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 23 Jul 2013 16:03:13 +0900 Subject: oxm_fields: accept [value, mask] as well as (value, mask) this will be used for OFPMatch from_jsondict implementation. as json has no notion of tuples, we will use a list instead. Signed-off-by: YAMAMOTO Takashi Signed-off-by: FUJITA Tomonori --- ryu/ofproto/oxm_fields.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ryu/ofproto/oxm_fields.py b/ryu/ofproto/oxm_fields.py index f317da06..47bb1461 100644 --- a/ryu/ofproto/oxm_fields.py +++ b/ryu/ofproto/oxm_fields.py @@ -135,7 +135,9 @@ def from_user(name_to_field, name, user_value): num = int(name.split('_')[1]) else: raise KeyError('unknown match field ' + name) - if isinstance(user_value, tuple): + # the 'list' case below is a bit hack; json.dumps silently maps + # python tuples into json lists. + if isinstance(user_value, (tuple, list)): (value, mask) = user_value else: value = user_value -- cgit v1.2.3