summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>2013-07-23 16:03:13 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2013-07-31 21:06:37 +0900
commit311b9404f4874a1499c30340da5019adbe3c5cb1 (patch)
treed083aa4d7158de3c6378aec7d79d853f83820944
parentf7089128b07e107b2bd8ab88c84448b1be6bf5c9 (diff)
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 <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/ofproto/oxm_fields.py4
1 files changed, 3 insertions, 1 deletions
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