diff options
author | Yusuke Iwase <iwase.yusuke0@gmail.com> | 2015-03-18 17:17:54 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2015-03-18 22:27:10 +0900 |
commit | 109d2bb2fd53be8b81ff28dc1582ef64406cfe65 (patch) | |
tree | 2ea6b138acc372c611466a4d83d4b6d85bbe5396 | |
parent | f39e95043c7de066400ff9e538abeebc14f7899d (diff) |
ofctl_v1_3: Support masked ipv6_exthdr match field
In OpenFlow Spec 1.3.4, ipv6_exthdr is maskable match field,
but ofctl_v1_3 does not support mask.
This patch makes ofctl_v1_3 enable to set masked ipv6_exthdr.
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/lib/ofctl_v1_3.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ryu/lib/ofctl_v1_3.py b/ryu/lib/ofctl_v1_3.py index 919154fa..1bdb217b 100644 --- a/ryu/lib/ofctl_v1_3.py +++ b/ryu/lib/ofctl_v1_3.py @@ -208,7 +208,7 @@ def actions_to_str(instructions): def to_match(dp, attrs): convert = {'in_port': int, 'in_phy_port': int, - 'metadata': to_match_metadata, + 'metadata': to_match_masked_int, 'dl_dst': to_match_eth, 'dl_src': to_match_eth, 'eth_dst': to_match_eth, @@ -254,7 +254,7 @@ def to_match(dp, attrs): 'mpls_bos': int, 'pbb_isid': int, 'tunnel_id': int, - 'ipv6_exthdr': int} + 'ipv6_exthdr': to_match_masked_int} keys = {'dl_dst': 'eth_dst', 'dl_src': 'eth_src', @@ -338,8 +338,8 @@ def to_match_vid(value): return int(value, 0) -def to_match_metadata(value): - if '/' in value: +def to_match_masked_int(value): + if isinstance(value, str) and '/' in value: value = value.split('/') return str_to_int(value[0]), str_to_int(value[1]) else: @@ -374,8 +374,8 @@ def match_to_str(ofmatch): value = match_field['OXMTlv']['value'] if key == 'dl_vlan': value = match_vid_to_str(value, mask) - elif key == 'metadata': - value = match_metadata_to_str(value, mask) + elif key == 'metadata' or key == 'ipv6_exthdr': + value = match_masked_int_to_str(value, mask) else: if mask is not None: value = value + '/' + mask @@ -386,7 +386,7 @@ def match_to_str(ofmatch): return match -def match_metadata_to_str(value, mask): +def match_masked_int_to_str(value, mask): return ('%d/%d' % (value, mask) if mask else '%d' % value) |