loxi-prep: remove uses of cstruct module

This module does not exist in PyLoxi.
diff --git a/src/python/oftest/controller.py b/src/python/oftest/controller.py
index 4d44c14..6fd88f5 100644
--- a/src/python/oftest/controller.py
+++ b/src/python/oftest/controller.py
@@ -224,12 +224,12 @@
                 continue
 
             self.logger.debug("Msg in: buf len %d. hdr.type %s. hdr.len %d hdr.version %d hdr.xid %d" %
-                              (len(pkt), ofp.cstruct.ofp_type_map[hdr.type], hdr.length, hdr.version, hdr.xid))
-            if hdr.version < ofp.cstruct.OFP_VERSION:
+                              (len(pkt), ofp.ofp_type_map[hdr.type], hdr.length, hdr.version, hdr.xid))
+            if hdr.version < ofp.OFP_VERSION:
                 self.logger.error("Switch only supports up to OpenFlow version %d (OFTest version is %d)",
-                                  hdr.version, ofp.cstruct.OFP_VERSION)
+                                  hdr.version, ofp.OFP_VERSION)
                 print "Switch only supports up to OpenFlow version %d (OFTest version is %d)" % \
-                    (hdr.version, ofp.cstruct.OFP_VERSION)
+                    (hdr.version, ofp.OFP_VERSION)
                 self.disconnect()
                 return
 
@@ -251,7 +251,7 @@
 
                 # Check if keep alive is set; if so, respond to echo requests
                 if self.keep_alive:
-                    if hdr.type == ofp.cstruct.OFPT_ECHO_REQUEST:
+                    if hdr.type == ofp.OFPT_ECHO_REQUEST:
                         self.logger.debug("Responding to echo request")
                         rep = ofp.message.echo_reply()
                         rep.header.xid = hdr.xid
@@ -296,7 +296,7 @@
                     handled = self.handlers["all"](self, msg, rawmsg)
 
                 if not handled: # Not handled, enqueue
-                    self.logger.debug("Enqueuing pkt type " + ofp.cstruct.ofp_type_map[hdr.type])
+                    self.logger.debug("Enqueuing pkt type " + ofp.ofp_type_map[hdr.type])
                     with self.packets_cv:
                         if len(self.packets) >= self.max_pkts:
                             self.packets.pop(0)
@@ -577,7 +577,7 @@
         """
 
         if exp_msg is not None:
-            self.logger.debug("Poll for %s" % ofp.cstruct.ofp_type_map[exp_msg])
+            self.logger.debug("Poll for %s" % ofp.ofp_type_map[exp_msg])
         else:
             self.logger.debug("Poll for any OF message")
 
@@ -589,10 +589,10 @@
                     (msg, pkt) = self.packets.pop(0)
                     return (msg, pkt)
                 else:
-                    self.logger.debug("Looking for %s" % ofp.cstruct.ofp_type_map[exp_msg])
+                    self.logger.debug("Looking for %s" % ofp.ofp_type_map[exp_msg])
                     for i in range(len(self.packets)):
                         msg = self.packets[i][0]
-                        self.logger.debug("Checking packets[%d] (%s)" % (i, ofp.cstruct.ofp_type_map[msg.header.type]))
+                        self.logger.debug("Checking packets[%d] (%s)" % (i, ofp.ofp_type_map[msg.header.type]))
                         if msg.header.type == exp_msg:
                             (msg, pkt) = self.packets.pop(i)
                             return (msg, pkt)
@@ -679,7 +679,7 @@
         msg_version, msg_type, msg_len, msg_xid = struct.unpack_from("!BBHL", outpkt)
         self.logger.debug("Msg out: buf len %d. hdr.type %s. hdr.len %d hdr.version %d hdr.xid %d",
                           len(outpkt),
-                          ofp.cstruct.ofp_type_map.get(msg_type, "unknown (%d)" % msg_type),
+                          ofp.ofp_type_map.get(msg_type, "unknown (%d)" % msg_type),
                           msg_len,
                           msg_version,
                           msg_xid)
diff --git a/src/python/oftest/illegal_message.py b/src/python/oftest/illegal_message.py
index 0c6a878..eeb5022 100644
--- a/src/python/oftest/illegal_message.py
+++ b/src/python/oftest/illegal_message.py
@@ -2,7 +2,7 @@
 Support an illegal message
 """
 
-from cstruct import *
+import of10
 
 ILLEGAL_MESSAGE_TYPE=217
 
@@ -23,7 +23,7 @@
     """
 
     def __init__(self):
-        self.header = ofp_header()
+        self.header = of10.ofp_header()
         self.header.type = ILLEGAL_MESSAGE_TYPE
         self.data = ""
 
@@ -63,7 +63,7 @@
         string.
 
         """
-        length = OFP_HEADER_BYTES
+        length = of10.OFP_HEADER_BYTES
 
         length += len(self.data)
         return length
diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index fcd8f21..fd7d4b2 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -16,7 +16,7 @@
 import oftest
 import oftest.controller
 import oftest.dataplane
-import of10.cstruct
+import of10
 import of10.message
 import of10.action
 import of10.parse
@@ -41,9 +41,9 @@
 
     logging.info("Deleting all flows")
     msg = of10.message.flow_mod()
-    msg.match.wildcards = of10.cstruct.OFPFW_ALL
-    msg.out_port = of10.cstruct.OFPP_NONE
-    msg.command = of10.cstruct.OFPFC_DELETE
+    msg.match.wildcards = of10.OFPFW_ALL
+    msg.out_port = of10.OFPP_NONE
+    msg.command = of10.OFPFC_DELETE
     msg.buffer_id = 0xffffffff
     ctrl.message_send(msg)
     return 0 # for backwards compatibility
@@ -51,8 +51,8 @@
 def required_wildcards(parent):
     w = test_param_get('required_wildcards', default='default')
     if w == 'l3-l4':
-        return (of10.cstruct.OFPFW_NW_SRC_ALL | of10.cstruct.OFPFW_NW_DST_ALL | of10.cstruct.OFPFW_NW_TOS
-                | of10.cstruct.OFPFW_NW_PROTO | of10.cstruct.OFPFW_TP_SRC | of10.cstruct.OFPFW_TP_DST)
+        return (of10.OFPFW_NW_SRC_ALL | of10.OFPFW_NW_DST_ALL | of10.OFPFW_NW_TOS
+                | of10.OFPFW_NW_PROTO | of10.OFPFW_TP_SRC | of10.OFPFW_TP_DST)
     else:
         return 0
 
@@ -461,7 +461,7 @@
     # Expect a packet from each port on egr port list
     for egr_port in egr_port_list:
         check_port = egr_port
-        if egr_port == of10.cstruct.OFPP_IN_PORT:
+        if egr_port == of10.OFPP_IN_PORT:
             check_port = ing_port
         (rcv_port, rcv_pkt, pkt_time) = parent.dataplane.poll(
             port_number=check_port, exp_pkt=exp_pkt_arg)
@@ -517,7 +517,7 @@
                        'Match failed: dl_type: ' + str(req_match.dl_type) +
                        " != " + str(res_match.dl_type))
 
-    if (not(req_match.wildcards & of10.cstruct.OFPFW_DL_TYPE)
+    if (not(req_match.wildcards & of10.OFPFW_DL_TYPE)
         and (req_match.dl_type == IP_ETHERTYPE)):
         parent.assertEqual(req_match.nw_tos, res_match.nw_tos,
                            'Match failed: nw_tos: ' + str(req_match.nw_tos) +
@@ -532,7 +532,7 @@
                            'Match failed: nw_dst: ' + str(req_match.nw_dst) +
                            " != " + str(res_match.nw_dst))
 
-        if (not(req_match.wildcards & of10.cstruct.OFPFW_NW_PROTO)
+        if (not(req_match.wildcards & of10.OFPFW_NW_PROTO)
             and ((req_match.nw_proto == TCP_PROTOCOL)
                  or (req_match.nw_proto == UDP_PROTOCOL))):
             parent.assertEqual(req_match.tp_src, res_match.tp_src,
@@ -565,7 +565,7 @@
     if wildcards is None:
         wildcards = required_wildcards(parent)
     if in_band:
-        wildcards &= ~of10.cstruct.OFPFW_IN_PORT
+        wildcards &= ~of10.OFPFW_IN_PORT
     match.wildcards = wildcards
     match.in_port = ing_port
 
@@ -578,7 +578,7 @@
     request.match = match
     request.buffer_id = 0xffffffff
     if check_expire:
-        request.flags |= of10.cstruct.OFPFF_SEND_FLOW_REM
+        request.flags |= of10.OFPFF_SEND_FLOW_REM
         request.hard_timeout = 1
 
     if action_list is not None:
@@ -750,7 +750,7 @@
         egr_ports = get_egr_list(parent, of_ports, egr_count, 
                                  exclude_list=[ingress_port])
         if ing_port:
-            egr_ports.append(of10.cstruct.OFPP_IN_PORT)
+            egr_ports.append(of10.OFPP_IN_PORT)
         if len(egr_ports) == 0:
             parent.assertTrue(0, "Failed to generate egress port list")
 
@@ -770,7 +770,7 @@
     egr_ports = get_egr_list(parent, of_ports, egr_count,
                              exclude_list=[ingress_port])
     if ing_port:
-        egr_ports.append(of10.cstruct.OFPP_IN_PORT)
+        egr_ports.append(of10.OFPP_IN_PORT)
     flow_match_test_pktout(parent, ingress_port, egr_ports,
                            dl_vlan=dl_vlan,
                            pkt=pkt, exp_pkt=exp_pkt,
@@ -970,9 +970,9 @@
 # If in_band is true, then only drop from first test port
 def flow_mod_gen(port_map, in_band):
     request = of10.message.flow_mod()
-    request.match.wildcards = of10.cstruct.OFPFW_ALL
+    request.match.wildcards = of10.OFPFW_ALL
     if in_band:
-        request.match.wildcards = of10.cstruct.OFPFW_ALL - of10.cstruct.OFPFW_IN_PORT
+        request.match.wildcards = of10.OFPFW_ALL - of10.OFPFW_IN_PORT
         for of_port, ifname in port_map.items(): # Grab first port
             break
         request.match.in_port = of_port
@@ -1003,10 +1003,10 @@
     lookups, matched
     """
     stat_req = of10.message.aggregate_stats_request()
-    stat_req.match = of10.cstruct.ofp_match()
-    stat_req.match.wildcards = of10.cstruct.OFPFW_ALL
+    stat_req.match = of10.ofp_match()
+    stat_req.match.wildcards = of10.OFPFW_ALL
     stat_req.table_id = 0xff
-    stat_req.out_port = of10.cstruct.OFPP_NONE
+    stat_req.out_port = of10.OFPP_NONE
 
     rv = {}
 
@@ -1154,7 +1154,7 @@
         stats.extend(reply.stats)
     return stats
 
-def get_flow_stats(test, match, table_id=0xff, out_port=of10.cstruct.OFPP_NONE):
+def get_flow_stats(test, match, table_id=0xff, out_port=of10.OFPP_NONE):
     """
     Retrieve a list of flow stats entries.
     """
@@ -1178,7 +1178,7 @@
     return get_stats(test, req)
 
 def verify_flow_stats(test, match, table_id=0xff,
-                      out_port=of10.cstruct.OFPP_NONE,
+                      out_port=of10.OFPP_NONE,
                       initial=[],
                       pkts=None, bytes=None):
     """
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index cbbf87e..14d8023 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -5,7 +5,7 @@
 import random
 
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/actions.py b/tests/actions.py
index bacb67c..ef323a0 100644
--- a/tests/actions.py
+++ b/tests/actions.py
@@ -14,7 +14,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/bsn_ipmask.py b/tests/bsn_ipmask.py
index 8304958..b26fe3c 100644
--- a/tests/bsn_ipmask.py
+++ b/tests/bsn_ipmask.py
@@ -6,7 +6,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.base_tests as base_tests
 
diff --git a/tests/bsn_mirror.py b/tests/bsn_mirror.py
index 10c3f93..1a114f9 100644
--- a/tests/bsn_mirror.py
+++ b/tests/bsn_mirror.py
@@ -6,7 +6,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.action as action
 import oftest.action_list as action_list
diff --git a/tests/bsn_shell.py b/tests/bsn_shell.py
index f4d9969..cc06ebe 100644
--- a/tests/bsn_shell.py
+++ b/tests/bsn_shell.py
@@ -6,7 +6,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.base_tests as base_tests
 
diff --git a/tests/caps.py b/tests/caps.py
index b87b0e2..9621923 100644
--- a/tests/caps.py
+++ b/tests/caps.py
@@ -9,7 +9,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/counters.py b/tests/counters.py
index be6c979..1c35dd7 100644
--- a/tests/counters.py
+++ b/tests/counters.py
@@ -11,7 +11,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/cxn.py b/tests/cxn.py
index 34bacad..37c2e52 100644
--- a/tests/cxn.py
+++ b/tests/cxn.py
@@ -12,7 +12,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/default_drop.py b/tests/default_drop.py
index 7103f2a..42261e5 100644
--- a/tests/default_drop.py
+++ b/tests/default_drop.py
@@ -6,7 +6,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/detailed_contr_sw_messages.py b/tests/detailed_contr_sw_messages.py
index 4ca6a6b..e4ebcfb 100644
--- a/tests/detailed_contr_sw_messages.py
+++ b/tests/detailed_contr_sw_messages.py
@@ -11,7 +11,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/flow_expire.py b/tests/flow_expire.py
index 484f22f..6b497cc 100644
--- a/tests/flow_expire.py
+++ b/tests/flow_expire.py
@@ -11,7 +11,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/flow_matches.py b/tests/flow_matches.py
index 9d04093..4c6df05 100644
--- a/tests/flow_matches.py
+++ b/tests/flow_matches.py
@@ -12,7 +12,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/flow_query.py b/tests/flow_query.py
index 271be11..ba59812 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -67,7 +67,7 @@
 
 from oftest import config
 import oftest.controller  as controller
-import oftest.cstruct     as ofp
+import ofp
 import oftest.message     as message
 import oftest.dataplane   as dataplane
 import oftest.action      as action
diff --git a/tests/flow_stats.py b/tests/flow_stats.py
index 2f14156..25ba005 100644
--- a/tests/flow_stats.py
+++ b/tests/flow_stats.py
@@ -12,7 +12,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/load.py b/tests/load.py
index 830aeed..a57b51f 100644
--- a/tests/load.py
+++ b/tests/load.py
@@ -20,7 +20,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/message_types.py b/tests/message_types.py
index fe19f61..c2427d7 100644
--- a/tests/message_types.py
+++ b/tests/message_types.py
@@ -11,7 +11,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/nicira_role.py b/tests/nicira_role.py
index fa4cc97..e8ff88e 100644
--- a/tests/nicira_role.py
+++ b/tests/nicira_role.py
@@ -6,7 +6,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.base_tests as base_tests
 
diff --git a/tests/openflow_protocol_messages.py b/tests/openflow_protocol_messages.py
index b182015..81b1e05 100644
--- a/tests/openflow_protocol_messages.py
+++ b/tests/openflow_protocol_messages.py
@@ -12,7 +12,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/pktact.py b/tests/pktact.py
index fe92aa0..c965f89 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -21,7 +21,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action
diff --git a/tests/port_stats.py b/tests/port_stats.py
index 5e0648f..d2ade19 100644
--- a/tests/port_stats.py
+++ b/tests/port_stats.py
@@ -11,7 +11,7 @@
 
 from oftest import config
 import oftest.controller as controller
-import oftest.cstruct as ofp
+import ofp
 import oftest.message as message
 import oftest.dataplane as dataplane
 import oftest.action as action