summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYuichi Ito <ito.yuichi0@gmail.com>2014-04-15 14:52:39 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-04-15 14:54:12 +0900
commit02cce181083fa8d72e5990eda16c0f0567de8983 (patch)
tree117d41ca501a6bac0546ace7827b216c73be4712
parent2d7053ac0b509250808f41926406a0d751441820 (diff)
sw test tool: Fix to compare OFPMatch ignoring masks that are all one bits
OF 1.3.3 spec (7.2.3.5 Flow Match Field Masking) says: An all-zero-bits oxm_mask is equivalent to omitting the OXM TLV entirely. An all-one-bits oxm_mask is equivalent to specifying 0 for oxm_hasmask and omitting oxm_mask. This patch fixes to compare OFPMatch ignoring masks that are all one bits. Reported-by: Arne Goetje <arne_goetje@accton.com> Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/tests/switch/tester.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py
index 631412ad..dd05050b 100644
--- a/ryu/tests/switch/tester.py
+++ b/ryu/tests/switch/tester.py
@@ -779,6 +779,24 @@ class OfTester(app_manager.RyuApp):
break
def _compare_flow(self, stats1, stats2):
+
+ def __reasm_match(match):
+ """ reassemble match_fields. """
+ match_fields = list()
+ for key, united_value in match.iteritems():
+ if isinstance(united_value, tuple):
+ (value, mask) = united_value
+ # look up oxm_fields.TypeDescr to get mask length.
+ for ofb in ofproto_v1_3.oxm_types:
+ if ofb.name == key:
+ mbytes = ofb.type.from_user(mask)
+ # when mask is all one bits, remove mask
+ if mbytes == '\xff' * ofb.type.size:
+ united_value = value
+ break
+ match_fields.append((key, united_value))
+ return match_fields
+
attr_list = ['cookie', 'priority', 'hard_timeout', 'idle_timeout',
'table_id', 'instructions', 'match']
for attr in attr_list:
@@ -787,6 +805,9 @@ class OfTester(app_manager.RyuApp):
if attr == 'instructions':
value1 = sorted(value1)
value2 = sorted(value2)
+ elif attr == 'match':
+ value1 = __reasm_match(value1)
+ value2 = __reasm_match(value2)
if str(value1) != str(value2):
flow_stats = []
for attr in attr_list: