loxi-prep: default xid to None
diff --git a/src/python/of10/error.py b/src/python/of10/error.py
index 700338b..f545bc5 100644
--- a/src/python/of10/error.py
+++ b/src/python/of10/error.py
@@ -19,6 +19,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.err_type = OFPET_HELLO_FAILED
self.data = ""
@@ -66,6 +67,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.err_type = OFPET_BAD_REQUEST
self.data = ""
@@ -113,6 +115,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.err_type = OFPET_BAD_ACTION
self.data = ""
@@ -160,6 +163,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.err_type = OFPET_FLOW_MOD_FAILED
self.data = ""
@@ -207,6 +211,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.err_type = OFPET_PORT_MOD_FAILED
self.data = ""
@@ -254,6 +259,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.err_type = OFPET_QUEUE_OP_FAILED
self.data = ""
diff --git a/src/python/of10/message.py b/src/python/of10/message.py
index 5b4ce02..6acb063 100644
--- a/src/python/of10/message.py
+++ b/src/python/of10/message.py
@@ -127,6 +127,7 @@
ofp_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_BARRIER_REPLY
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -233,6 +234,7 @@
ofp_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_BARRIER_REQUEST
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -340,6 +342,7 @@
ofp_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ECHO_REPLY
+ self.xid = None
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -460,6 +463,7 @@
ofp_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ECHO_REQUEST
+ self.xid = None
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -582,6 +586,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -707,6 +712,7 @@
ofp_switch_features.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_FEATURES_REPLY
+ self.xid = None
self.ports = []
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -826,6 +832,7 @@
ofp_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_FEATURES_REQUEST
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -942,6 +949,7 @@
ofp_flow_mod.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_FLOW_MOD
+ self.xid = None
self.actions = []
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -1069,6 +1077,7 @@
ofp_flow_removed.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_FLOW_REMOVED
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1177,6 +1186,7 @@
ofp_switch_config.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_GET_CONFIG_REPLY
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1283,6 +1293,7 @@
ofp_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_GET_CONFIG_REQUEST
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1390,6 +1401,7 @@
ofp_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_HELLO
+ self.xid = None
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -1514,6 +1526,7 @@
ofp_packet_in.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_PACKET_IN
+ self.xid = None
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -1638,6 +1651,7 @@
ofp_packet_out.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_PACKET_OUT
+ self.xid = None
self.actions = []
self.data = ""
for (k, v) in kwargs.items():
@@ -1776,6 +1790,7 @@
ofp_port_mod.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_PORT_MOD
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1884,6 +1899,7 @@
ofp_port_status.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_PORT_STATUS
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -1992,6 +2008,7 @@
ofp_queue_get_config_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_QUEUE_GET_CONFIG_REPLY
+ self.xid = None
self.queues = []
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2110,6 +2127,7 @@
ofp_queue_get_config_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_QUEUE_GET_CONFIG_REQUEST
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2218,6 +2236,7 @@
ofp_switch_config.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_SET_CONFIG
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2326,6 +2345,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2434,6 +2454,7 @@
ofp_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
for (k, v) in kwargs.items():
if hasattr(self, k):
setattr(self, k, v)
@@ -2542,6 +2563,7 @@
ofp_vendor_header.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_VENDOR
+ self.xid = None
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2765,6 +2787,7 @@
ofp_aggregate_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
self.stats_type = OFPST_AGGREGATE
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2813,6 +2836,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
self.stats_type = OFPST_AGGREGATE
# stats: Array of type aggregate_stats_entry
self.entries = []
@@ -2868,6 +2892,7 @@
ofp_desc_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
self.stats_type = OFPST_DESC
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -2916,6 +2941,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
self.stats_type = OFPST_DESC
# stats: Array of type desc_stats_entry
self.entries = []
@@ -2971,6 +2997,7 @@
ofp_flow_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
self.stats_type = OFPST_FLOW
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -3019,6 +3046,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
self.stats_type = OFPST_FLOW
# stats: Array of type flow_stats_entry
self.entries = []
@@ -3074,6 +3102,7 @@
ofp_port_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
self.stats_type = OFPST_PORT
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -3122,6 +3151,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
self.stats_type = OFPST_PORT
# stats: Array of type port_stats_entry
self.entries = []
@@ -3177,6 +3207,7 @@
ofp_queue_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
self.stats_type = OFPST_QUEUE
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -3225,6 +3256,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
self.stats_type = OFPST_QUEUE
# stats: Array of type queue_stats_entry
self.entries = []
@@ -3280,6 +3312,7 @@
ofp_table_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
self.stats_type = OFPST_TABLE
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -3328,6 +3361,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
self.stats_type = OFPST_TABLE
# stats: Array of type table_stats_entry
self.entries = []
diff --git a/src/python/oftest/controller.py b/src/python/oftest/controller.py
index cd7bbcf..944117a 100644
--- a/src/python/oftest/controller.py
+++ b/src/python/oftest/controller.py
@@ -256,7 +256,7 @@
rep = ofp.message.echo_reply()
rep.xid = hdr.xid
# Ignoring additional data
- self.message_send(rep.pack(), zero_xid=True)
+ self.message_send(rep.pack())
continue
# Log error messages
@@ -610,7 +610,7 @@
else:
return (None, None)
- def transact(self, msg, timeout=-1, zero_xid=False):
+ def transact(self, msg, timeout=-1):
"""
Run a message transaction with the switch
@@ -620,13 +620,9 @@
@param msg The message object to send; must not be a string
@param timeout The timeout in seconds; if -1 use default.
- @param zero_xid Normally, if the XID is 0 an XID will be generated
- for the message. Set zero_xid to override this behavior
- @return The matching message object or None if unsuccessful
-
"""
- if not zero_xid and msg.xid == 0:
+ if msg.xid == None:
msg.xid = ofutils.gen_xid()
self.logger.debug("Running transaction %d" % msg.xid)
@@ -653,16 +649,12 @@
self.logger.warning("No response for xid " + str(self.xid))
return (resp, pkt)
- def message_send(self, msg, zero_xid=False):
+ def message_send(self, msg):
"""
Send the message to the switch
@param msg A string or OpenFlow message object to be forwarded to
the switch.
- @param zero_xid If msg is an OpenFlow object (not a string) and if
- the XID in the header is 0, then an XID will be generated
- for the message. Set zero_xid to override this behavior (and keep an
- existing 0 xid)
"""
if not self.switch_socket:
@@ -670,7 +662,7 @@
raise Exception("no socket")
#@todo If not string, try to pack
if type(msg) != type(""):
- if msg.xid == 0 and not zero_xid:
+ if msg.xid == None:
msg.xid = ofutils.gen_xid()
outpkt = msg.pack()
else:
diff --git a/src/python/oftest/illegal_message.py b/src/python/oftest/illegal_message.py
index 2d0ce7b..fa404cf 100644
--- a/src/python/oftest/illegal_message.py
+++ b/src/python/oftest/illegal_message.py
@@ -29,6 +29,7 @@
of10.ofp_header.__init__(self)
self.version = of10.OFP_VERSION
self.type = ILLEGAL_MESSAGE_TYPE
+ self.xid = None
self.data = ""
for (k, v) in kwargs.items():
if hasattr(self, k):
diff --git a/tools/munger/scripts/error_gen.py b/tools/munger/scripts/error_gen.py
index c8f4bf2..512a567 100644
--- a/tools/munger/scripts/error_gen.py
+++ b/tools/munger/scripts/error_gen.py
@@ -39,6 +39,7 @@
ofp_error_msg.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_ERROR
+ self.xid = None
self.err_type = --ERROR_NAME--
self.data = ""
diff --git a/tools/munger/scripts/message_gen.py b/tools/munger/scripts/message_gen.py
index a9531dd..5b6e27b 100644
--- a/tools/munger/scripts/message_gen.py
+++ b/tools/munger/scripts/message_gen.py
@@ -297,6 +297,7 @@
_p2(parent + ".__init__(self)")
_p2("self.version = OFP_VERSION")
_p2("self.type = " + msg_name)
+ _p2("self.xid = None")
if has_list:
_p2('self.' + list_var + ' = []')
if has_string:
@@ -534,6 +535,7 @@
ofp_--TYPE--_stats_request.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REQUEST
+ self.xid = None
self.stats_type = --STATS_NAME--
for (k, v) in kwargs.items():
if hasattr(self, k):
@@ -593,6 +595,7 @@
ofp_stats_reply.__init__(self)
self.version = OFP_VERSION
self.type = OFPT_STATS_REPLY
+ self.xid = None
self.stats_type = --STATS_NAME--
# stats: Array of type --TYPE--_stats_entry
self.entries = []