mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 05:46:10 +02:00
ofproto_parser: add ofp_attr function
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
0a11bf61ba
commit
da393e8e3d
@ -147,14 +147,18 @@ def msg_pack_into(fmt, buf, offset, *args):
|
||||
struct.pack_into(fmt, buf, offset, *args)
|
||||
|
||||
|
||||
def ofp_attr(msg):
|
||||
exclude = ['_attributes']
|
||||
try:
|
||||
exclude += msg._attributes
|
||||
except AttributeError:
|
||||
pass
|
||||
return set(dir(msg)) - set(exclude)
|
||||
|
||||
|
||||
def msg_str_attr(msg, buf, attr_list=None):
|
||||
if attr_list is None:
|
||||
exclude = ['_attributes']
|
||||
try:
|
||||
exclude += msg._attributes
|
||||
except AttributeError:
|
||||
pass
|
||||
attr_list = set(dir(msg)) - set(exclude)
|
||||
attr_list = ofp_attr(msg)
|
||||
for attr in attr_list:
|
||||
val = getattr(msg, attr, None)
|
||||
if val is not None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user