of12: add keyword arguments to action and message classes
diff --git a/src/python/of12/action.py b/src/python/of12/action.py
index 2ec7cfa..059e390 100644
--- a/src/python/of12/action.py
+++ b/src/python/of12/action.py
@@ -15,10 +15,15 @@
@arg ethertype
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_pop_mpls.__init__(self)
self.type = OFPAT_POP_MPLS
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_pop_mpls\n"
outstr += ofp_action_pop_mpls.show(self, prefix)
@@ -35,10 +40,15 @@
@arg ethertype
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_push.__init__(self)
self.type = OFPAT_PUSH_VLAN
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_push_vlan\n"
outstr += ofp_action_push.show(self, prefix)
@@ -55,10 +65,15 @@
@arg experimenter
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_experimenter_header.__init__(self)
self.type = OFPAT_EXPERIMENTER
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_experimenter\n"
outstr += ofp_action_experimenter_header.show(self, prefix)
@@ -74,10 +89,15 @@
@arg len
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_header.__init__(self)
self.type = OFPAT_DEC_MPLS_TTL
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_dec_mpls_ttl\n"
outstr += ofp_action_header.show(self, prefix)
@@ -94,10 +114,15 @@
@arg nw_ttl
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_nw_ttl.__init__(self)
self.type = OFPAT_SET_NW_TTL
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_set_nw_ttl\n"
outstr += ofp_action_nw_ttl.show(self, prefix)
@@ -113,10 +138,15 @@
@arg len
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_header.__init__(self)
self.type = OFPAT_COPY_TTL_IN
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_copy_ttl_in\n"
outstr += ofp_action_header.show(self, prefix)
@@ -133,10 +163,15 @@
@arg group_id
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_group.__init__(self)
self.type = OFPAT_GROUP
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_group\n"
outstr += ofp_action_group.show(self, prefix)
@@ -155,10 +190,15 @@
@arg queue_id
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_set_queue.__init__(self)
self.type = OFPAT_SET_QUEUE
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_set_queue\n"
outstr += ofp_action_set_queue.show(self, prefix)
@@ -175,10 +215,15 @@
@arg ethertype
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_push.__init__(self)
self.type = OFPAT_PUSH_MPLS
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_push_mpls\n"
outstr += ofp_action_push.show(self, prefix)
@@ -194,10 +239,15 @@
@arg len
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_header.__init__(self)
self.type = OFPAT_COPY_TTL_OUT
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_copy_ttl_out\n"
outstr += ofp_action_header.show(self, prefix)
@@ -214,11 +264,16 @@
@arg field
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_set_field.__init__(self)
self.type = OFPAT_SET_FIELD
self.len = self.__len__()
self.field = match_list()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
packed = ""
@@ -265,10 +320,15 @@
@arg mpls_ttl
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_mpls_ttl.__init__(self)
self.type = OFPAT_SET_MPLS_TTL
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_set_mpls_ttl\n"
outstr += ofp_action_mpls_ttl.show(self, prefix)
@@ -284,10 +344,15 @@
@arg len
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_header.__init__(self)
self.type = OFPAT_POP_VLAN
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_pop_vlan\n"
outstr += ofp_action_header.show(self, prefix)
@@ -303,10 +368,15 @@
@arg len
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_header.__init__(self)
self.type = OFPAT_DEC_NW_TTL
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_dec_nw_ttl\n"
outstr += ofp_action_header.show(self, prefix)
@@ -324,10 +394,15 @@
@arg max_len
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_action_output.__init__(self)
self.type = OFPAT_OUTPUT
self.len = self.__len__()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def show(self, prefix=''):
outstr = prefix + "action_output\n"
outstr += ofp_action_output.show(self, prefix)
diff --git a/src/python/of12/message.py b/src/python/of12/message.py
index 1525b63..45d458e 100644
--- a/src/python/of12/message.py
+++ b/src/python/of12/message.py
@@ -19,7 +19,7 @@
high level API.
"""
- def __init__(self):
+ def __init__(self, **kwargs):
"""
Constructor for base class
@@ -37,7 +37,7 @@
implement the functions indicated in this template.
"""
- def __init__(self):
+ def __init__(self, **kwargs):
"""
Constructor
Must set the header type value appropriately for the message
@@ -125,9 +125,14 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
self.header.type = OFPT_BARRIER_REPLY
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -218,9 +223,14 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
self.header.type = OFPT_BARRIER_REQUEST
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -312,10 +322,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
self.header.type = OFPT_ECHO_REPLY
self.data = ""
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -419,10 +434,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
self.header.type = OFPT_ECHO_REQUEST
self.data = ""
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -529,11 +549,16 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_error_msg.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_ERROR
self.data = ""
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -645,11 +670,16 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_experimenter_header.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_EXPERIMENTER
self.data = ""
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -764,11 +794,16 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_switch_features.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_FEATURES_REPLY
self.ports = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -876,9 +911,14 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
self.header.type = OFPT_FEATURES_REQUEST
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -983,7 +1023,7 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_flow_mod.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_FLOW_MOD
@@ -992,6 +1032,11 @@
self.out_group = OFPG_ANY
self.match_fields = match_list()
self.instructions = instruction_list()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1125,11 +1170,16 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_flow_removed.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_FLOW_REMOVED
self.match_fields = match_list()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1242,10 +1292,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_switch_config.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_GET_CONFIG_REPLY
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1341,9 +1396,14 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
self.header.type = OFPT_GET_CONFIG_REQUEST
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1439,11 +1499,16 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_group_mod.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_GROUP_MOD
self.buckets = bucket_list()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1546,10 +1611,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
self.header.type = OFPT_HELLO
self.data = ""
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1659,12 +1729,17 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_packet_in.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_PACKET_IN
self.match_fields = match_list()
self.data = ""
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1793,12 +1868,17 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_packet_out.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_PACKET_OUT
self.actions = action_list()
self.data = ""
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -1919,10 +1999,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_port_mod.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_PORT_MOD
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2021,10 +2106,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_port_status.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_PORT_STATUS
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2123,11 +2213,16 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_queue_get_config_reply.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_QUEUE_GET_CONFIG_REPLY
self.queues = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2235,10 +2330,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_queue_get_config_request.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_QUEUE_GET_CONFIG_REQUEST
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2337,10 +2437,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_switch_config.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_SET_CONFIG
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2439,10 +2544,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_stats_reply.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_STATS_REPLY
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2541,10 +2651,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_stats_request.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_STATS_REQUEST
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2643,10 +2758,15 @@
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_table_mod.__init__(self)
self.header = ofp_header()
self.header.type = OFPT_TABLE_MOD
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
@@ -2744,7 +2864,7 @@
"""
Forced definition of ofp_desc_stats_request (empty class)
"""
- def __init__(self):
+ def __init__(self, **kwargs):
pass
def pack(self, assertstruct=True):
return ""
@@ -2765,7 +2885,7 @@
"""
Forced definition of ofp_table_stats_request (empty class)
"""
- def __init__(self):
+ def __init__(self, **kwargs):
pass
def pack(self, assertstruct=True):
return ""
@@ -2786,7 +2906,7 @@
"""
Forced definition of ofp_group_desc_stats_request (empty class)
"""
- def __init__(self):
+ def __init__(self, **kwargs):
pass
def pack(self, assertstruct=True):
return ""
@@ -2826,7 +2946,7 @@
"""
Special case flow stats entry to handle action list object
"""
- def __init__(self):
+ def __init__(self, **kwargs):
ofp_flow_stats.__init__(self)
self.match_fields = match_list()
self.instructions = instruction_list()
@@ -2887,13 +3007,18 @@
"""
Wrapper class for aggregate stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_aggregate_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_AGGREGATE
self.match_fields = match_list()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -2957,13 +3082,18 @@
"""
Wrapper class for aggregate stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_AGGREGATE
# stats: Array of type aggregate_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3014,12 +3144,17 @@
"""
Wrapper class for desc stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_desc_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_DESC
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3061,13 +3196,18 @@
"""
Wrapper class for desc stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_DESC
# stats: Array of type desc_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3118,13 +3258,18 @@
"""
Wrapper class for flow stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_flow_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_FLOW
self.match_fields = match_list()
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self):
self.header.length = len(self)
@@ -3188,13 +3333,18 @@
"""
Wrapper class for flow stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_FLOW
# stats: Array of type flow_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3245,12 +3395,17 @@
"""
Wrapper class for port stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_port_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_PORT
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3292,13 +3447,18 @@
"""
Wrapper class for port stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_PORT
# stats: Array of type port_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3349,12 +3509,17 @@
"""
Wrapper class for queue stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_queue_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_QUEUE
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3396,13 +3561,18 @@
"""
Wrapper class for queue stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_QUEUE
# stats: Array of type queue_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3453,12 +3623,17 @@
"""
Wrapper class for group stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_group_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_GROUP
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3500,13 +3675,18 @@
"""
Wrapper class for group stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_GROUP
# stats: Array of type group_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3557,12 +3737,17 @@
"""
Wrapper class for group_desc stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_group_desc_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_GROUP_DESC
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3604,13 +3789,18 @@
"""
Wrapper class for group_desc stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_GROUP_DESC
# stats: Array of type group_desc_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3661,12 +3851,17 @@
"""
Wrapper class for table stats request message
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_request.__init__(self)
ofp_table_stats_request.__init__(self)
self.header.type = OFPT_STATS_REQUEST
self.type = OFPST_TABLE
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)
@@ -3708,13 +3903,18 @@
"""
Wrapper class for table stats reply
"""
- def __init__(self):
+ def __init__(self, **kwargs):
self.header = ofp_header()
ofp_stats_reply.__init__(self)
self.header.type = OFPT_STATS_REPLY
self.type = OFPST_TABLE
# stats: Array of type table_stats_entry
self.stats = []
+ for (k, v) in kwargs.items():
+ if hasattr(self, k):
+ setattr(self, k, v)
+ else:
+ raise NameError("field %s does not exist in %s" % (k, self.__class__))
def pack(self, assertstruct=True):
self.header.length = len(self)