define priorities as a property on the test class

This is just cleaner than keeping a global dictionary.
diff --git a/oft b/oft
index d7aeb48..8262457 100755
--- a/oft
+++ b/oft
@@ -32,10 +32,10 @@
     port_map          : Map of dataplane OpenFlow port to OS interface names
 </pre>
 
-Each test may be assigned a priority by setting test_prio["TestName"] in 
-the respective module.  For now, the only use of this is to avoid 
+Each test may be assigned a priority by setting the "priority" property
+in the class definition.  For now, the only use of this is to avoid
 automatic inclusion of tests into the default list.  This is done by
-setting the test_prio value less than 0.  Eventually we may add ordering
+setting the priority value less than 0.  Eventually we may add ordering
 of test execution by test priority.
 
 To add a test to the system, either: edit an existing test case file (like
@@ -426,22 +426,19 @@
         return " " * spaces
     return " "
 
-def test_prio_get(mod, test):
+def test_prio_get(test):
     """
     Return the priority of a test
 
     If test is in "skip list" from profile, return the skip value
 
-    If set in the test_prio variable for the module, return
+    If the priority property is set in the class, return
     that value.  Otherwise return 100 (default)
     """
-    if test in profile_mod.skip_test_list:
-        logging.info("Skipping test %s due to profile" % test)
+    if test.__name__ in profile_mod.skip_test_list:
+        logging.info("Skipping test %s due to profile" % test.__name__)
         return TEST_PRIO_SKIP
-    if 'test_prio' in dir(mod):
-        if test in mod.test_prio.keys():
-            return mod.test_prio[test]
-    return TEST_PRIO_DEFAULT
+    return getattr(test, "priority", TEST_PRIO_DEFAULT)
 
 #
 # Main script
@@ -478,7 +475,7 @@
                 desc = desc.split('\n')[0]
             except:
                 desc = "No description"
-            if test_prio_get(mod, testname) < 0:
+            if test_prio_get(test) < 0:
                 start_str = "  * " + testname + ":"
             else:
                 start_str = "    " + testname + ":"
@@ -500,7 +497,7 @@
 if config["list_test_names"]:
     for (modname, (mod, tests)) in test_modules.items():
         for (testname, test) in tests.items():
-            if test_prio_get(mod, testname) >= 0:
+            if test_prio_get(test) >= 0:
                 print "%s.%s" % (modname, testname)
     sys.exit(0)
 
@@ -510,7 +507,7 @@
 
 for (modname, (mod, tests)) in test_modules.items():
     for (testname, test) in tests.items():
-        if test_prio_get(mod, testname) >= 0:
+        if test_prio_get(test) >= 0:
             logging.info("Adding test " + modname + "." + testname)
             suite.addTest(test())
 
@@ -557,7 +554,7 @@
 if os.getuid() != 0 and not config["allow_user"]:
     print "ERROR: Super-user privileges required. Please re-run with " \
           "sudo or as root."
-    exit(1)
+    sys.exit(1)
 
 if config["random_seed"] is not None:
     logging.info("Random seed: %d" % config["random_seed"])
diff --git a/tests/basic.py b/tests/basic.py
index 65f875a..a96adc8 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -38,8 +38,6 @@
 #@var basic_config Local copy of global configuration data
 basic_config = None
 
-test_prio = {}
-
 TEST_VID_DEFAULT = 2
 
 def test_set_init(config):
@@ -60,6 +58,8 @@
     Root class for setting up the controller
     """
 
+    priority = 1
+
     def setUp(self):
         self.config = basic_config
         logging.info("** START TEST CASE " + str(self))
@@ -127,8 +127,6 @@
             logging.error("** FAILED ASSERTION: " + msg)
         unittest.TestCase.assertTrue(self, cond, msg)
 
-test_prio["SimpleProtocol"] = 1
-
 class SimpleDataPlane(SimpleProtocol):
     """
     Root class that sets up the controller and dataplane
@@ -166,6 +164,8 @@
     Root class that sets up only the dataplane
     """
 
+    priority = -1
+
     def setUp(self):
         self.clean_shutdown = True
         self.config = basic_config
@@ -184,8 +184,6 @@
         # self.dataplane.show()
         # Would like an assert that checks the data plane
 
-test_prio["DataPlaneOnly"] = -1
-
 class Echo(SimpleProtocol):
     """
     Test echo response with no data
@@ -277,6 +275,9 @@
     Send a packet to each dataplane port and verify that a packet
     in message is received from the controller for each
     """
+
+    priority = -1
+
     def runTest(self):
         rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
@@ -302,9 +303,6 @@
                             'Packet in message received on port ' + 
                             str(of_port))
 
-test_prio["PacketInDefaultDrop"] = -1
-
-
 class PacketInBroadcastCheck(SimpleDataPlane):
     """
     Check if bcast pkts leak when no flows are present
@@ -313,6 +311,9 @@
     Send in a broadcast pkt
     Look for the packet on other dataplane ports.
     """
+
+    priority = -1
+
     def runTest(self):
         # Need at least two ports
         self.assertTrue(len(basic_port_map) > 1, "Too few ports for test")
@@ -332,8 +333,6 @@
         self.assertTrue(pkt_in is None,
                         'BCast packet received on port ' + str(of_port))
 
-test_prio["PacketInBroadcastCheck"] = -1
-
 class PacketOut(SimpleDataPlane):
     """
     Test packet out function
@@ -437,6 +436,9 @@
 
     Simply verify stats get transaction
     """
+
+    priority = -1
+
     def runTest(self):
         logging.info("Running StatsGet")
         logging.info("Inserting trial flow")
@@ -454,8 +456,6 @@
                         "Did not get response for flow stats")
         logging.debug(response.show())
 
-test_prio["FlowStatsGet"] = -1
-
 class TableStatsGet(SimpleProtocol):
     """
     Get table stats 
diff --git a/tests/bsn_ipmask.py b/tests/bsn_ipmask.py
index 6a4d389..c3688ba 100644
--- a/tests/bsn_ipmask.py
+++ b/tests/bsn_ipmask.py
@@ -17,10 +17,6 @@
 #@var im_config Local copy of global configuration data
 im_config = None
 
-# For test priority
-#@var test_prio Set test priority for local tests
-test_prio = {}
-
 def test_set_init(config):
     basic.test_set_init(config)
 
@@ -58,6 +54,9 @@
     """
     Exercise BSN vendor extension for configuring IP source/dest match mask
     """
+
+    priority = -1
+
     def bsn_set_ip_mask(self, index, mask):
         """
         Use the BSN_SET_IP_MASK vendor command to change the IP mask for the
@@ -190,6 +189,3 @@
         msg(ip3)
         self.dataplane.send(ports[0], str(pkt3))
         receive_pkt_verify(self, [ports[2]], pkt3, ports[0])
-
-# Don't run by default
-test_prio["BSNConfigIPMask"] = -1
diff --git a/tests/caps.py b/tests/caps.py
index 823d55c..449fce6 100644
--- a/tests/caps.py
+++ b/tests/caps.py
@@ -23,9 +23,6 @@
 #@var caps_config Local copy of global configuration data
 caps_config = None
 
-# For test priority
-test_prio = {}
-
 def test_set_init(config):
     """
     Set up function for caps test classes
@@ -130,12 +127,13 @@
     the parameter "caps_table_idx" in the configuration array,
     you can control which table to check.
     """
+
+    priority = -1
+
     def runTest(self):
         logging.info("Running " + str(self))
         flow_caps_common(self)
 
-test_prio["FillTableExact"] = -1
-
 class FillTableWC(basic.SimpleProtocol):
     """
     Fill the flow table with wildcard matches
@@ -155,8 +153,9 @@
     you can control which table to check.
 
     """
+
+    priority = -1
+
     def runTest(self):
         logging.info("Running " + str(self))
         flow_caps_common(self, is_exact=False)
-
-test_prio["FillTableWC"] = -1
diff --git a/tests/cxn.py b/tests/cxn.py
index 87f31c9..7127a91 100644
--- a/tests/cxn.py
+++ b/tests/cxn.py
@@ -24,8 +24,6 @@
 #@var cxn_config Local copy of global configuration data
 cxn_config = None
 
-test_prio = {}
-
 def test_set_init(config):
     """
     Set up function for connection test classes
@@ -44,6 +42,8 @@
     Base handshake case to set up controller, but do not send hello.
     """
 
+    priority = -1
+
     def controllerSetup(self, host, port):
         self.controller = controller.Controller(host=host,port=port)
 
@@ -103,8 +103,6 @@
             logging.error("** FAILED ASSERTION: " + msg)
         unittest.TestCase.assertTrue(self, cond, msg)
 
-test_prio["BaseHandshake"] = -1
-
 class HandshakeNoHello(BaseHandshake):
     """
     TCP connect to switch, but do not sent hello,
@@ -155,6 +153,9 @@
     Complete handshake and respond to echo request, but otherwise do nothing.
     Good for manual testing.
     """
+
+    priority = -1
+
     def runTest(self):
         self.controllerSetup(cxn_config["controller_host"],
                              cxn_config["controller_port"])
@@ -180,5 +181,3 @@
         self.assertTrue(not self.controller.active, 
                         "Expected controller disconnect, but still active")
 
-test_prio["HandshakeAndKeepalive"] = -1
-
diff --git a/tests/flow_query.py b/tests/flow_query.py
index 9931c89..cd607dd 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -83,9 +83,6 @@
 #@var fq_config Local copy of global configuration data
 fq_config = None
 
-# For test priority
-test_prio = {}
-
 
 def test_set_init(config):
     """
@@ -1691,7 +1688,6 @@
 
 # Disabled.
 # Should be DUT dependent.
-test_prio["Flow_Add_5_1"] = -1
 
 class Flow_Add_5_1(basic.SimpleProtocol):
     """
@@ -1700,6 +1696,8 @@
     INPUTS
     None
     """
+
+    priority = -1
     
     def runTest(self):
         logging.info("Flow_Add_5_1 TEST BEGIN")
@@ -1808,7 +1806,6 @@
 
 # Disabled because of bogus capacity reported by OVS.
 # Should be DUT dependent.
-test_prio["Flow_Add_6"] = -1
 
 class Flow_Add_6(basic.SimpleProtocol):
     """
@@ -1818,6 +1815,8 @@
     num_flows - Number of flows to generate
     """
 
+    priority = -1
+
     def runTest(self):
         logging.info("Flow_Add_6 TEST BEGIN")
 
diff --git a/tests/load.py b/tests/load.py
index dadb42f..fa993dc 100644
--- a/tests/load.py
+++ b/tests/load.py
@@ -39,10 +39,6 @@
 #@var load_config Local copy of global configuration data
 load_config = None
 
-# For test priority
-#@var test_prio Set test priority for local tests
-test_prio = {}
-
 
 def test_set_init(config):
     """
@@ -70,6 +66,9 @@
     The test succeeds if the barrier response is received.  Otherwise
     the test fails.
     """
+
+    priority = -1
+
     def runTest(self):
         # Set up flow to send from port 1 to port 2 and copy to CPU
         # Test parameter gives LB port base (assumes consecutive)
@@ -124,6 +123,3 @@
         logging.debug("Deleting all flows from switch")
         rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
-
-# Do not run by default; still mysterious disconnects often
-test_prio["LoadBarrier"] = -1
diff --git a/tests/pktact.py b/tests/pktact.py
index ef7505e..d22690c 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -38,10 +38,6 @@
 #@var pa_config Local copy of global configuration data
 pa_config = None
 
-# For test priority
-#@var test_prio Set test priority for local tests
-test_prio = {}
-
 WILDCARD_VALUES = [ofp.OFPFW_IN_PORT,
                    ofp.OFPFW_DL_VLAN | ofp.OFPFW_DL_VLAN_PCP,
                    ofp.OFPFW_DL_SRC,
@@ -972,6 +968,8 @@
     ExactMatchTagged with many VLANS
     """
 
+    priority = -1
+
     def runTest(self):
         for vid in range(2,100,10):
             flow_match_test(self, pa_port_map, dl_vlan=vid, max_test=5)
@@ -979,10 +977,6 @@
             flow_match_test(self, pa_port_map, dl_vlan=vid, max_test=5)
         flow_match_test(self, pa_port_map, dl_vlan=4094, max_test=5)
 
-# Don't run by default
-test_prio["ExactMatchTaggedMany"] = -1
-
-
 class SingleWildcardMatchPriority(BaseMatchCase):
     """
     SingleWildcardMatchPriority
@@ -1303,6 +1297,9 @@
     """
     Just send a packet thru the switch
     """
+
+    priority = -1
+
     def runTest(self):
         pkt = simple_tcp_packet()
         of_ports = pa_port_map.keys()
@@ -1316,6 +1313,9 @@
     """
     Just send a packet thru the switch
     """
+
+    priority = -1
+
     def runTest(self):
         vid = test_param_get(self.config, 'vid', default=TEST_VID_DEFAULT)
         pkt = simple_tcp_packet(dl_vlan_enable=True, dl_vlan=vid)
@@ -1326,9 +1326,6 @@
         logging.debug("Data: " + str(pkt).encode('hex'))
         self.dataplane.send(ing_port, str(pkt))
 
-test_prio["PacketOnly"] = -1
-test_prio["PacketOnlyTagged"] = -1
-
 class ModifyVID(BaseMatchCase):
     """
     Modify the VLAN ID in the VLAN tag of a tagged packet
@@ -1813,6 +1810,8 @@
     The cases come from the list above
     """
 
+    priority = -1
+
     def runTest(self):
         count = test_param_get(self.config, 'iter_count', default=10)
         tests_done = 0
@@ -1842,9 +1841,6 @@
         logging.info("    active: %d. lookups: %d. matched %d." %
                        (stats["active"], stats["lookups"], stats["matched"]))
 
-# Don't run by default
-test_prio["IterCases"] = -1
-
 #@todo Need to implement tagged versions of the above tests
 #
 #@todo Implement a test case that strips tag 2, adds tag 3
@@ -1874,7 +1870,7 @@
     If only VID 5 distinguishes pkt, this will fail on some platforms
     """   
 
-test_prio["MixedVLAN"] = -1
+    priority = -1
 
 class MatchEach(basic.SimpleDataPlane):
     """
diff --git a/tests/serial_failover.py b/tests/serial_failover.py
index aebbbd2..97df2f8 100644
--- a/tests/serial_failover.py
+++ b/tests/serial_failover.py
@@ -24,8 +24,6 @@
 #@var serial_failover_config Local copy of global configuration data
 serial_failover_config = None
 
-test_prio = {}
-
 def test_set_init(config):
     """
     Set up function for serial failover test classes
@@ -51,6 +49,8 @@
     --test-params="param1=val1;param2=val2"
     """
 
+    priority = -1
+
     # populated by buildControllerList()
     controller_list = []
     controller_idx = 0
@@ -193,14 +193,10 @@
             logging.error("** FAILED ASSERTION: " + msg)
         unittest.TestCase.assertTrue(self, cond, msg)
 
-test_prio["SerialFailover"] = -1
-
 
 class SerialFailoverNoEcho(SerialFailover):
+    priority = -1
 
     def runTest(self):
         for i in range(0,self.test_iterations):
             self.doFailover('no_echo')
-
-test_prio["SerialFailoverNoEcho"] = -1
-