mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-05 20:36:10 +02:00
of1.3: omit mask attribute from str() when appropriate
normalize str() outputs so that tests like str(msg1) == str(msg2) more likely succeed. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
309e9c688c
commit
41877dac0b
@ -958,8 +958,6 @@ class OFPMatchField(StringifyMixin):
|
||||
del v['header']
|
||||
del v['length']
|
||||
del v['n_bytes']
|
||||
if 'mask' in v and v['mask'] is None:
|
||||
del v['mask']
|
||||
return d
|
||||
|
||||
@classmethod
|
||||
@ -968,6 +966,19 @@ class OFPMatchField(StringifyMixin):
|
||||
# it will be converted by OFPMatch.__init__().
|
||||
return {cls.__name__: dict_}
|
||||
|
||||
def stringify_attrs(self):
|
||||
f = super(OFPMatchField, self).stringify_attrs
|
||||
if not ofproto_v1_3.oxm_tlv_header_extract_hasmask(self.header):
|
||||
# something like the following, but yield two values (k,v)
|
||||
# return itertools.ifilter(lambda k, v: k != 'mask', iter())
|
||||
def g():
|
||||
for k, v in f():
|
||||
if k != 'mask':
|
||||
yield (k, v)
|
||||
return g()
|
||||
else:
|
||||
return f()
|
||||
|
||||
|
||||
@OFPMatchField.register_field_header([ofproto_v1_3.OXM_OF_IN_PORT])
|
||||
class MTInPort(OFPMatchField):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user