mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 13:56:09 +02:00
of12: make OFPMatch.to_jsondict work on instances composed with old api
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
4dfd93b1b2
commit
91942683fe
@ -1656,7 +1656,18 @@ class OFPMatch(StringifyMixin):
|
||||
stringify_attrs = iteritems
|
||||
|
||||
def to_jsondict(self):
|
||||
return super(OFPMatch, self).to_jsondict(lambda x: x)
|
||||
# XXX old api compat
|
||||
if self._composed_with_old_api():
|
||||
# copy object first because serialize_old is destructive
|
||||
o2 = OFPMatch()
|
||||
o2.fields = self.fields[:]
|
||||
# serialize and parse to fill OFPMatch._fields2
|
||||
buf = bytearray()
|
||||
o2.serialize(buf, 0)
|
||||
o = OFPMatch.parser(str(buf), 0)
|
||||
else:
|
||||
o = self
|
||||
return super(OFPMatch, o).to_jsondict(lambda x: x)
|
||||
|
||||
@classmethod
|
||||
def from_jsondict(cls, dict_):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user