diff --git a/tests/basic.py b/tests/basic.py
index 220f7c8..9dec947 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -90,6 +90,27 @@
             sys.exit(1)
         basic_logger.info("Connected " + str(self.controller.switch_addr))
 
+    def inheritSetup(self, parent):
+        """
+        Inherit the setup of a parent
+
+        This allows running at test from within another test.  Do the
+        following:
+
+        sub_test = SomeTestClass()  # Create an instance of the test class
+        sub_test.inheritSetup(self) # Inherit setup of parent
+        sub_test.runTest()          # Run the test
+
+        Normally, only the parent's setUp and tearDown are called and
+        the state after the sub_test is run must be taken into account
+        by subsequent operations.
+        """
+        self.logger = parent.logger
+        self.config = parent.config
+        basic_logger.info("** Setup " + str(self) + " inheriting from "
+                          + str(parent))
+        self.controller = parent.controller
+        
     def tearDown(self):
         basic_logger.info("** END TEST CASE " + str(self))
         self.controller.shutdown()
@@ -120,6 +141,15 @@
         for of_port, ifname in basic_port_map.items():
             self.dataplane.port_add(ifname, of_port)
 
+    def inheritSetup(self, parent):
+        """
+        Inherit the setup of a parent
+
+        See SimpleProtocol.inheritSetup
+        """
+        SimpleProtocol.inheritSetup(self, parent)
+        self.dataplane = parent.dataplane
+
     def tearDown(self):
         basic_logger.info("Teardown for simple dataplane test")
         SimpleProtocol.tearDown(self)
diff --git a/tests/flow_stats.py b/tests/flow_stats.py
index f7a8ad2..91c67a6 100644
--- a/tests/flow_stats.py
+++ b/tests/flow_stats.py
@@ -20,13 +20,13 @@
 from testutils import *
 from time import sleep
 
-#@var port_map Local copy of the configuration map from OF port
+#@var fs_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
-pa_port_map = None
-#@var pa_logger Local logger object
-pa_logger = None
-#@var pa_config Local copy of global configuration data
-pa_config = None
+fs_port_map = None
+#@var fs_logger Local logger object
+fs_logger = None
+#@var fs_config Local copy of global configuration data
+fs_config = None
 
 # TODO: ovs has problems with VLAN id?
 WILDCARD_VALUES = [ofp.OFPFW_IN_PORT,
@@ -49,14 +49,14 @@
     @param config The configuration dictionary; see oft
     """
 
-    global pa_port_map
-    global pa_logger
-    global pa_config
+    global fs_port_map
+    global fs_logger
+    global fs_config
 
-    pa_logger = logging.getLogger("pkt_act")
-    pa_logger.info("Initializing test set")
-    pa_port_map = config["port_map"]
-    pa_config = config
+    fs_logger = logging.getLogger("flow_stats")
+    fs_logger.info("Initializing test set")
+    fs_port_map = config["port_map"]
+    fs_config = config
 
 class SingleFlowStats(basic.SimpleDataPlane):
     """
@@ -77,13 +77,13 @@
 
         all_packets_received = 0
         for i in range(0,test_timeout):
-            pa_logger.info("Sending stats request")
-            rv = self.controller.message_send(stat_req)
-            self.assertTrue(rv != -1, "Error sending flow stat req")
-            do_barrier(self.controller)
-
-            (response, raw) = self.controller.poll(ofp.OFPT_STATS_REPLY, 2)
-            self.assertTrue(len(response.stats) == 1, "Did not receive flow stats reply")
+            fs_logger.info("Sending stats request")
+            response, pkt = self.controller.transact(stat_req,
+                                                     timeout=test_timeout)
+            self.assertTrue(response is not None, 
+                            "No response to stats request")
+            self.assertTrue(len(response.stats) == 1,
+                            "Did not receive flow stats reply")
             for obj in response.stats:
                 # TODO: pad1 and pad2 fields may be nonzero, is this a bug?
                 # for now, just clear them so the assert is simpler
@@ -91,7 +91,7 @@
                 #obj.match.pad2 = [0, 0]
                 #self.assertEqual(match, obj.match,
                 #                 "Matches do not match")
-                pa_logger.info("Received " + str(obj.packet_count) + " packets")
+                fs_logger.info("Received " + str(obj.packet_count) + " packets")
                 if obj.packet_count == packet_count:
                     all_packets_received = 1
 
@@ -103,16 +103,16 @@
                         "Packet count does not match number sent")
 
     def runTest(self):
-        global pa_port_map
+        global fs_port_map
 
         # TODO: set from command-line parameter
         test_timeout = 60
 
-        of_ports = pa_port_map.keys()
+        of_ports = fs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
-        rc = delete_all_flows(self.controller, pa_logger)
+        rc = delete_all_flows(self.controller, fs_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # build packet
@@ -126,7 +126,7 @@
         # build flow
         ingress_port = of_ports[0];
         egress_port = of_ports[1];
-        pa_logger.info("Ingress " + str(ingress_port) + 
+        fs_logger.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
         match.in_port = ingress_port
         flow_mod_msg = message.flow_mod()
@@ -139,7 +139,7 @@
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
        
         # send flow
-        pa_logger.info("Inserting flow")
+        fs_logger.info("Inserting flow")
         rv = self.controller.message_send(flow_mod_msg)
         self.assertTrue(rv != -1, "Error installing flow mod")
         do_barrier(self.controller)
@@ -149,15 +149,15 @@
 
         # send packet N times
         num_sends = random.randint(10,20)
-        pa_logger.info("Sending " + str(num_sends) + " test packets")
+        fs_logger.info("Sending " + str(num_sends) + " test packets")
         for i in range(0,num_sends):
-            pa_logger.info("Sending packet to dp port " + 
+            fs_logger.info("Sending packet to dp port " + 
                            str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
             (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(timeout=
                                                                 test_timeout)
             self.assertTrue(rcv_pkt is not None, "Did not receive packet")
-            pa_logger.debug("Packet len " + str(len(pkt)) + " in on " + 
+            fs_logger.debug("Packet len " + str(len(pkt)) + " in on " + 
                             str(rcv_port))
             self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
             for j in range(0,test_timeout):
@@ -204,19 +204,19 @@
         act.port = egress_port
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
 
-        pa_logger.info("Ingress " + str(ingress_port) + 
+        fs_logger.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
 
         return flow_mod_msg
 
     def sendPacket(self, pkt, ingress_port, egress_port, test_timeout):
-        pa_logger.info("Sending packet to dp port " + 
+        fs_logger.info("Sending packet to dp port " + 
                        str(ingress_port))
         self.dataplane.send(ingress_port, str(pkt))
         (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(timeout=
                                                             test_timeout)
         self.assertTrue(rcv_pkt is not None, "Did not receive packet")
-        pa_logger.debug("Packet len " + str(len(pkt)) + " in on " + 
+        fs_logger.debug("Packet len " + str(len(pkt)) + " in on " + 
                         str(rcv_port))
         self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
         for j in range(0,test_timeout):
@@ -234,12 +234,11 @@
 
         all_packets_received = 0
         for i in range(0,test_timeout):
-            pa_logger.info("Sending stats request")
-            rv = self.controller.message_send(stat_req)
-            self.assertTrue(rv != -1, "Error sending flow stat req")
-            do_barrier(self.controller)
-
-            (response, raw) = self.controller.poll(ofp.OFPT_STATS_REPLY, 2)
+            fs_logger.info("Sending stats request")
+            response, pkt = self.controller.transact(stat_req,
+                                                     timeout=test_timeout)
+            self.assertTrue(response is not None,
+                            "No response to stats request")
             self.assertTrue(len(response.stats) >= 1,
                             "Did not receive flow stats reply")
             total_packets = 0
@@ -250,7 +249,7 @@
                 #obj.match.pad2 = [0, 0]
                 #self.assertEqual(match, obj.match,
                 #                 "Matches do not match")
-                pa_logger.info("Received " + str(obj.packet_count) + " packets")
+                fs_logger.info("Received " + str(obj.packet_count) + " packets")
                 total_packets += obj.packet_count
             if total_packets == packet_count:
                 all_packets_received = 1
@@ -261,19 +260,19 @@
                         "Packet count does not match number sent")
 
     def runTest(self):
-        global pa_port_map
+        global fs_port_map
 
         # TODO: set from command-line parameter
         test_timeout = 60
 
-        of_ports = pa_port_map.keys()
+        of_ports = fs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) >= 3, "Not enough ports for test")
         ingress_port = of_ports[0];
         egress_port1 = of_ports[1];
         egress_port2 = of_ports[2];
 
-        rc = delete_all_flows(self.controller, pa_logger)
+        rc = delete_all_flows(self.controller, fs_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         pkt1 = simple_tcp_packet()
@@ -282,18 +281,18 @@
         pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
         flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
        
-        pa_logger.info("Inserting flow1")
+        fs_logger.info("Inserting flow1")
         rv = self.controller.message_send(flow_mod_msg1)
         self.assertTrue(rv != -1, "Error installing flow mod")
-        pa_logger.info("Inserting flow2")
+        fs_logger.info("Inserting flow2")
         rv = self.controller.message_send(flow_mod_msg2)
         self.assertTrue(rv != -1, "Error installing flow mod")
         do_barrier(self.controller)
 
         num_pkt1s = random.randint(10,30)
-        pa_logger.info("Sending " + str(num_pkt1s) + " pkt1s")
+        fs_logger.info("Sending " + str(num_pkt1s) + " pkt1s")
         num_pkt2s = random.randint(10,30)
-        pa_logger.info("Sending " + str(num_pkt2s) + " pkt2s")
+        fs_logger.info("Sending " + str(num_pkt2s) + " pkt2s")
         for i in range(0,num_pkt1s):
             self.sendPacket(pkt1, ingress_port, egress_port1, test_timeout)
         for i in range(0,num_pkt2s):
@@ -337,19 +336,19 @@
         act.port = egress_port
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
 
-        pa_logger.info("Ingress " + str(ingress_port) + 
+        fs_logger.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
 
         return flow_mod_msg
 
     def sendPacket(self, pkt, ingress_port, egress_port, test_timeout):
-        pa_logger.info("Sending packet to dp port " + 
+        fs_logger.info("Sending packet to dp port " + 
                        str(ingress_port))
         self.dataplane.send(ingress_port, str(pkt))
         (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(timeout=
                                                             test_timeout)
         self.assertTrue(rcv_pkt is not None, "Did not receive packet")
-        pa_logger.debug("Packet len " + str(len(pkt)) + " in on " + 
+        fs_logger.debug("Packet len " + str(len(pkt)) + " in on " + 
                         str(rcv_port))
         self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
         for j in range(0,test_timeout):
@@ -368,19 +367,18 @@
 
         all_packets_received = 0
         for i in range(0,test_timeout):
-            pa_logger.info("Sending stats request")
-            rv = self.controller.message_send(stat_req)
-            self.assertTrue(rv != -1, "Error sending flow stat req")
-            do_barrier(self.controller)
-
-            (response, raw) = self.controller.poll(ofp.OFPT_STATS_REPLY, 2)
+            fs_logger.info("Sending stats request")
+            response, pkt = self.controller.transact(stat_req,
+                                                     timeout=test_timeout)
+            self.assertTrue(response is not None, 
+                            "No response to stats request")
             self.assertTrue(len(response.stats) == 1, 
                             "Did not receive flow stats reply")
             for obj in response.stats:
                 self.assertTrue(obj.flow_count == flow_count,
                                 "Flow count " + str(obj.flow_count) +
                                 " does not match expected " + str(flow_count))
-                pa_logger.info("Received " + str(obj.packet_count) + " packets")
+                fs_logger.info("Received " + str(obj.packet_count) + " packets")
                 if obj.packet_count == packet_count:
                     all_packets_received = 1
 
@@ -392,19 +390,19 @@
                         "Packet count does not match number sent")
 
     def runTest(self):
-        global pa_port_map
+        global fs_port_map
 
         # TODO: set from command-line parameter
         test_timeout = 60
 
-        of_ports = pa_port_map.keys()
+        of_ports = fs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) >= 3, "Not enough ports for test")
         ingress_port = of_ports[0];
         egress_port1 = of_ports[1];
         egress_port2 = of_ports[2];
 
-        rc = delete_all_flows(self.controller, pa_logger)
+        rc = delete_all_flows(self.controller, fs_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         pkt1 = simple_tcp_packet()
@@ -413,18 +411,18 @@
         pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
         flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
        
-        pa_logger.info("Inserting flow1")
+        fs_logger.info("Inserting flow1")
         rv = self.controller.message_send(flow_mod_msg1)
         self.assertTrue(rv != -1, "Error installing flow mod")
-        pa_logger.info("Inserting flow2")
+        fs_logger.info("Inserting flow2")
         rv = self.controller.message_send(flow_mod_msg2)
         self.assertTrue(rv != -1, "Error installing flow mod")
         do_barrier(self.controller)
 
         num_pkt1s = random.randint(10,30)
-        pa_logger.info("Sending " + str(num_pkt1s) + " pkt1s")
+        fs_logger.info("Sending " + str(num_pkt1s) + " pkt1s")
         num_pkt2s = random.randint(10,30)
-        pa_logger.info("Sending " + str(num_pkt2s) + " pkt2s")
+        fs_logger.info("Sending " + str(num_pkt2s) + " pkt2s")
         for i in range(0,num_pkt1s):
             self.sendPacket(pkt1, ingress_port, egress_port1, test_timeout)
         for i in range(0,num_pkt2s):
diff --git a/tests/pktact.py b/tests/pktact.py
index c045e5d..2ee1968 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -28,6 +28,7 @@
 import oftest.action as action
 import oftest.parse as parse
 import basic
+import time
 
 from testutils import *
 
@@ -79,8 +80,6 @@
     @param config The configuration dictionary; see oft
     """
 
-    basic.test_set_init(config)
-
     global pa_port_map
     global pa_logger
     global pa_config
@@ -1143,6 +1142,57 @@
         flow_match_test(self, pa_port_map, pkt=pkt, exp_pkt=exp_pkt, 
                         action_list=acts, max_test=2, egr_count=-1)
 
+# You can pick and choose these by commenting tests in or out
+iter_classes = [
+    basic.PacketIn,
+    basic.PacketOut,
+    DirectPacket,
+    DirectTwoPorts,
+    DirectMC,
+    AllWildcardMatch,
+    AllWildcardMatchTagged,
+    SingleWildcardMatch,
+    SingleWildcardMatchTagged,
+    ExactMatch,
+    ExactMatchTagged,
+    SingleWildcardMatch,
+    ModifyL2Src,
+    ModifyL2Dst,
+    ModifyL2SrcMC,
+    ModifyL2DstMC,
+    ModifyL2SrcDstMC
+    ]
+
+class IterCases(BaseMatchCase):
+    def runTest(self):
+        count = test_param_get(self.config, 'iter_count', default=10)
+        tests_done = 0
+        pa_logger.info("Running iteration test " + str(count) + " times")
+        start = time.time()
+        last = start
+        for idx in range(count):
+            pa_logger.info("Iteration " + str(idx + 1))
+            for cls in iter_classes:
+                test = cls()
+                test.inheritSetup(self)
+                test.runTest()
+                tests_done += 1
+                if time.time() - last > 60:
+                    last = time.time()
+                    print("IterCases: Ran %d tests in %d " %
+                          (tests_done, last - start) + 
+                          "seconds so far")
+        stats = all_stats_get(self)
+        last = time.time()
+        pa_logger.info("\nIterCases ran %d tests in %d seconds." %
+                       (tests_done, last - start))
+        pa_logger.info("    flows: %d. packets: %d. bytes: %d" %
+                       (stats["flows"], stats["packets"], stats["bytes"]))
+        pa_logger.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
 #
diff --git a/tests/testutils.py b/tests/testutils.py
index 5a99a00..221fc67 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -455,7 +455,7 @@
 
     return request
 
-def flow_msg_install(parent, request, clear_table=True):
+def flow_msg_install(parent, request):
     """
     Install a flow mod message in the switch
 
@@ -463,6 +463,8 @@
     @param request The request, all set to go
     @param clear_table If true, clear the flow table before installing
     """
+
+    clear_table = test_param_get(parent.config, 'clear_table', default=True)
     if clear_table:
         parent.logger.debug("Clear flow table")
         rc = delete_all_flows(parent.controller, parent.logger)
@@ -777,3 +779,38 @@
     else:
         sys.stderr.write("(S)")
 
+
+def all_stats_get(parent):
+    """
+    Get the aggregate stats for all flows in the table
+    @param parent Test instance with controller connection and assert
+    @returns dict with keys flows, packets, bytes, active (flows), 
+    lookups, matched
+    """
+    stat_req = message.aggregate_stats_request()
+    stat_req.match = ofp.ofp_match()
+    stat_req.match.wildcards = ofp.OFPFW_ALL
+    stat_req.table_id = 0xff
+    stat_req.out_port = ofp.OFPP_NONE
+
+    rv = {}
+
+    (reply, pkt) = parent.controller.transact(stat_req, timeout=2)
+    parent.assertTrue(len(reply.stats) == 1, "Did not receive flow stats reply")
+
+    for obj in reply.stats:
+        (rv["flows"], rv["packets"], rv["bytes"]) = (obj.flow_count, 
+                                                  obj.packet_count, obj.byte_count)
+        break
+
+    request = message.table_stats_request()
+    (reply , pkt) = parent.controller.transact(request, timeout=2)
+
+    
+    (rv["active"], rv["lookups"], rv["matched"]) = (0,0,0)
+    for obj in reply.stats:
+        rv["active"] += obj.active_count
+        rv["lookups"] += obj.lookup_count
+        rv["matched"] += obj.matched_count
+
+    return rv
