diff --git a/tests/flow_query.py b/tests/flow_query.py
index a79c9f9..69402f4 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -375,15 +375,10 @@
             return False
         return True
 
-    def non_key_equal(self, x):
-        if self.cookie != x.cookie:
-            return False
-        if self.idle_timeout != x.idle_timeout:
-            return False
-        if self.hard_timeout != x.hard_timeout:
-            return False
-        if True:
-            # For now, compare actions lists as unordered
+    def actions_equal(self, x):
+        if test_param_get(fq_config, "conservative_ordered_actions", True):
+            # Compare actions lists as unordered
+            
             aa = copy.deepcopy(x.actions.actions)
             for a in self.actions.actions:
                 i = 0
@@ -398,6 +393,15 @@
             return aa == []
         else:
             return self.actions == x.actions
+
+    def non_key_equal(self, x):
+        if self.cookie != x.cookie:
+            return False
+        if self.idle_timeout != x.idle_timeout:
+            return False
+        if self.hard_timeout != x.hard_timeout:
+            return False
+        return self.actions_equal(x)
         
     def key_str(self):
         result = "priority=%d" % self.priority
@@ -1157,19 +1161,19 @@
 removed_msgs = []
 
 def error_handler(self, msg, rawmsg):
-    fq_logger.debug("Got an ERROR message, type=%d, code=%d" \
+    fq_logger.info("Got an ERROR message, type=%d, code=%d" \
                     % (msg.type, msg.code) \
                     )
-    fq_logger.debug("Message header:")
-    fq_logger.debug(msg.header.show())
+    fq_logger.info("Message header:")
+    fq_logger.info(msg.header.show())
     global error_msgs
     error_msgs.append(msg)
     pass
 
 def removed_handler(self, msg, rawmsg):
-    fq_logger.debug("Got a REMOVED message")
-    fq_logger.debug("Message header:")
-    fq_logger.debug(msg.header.show())
+    fq_logger.info("Got a REMOVED message")
+    fq_logger.info("Message header:")
+    fq_logger.info(msg.header.show())
     global removed_msgs
     removed_msgs.append(msg)
     pass
@@ -1281,7 +1285,7 @@
         if flow_cfg.send_rem:
             flow_mod_msg.flags = flow_mod_msg.flags | ofp.OFPFF_SEND_FLOW_REM
         flow_mod_msg.header.xid = random.randrange(1,0xffffffff)
-        fq_logger.debug("Sending flow_mod(add), xid=%d"
+        fq_logger.info("Sending flow_mod(add), xid=%d"
                         % (flow_mod_msg.header.xid)
                         )
         return (self.controller.message_send(flow_mod_msg) != -1)
@@ -1293,7 +1297,7 @@
         flow_mod_msg.buffer_id   = 0xffffffff
         flow_cfg.to_flow_mod_msg(flow_mod_msg)
         flow_mod_msg.header.xid = random.randrange(1,0xffffffff)
-        fq_logger.debug("Sending flow_mod(mod), xid=%d"
+        fq_logger.info("Sending flow_mod(mod), xid=%d"
                         % (flow_mod_msg.header.xid)
                         )
         return (self.controller.message_send(flow_mod_msg) != -1)
@@ -1307,7 +1311,7 @@
         flow_mod_msg.out_port    = ofp.OFPP_NONE
         flow_cfg.to_flow_mod_msg(flow_mod_msg)
         flow_mod_msg.header.xid = random.randrange(1,0xffffffff)
-        fq_logger.debug("Sending flow_mod(del), xid=%d"
+        fq_logger.info("Sending flow_mod(del), xid=%d"
                         % (flow_mod_msg.header.xid)
                         )
         return (self.controller.message_send(flow_mod_msg) != -1)
@@ -1320,22 +1324,22 @@
     def errors_verify(self, num_exp, type = 0, code = 0):
         result = True
         global error_msgs
-        fq_logger.debug("Expecting %d error messages" % (num_exp))
+        fq_logger.info("Expecting %d error messages" % (num_exp))
         num_got = len(error_msgs)
-        fq_logger.debug("Got %d error messages" % (num_got))
+        fq_logger.info("Got %d error messages" % (num_got))
         if num_got != num_exp:
             fq_logger.error("Incorrect number of error messages received")
             result = False
         if num_exp == 0:
             return result
         elif num_exp == 1:
-            fq_logger.debug("Expecting error message, type=%d, code=%d" \
+            fq_logger.info("Expecting error message, type=%d, code=%d" \
                             % (type, code) \
                             )
             f = False
             for e in error_msgs:
                 if e.type == type and e.code == code:
-                    fq_logger.debug("Got it")
+                    fq_logger.info("Got it")
                     f = True
             if not f:
                 fq_logger.error("Did not get it")
@@ -1348,9 +1352,9 @@
     def removed_verify(self, num_exp):
         result = True
         global removed_msgs
-        fq_logger.debug("Expecting %d removed messages" % (num_exp))
+        fq_logger.info("Expecting %d removed messages" % (num_exp))
         num_got = len(removed_msgs)
-        fq_logger.debug("Got %d removed messages" % (num_got))
+        fq_logger.info("Got %d removed messages" % (num_got))
         if num_got != num_exp:
             fq_logger.error("Incorrect number of removed messages received")
             result = False
@@ -1359,41 +1363,20 @@
         fq_logger.error("Can't expect more than 1 error message type")
         return False
 
-        
-#         fq_logger.debug("Expecting %d error messages" % (num))
-#         if num > 0:
-#             fq_logger.debug("with type=%d code=%d" % (type, code))            
-#         result = True
-#         n = 0
-#         while True:
-#             (errmsg, pkt) = self.controller.poll(ofp.OFPT_ERROR, 1)
-#             if errmsg is None:
-#                 break
-#             fq_logger.debug("Got error message, type=%d, code=%d" \
-#                               % (errmsg.type, errmsg.code) \
-#                               )
-#             if num == 0 or errmsg.type != type or errmsg.code != code:
-#                 fq_logger.debug("Unexpected error message")
-#                 result = False
-#             n = n + 1
-#         if n != num:
-#             fq_logger.error("Received %d error messages" % (n))
-#             result = False
-#         return result
-
-    def flow_tbl_verify(self):
+    # modf == True <=> Verify for flow modify, else for add/delete
+    def flow_tbl_verify(self, modf = False):
         result = True
     
         # Verify flow count in switch
-        fq_logger.debug("Reading table stats")
-        fq_logger.debug("Expecting %d flows" % (self.flow_tbl.count()))
+        fq_logger.info("Reading table stats")
+        fq_logger.info("Expecting %d flows" % (self.flow_tbl.count()))
         if not self.tbl_stats_get():
             fq_logger.error("Get table stats failed")
             return False
         n = 0
         for ts in self.tbl_stats.stats:
             n = n + ts.active_count
-        fq_logger.debug("Table stats reported %d active flows" \
+        fq_logger.info("Table stats reported %d active flows" \
                           % (n) \
                           )
         if n != self.flow_tbl.count():
@@ -1401,12 +1384,12 @@
             result = False
     
         # Read flows from switch
-        fq_logger.debug("Retrieving flows from switch")
-        fq_logger.debug("Expecting %d flows" % (self.flow_tbl.count()))
+        fq_logger.info("Retrieving flows from switch")
+        fq_logger.info("Expecting %d flows" % (self.flow_tbl.count()))
         if not self.flow_stats_get():
             fq_logger.error("Get flow stats failed")
             return False
-        fq_logger.debug("Retrieved %d flows" % (len(self.flow_stats.stats)))
+        fq_logger.info("Retrieved %d flows" % (len(self.flow_stats.stats)))
     
         # Verify flows returned by switch
     
@@ -1414,27 +1397,53 @@
             fq_logger.error("Switch reported incorrect number of flows")
             result = False
     
-        fq_logger.debug("Verifying received flows")
+        fq_logger.info("Verifying received flows")
         for fc in self.flow_tbl.values():
             fc.matched = False
         for fs in self.flow_stats.stats:
             flow_in = Flow_Cfg()
             flow_in.from_flow_stat(fs)
-            fq_logger.debug("Received flow:")
-            fq_logger.debug(str(flow_in))
+            fq_logger.info("Received flow:")
+            fq_logger.info(str(flow_in))
             fc = self.flow_tbl.find(flow_in)
             if fc is None:
+                fq_logger.error("Received flow:")
+                fq_logger.error(str(flow_in))
                 fq_logger.error("does not match any defined flow")
                 result = False
             elif fc.matched:
+                fq_logger.error("Received flow:")
+                fq_logger.error(str(flow_in))
                 fq_logger.error("re-matches defined flow:")
-                fq_logger.debug(str(fc))
+                fq_logger.info(str(fc))
                 result = False
             else:
-                fq_logger.debug("matched")
-                if not flow_in == fc:
-                    fq_logger.error("Non-key portions of flow do not match")
-                    result = False
+                fq_logger.info("matched")
+                if modf:
+                    # Check for modify
+                    
+                    if flow_in.cookie != fc.cookie:
+                        fq_logger.warning("Defined flow:")
+                        fq_logger.warning(str(fc))
+                        fq_logger.warning("Received flow:")
+                        fq_logger.warning(str(flow_in))
+                        fq_logger.warning("cookies do not match")
+                    if not flow_in.actions_equal(fc):
+                        fq_logger.error("Defined flow:")
+                        fq_logger.error(str(fc))
+                        fq_logger.error("Received flow:")
+                        fq_logger.error(str(flow_in))
+                        fq_logger.error("actions do not match")
+                else:
+                    # Check for add/delete
+                    
+                    if not flow_in == fc:
+                        fq_logger.error("Defined flow:")
+                        fq_logger.error(str(fc))
+                        fq_logger.error("Received flow:")
+                        fq_logger.error(str(flow_in))
+                        fq_logger.error("non-key portions of flow do not match")
+                        result = False
                 fc.matched = True
         for fc in self.flow_tbl.values():
             if not fc.matched:
@@ -1484,19 +1493,19 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Add_5 TEST BEGIN")
+        fq_logger.info("Flow_Add_5 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -1509,7 +1518,7 @@
             for ts in sw.tbl_stats.stats:
                 num_flows = num_flows + ts.max_entries
 
-        fq_logger.debug("Generating %d flows" % (num_flows))        
+        fq_logger.info("Generating %d flows" % (num_flows))        
 
         # Dream up some flow information, i.e. space to chose from for
         # random flow parameter generation
@@ -1524,10 +1533,10 @@
 
         # Send flow table to switch
 
-        fq_logger.debug("Sending flow adds to switch")
+        fq_logger.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.debug("Adding flow:")
-            fq_logger.debug(str(fc));
+            fq_logger.info("Adding flow:")
+            fq_logger.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -1548,7 +1557,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_5 TEST FAILED")
-        fq_logger.debug("Flow_Add_5 TEST PASSED")
+        fq_logger.info("Flow_Add_5 TEST PASSED")
 
 
 # FLOW ADD 5_1
@@ -1585,19 +1594,19 @@
     """
     
     def runTest(self):
-        fq_logger.debug("Flow_Add_5_1 TEST BEGIN")
+        fq_logger.info("Flow_Add_5_1 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
         
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -1627,10 +1636,10 @@
 
         # Send it to the switch
 
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc))
-        fq_logger.debug("should be canonicalized as:")
-        fq_logger.debug(str(fcc))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc))
+        fq_logger.info("should be canonicalized as:")
+        fq_logger.info(str(fcc))
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
@@ -1652,7 +1661,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_5_1 TEST FAILED")
-        fq_logger.debug("Flow_Add_5_1 TEST PASSED")
+        fq_logger.info("Flow_Add_5_1 TEST PASSED")
 
 
 # FLOW ADD 6
@@ -1699,17 +1708,17 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Add_6 TEST BEGIN")
+        fq_logger.info("Flow_Add_6 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -1719,8 +1728,8 @@
         for ts in sw.tbl_stats.stats:
             num_flows = num_flows + ts.max_entries
 
-        fq_logger.debug("Switch capacity is %d flows" % (num_flows))        
-        fq_logger.debug("Generating %d flows" % (num_flows))        
+        fq_logger.info("Switch capacity is %d flows" % (num_flows))        
+        fq_logger.info("Generating %d flows" % (num_flows))        
 
         # Dream up some flow information, i.e. space to chose from for
         # random flow parameter generation
@@ -1735,10 +1744,10 @@
 
         # Send flow table to switch
 
-        fq_logger.debug("Sending flow adds to switch")
+        fq_logger.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.debug("Adding flow:")
-            fq_logger.debug(str(fc));
+            fq_logger.info("Adding flow:")
+            fq_logger.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -1754,7 +1763,7 @@
 
         # Dream up one more flow
 
-        fq_logger.debug("Creating one more flow")
+        fq_logger.info("Creating one more flow")
         while True:
             fc = Flow_Cfg()
             fc.rand(fi, \
@@ -1769,8 +1778,8 @@
         # Send one-more flow
 
         fc.send_rem = False
-        fq_logger.debug("Sending flow add switch")
-        fq_logger.debug(str(fc));
+        fq_logger.info("Sending flow add switch")
+        fq_logger.info(str(fc));
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -1792,7 +1801,7 @@
             result = False
 
         self.assertTrue(result, "Flow_add_6 TEST FAILED")
-        fq_logger.debug("Flow_add_6 TEST PASSED")
+        fq_logger.info("Flow_add_6 TEST PASSED")
 
 
 # FLOW ADD 7
@@ -1826,17 +1835,17 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Add_7 TEST BEGIN")
+        fq_logger.info("Flow_Add_7 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -1860,8 +1869,8 @@
 
         # Send it to the switch
 
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -1880,8 +1889,8 @@
 
         # Send that to the switch
         
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc2))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc2))
         fc2.send_rem = False
         self.assertTrue(sw.flow_add(fc2), "Failed to add flow")
         ft.insert(fc2)
@@ -1904,7 +1913,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_7 TEST FAILED")
-        fq_logger.debug("Flow_Add_7 TEST PASSED")
+        fq_logger.info("Flow_Add_7 TEST PASSED")
 
 
 # FLOW ADD 8
@@ -1944,17 +1953,17 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Add_8 TEST BEGIN")
+        fq_logger.info("Flow_Add_8 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -1981,8 +1990,8 @@
 
         # Send it to the switch
 
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2004,14 +2013,14 @@
             wn = "OFPFW_NW_DST"
         else:
             wn = all_wildcard_names[w]
-        fq_logger.debug("Wildcarding out %s" % (wn))
+        fq_logger.info("Wildcarding out %s" % (wn))
         fc2.match.wildcards = fc2.match.wildcards | w
         fc2 = fc2.canonical()
 
         # Send that to the switch, with overlap checking
         
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc2))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc2))
         fc2.send_rem = False
         self.assertTrue(sw.flow_add(fc2, True), "Failed to add flow")
 
@@ -2035,7 +2044,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_8 TEST FAILED")
-        fq_logger.debug("Flow_Add_8 TEST PASSED")
+        fq_logger.info("Flow_Add_8 TEST PASSED")
 
 
 # FLOW MODIFY 1
@@ -2068,17 +2077,17 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Mod_1 TEST BEGIN")
+        fq_logger.info("Flow_Mod_1 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -2102,8 +2111,8 @@
 
         # Send it to the switch
 
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2120,12 +2129,10 @@
             if fc2 != fc:
                 break
 
-        fc2.cookie = fc.cookie
-
         # Send that to the switch
         
-        fq_logger.debug("Sending strict flow mod to switch:")
-        fq_logger.debug(str(fc2))
+        fq_logger.info("Sending strict flow mod to switch:")
+        fq_logger.info(str(fc2))
         fc2.send_rem = False
         self.assertTrue(sw.flow_mod(fc2, True), "Failed to modify flow")
         ft.insert(fc2)
@@ -2144,11 +2151,11 @@
         # Verify flow table
 
         sw.flow_tbl = ft
-        if not sw.flow_tbl_verify():
+        if not sw.flow_tbl_verify(True):
             result = False
 
         self.assertTrue(result, "Flow_Mod_1 TEST FAILED")
-        fq_logger.debug("Flow_Mod_1 TEST PASSED")
+        fq_logger.info("Flow_Mod_1 TEST PASSED")
 
 
 # FLOW MODIFY 2
@@ -2191,19 +2198,19 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Mod_2 TEST BEGIN")
+        fq_logger.info("Flow_Mod_2 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -2223,10 +2230,10 @@
 
         # Send flow table to switch
 
-        fq_logger.debug("Sending flow adds to switch")
+        fq_logger.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.debug("Adding flow:")
-            fq_logger.debug(str(fc));
+            fq_logger.info("Adding flow:")
+            fq_logger.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -2247,8 +2254,8 @@
             result = False
 
         # Pick a random flow as a basis
-        
-        mfc = copy.deepcopy(ft.values()[0])
+
+        mfc = copy.deepcopy((ft.values())[0])
         mfc.rand_mod(fi, sw.sw_features.actions, sw.valid_ports)
 
         # Repeatedly wildcard qualifiers
@@ -2282,9 +2289,9 @@
             if n > 1:
                 break
                     
-        fq_logger.debug("Modifying %d flows" % (n))
-        fq_logger.debug("Sending flow mod to switch:")
-        fq_logger.debug(str(mfc))
+        fq_logger.info("Modifying %d flows" % (n))
+        fq_logger.info("Sending flow mod to switch:")
+        fq_logger.info(str(mfc))
         self.assertTrue(sw.flow_mod(mfc, False), "Failed to modify flow")
 
         # Do barrier, to make sure all flows are in
@@ -2304,11 +2311,11 @@
         # Verify flow table
 
         sw.flow_tbl = ft
-        if not sw.flow_tbl_verify():
+        if not sw.flow_tbl_verify(True):
             result = False
 
         self.assertTrue(result, "Flow_Mod_2 TEST FAILED")
-        fq_logger.debug("Flow_Mod_2 TEST PASSED")
+        fq_logger.info("Flow_Mod_2 TEST PASSED")
 
 
 # FLOW MODIFY 3
@@ -2337,17 +2344,17 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Mod_3 TEST BEGIN")
+        fq_logger.info("Flow_Mod_3 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -2371,8 +2378,8 @@
 
         # Send it to the switch
 
-        fq_logger.debug("Sending flow mod to switch:")
-        fq_logger.debug(str(fc))
+        fq_logger.info("Sending flow mod to switch:")
+        fq_logger.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_mod(fc, True), "Failed to modify flows")
@@ -2396,7 +2403,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Mod_3 TEST FAILED")
-        fq_logger.debug("Flow_Mod_3 TEST PASSED")
+        fq_logger.info("Flow_Mod_3 TEST PASSED")
 
 
 # FLOW DELETE 1
@@ -2428,17 +2435,17 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Del_1 TEST BEGIN")
+        fq_logger.info("Flow_Del_1 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -2462,8 +2469,8 @@
 
         # Send it to the switch
 
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2482,8 +2489,8 @@
 
         # Delete strictly
         
-        fq_logger.debug("Sending strict flow del to switch:")
-        fq_logger.debug(str(fc2))
+        fq_logger.info("Sending strict flow del to switch:")
+        fq_logger.info(str(fc2))
         self.assertTrue(sw.flow_del(fc2, True), "Failed to delete flow")
         ft.delete(fc)
 
@@ -2505,7 +2512,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Del_1 TEST FAILED")
-        fq_logger.debug("Flow_Del_1 TEST PASSED")
+        fq_logger.info("Flow_Del_1 TEST PASSED")
 
 
 # FLOW DELETE 2
@@ -2546,19 +2553,19 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Del_2 TEST BEGIN")
+        fq_logger.info("Flow_Del_2 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -2578,10 +2585,10 @@
 
         # Send flow table to switch
 
-        fq_logger.debug("Sending flow adds to switch")
+        fq_logger.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.debug("Adding flow:")
-            fq_logger.debug(str(fc));
+            fq_logger.info("Adding flow:")
+            fq_logger.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -2637,9 +2644,9 @@
             if n > 1:
                 break
                     
-        fq_logger.debug("Deleting %d flows" % (n))
-        fq_logger.debug("Sending flow del to switch:")
-        fq_logger.debug(str(dfc))
+        fq_logger.info("Deleting %d flows" % (n))
+        fq_logger.info("Sending flow del to switch:")
+        fq_logger.info(str(dfc))
         self.assertTrue(sw.flow_del(dfc, False), "Failed to delete flows")
 
         # Do barrier, to make sure all flows are in
@@ -2663,7 +2670,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Del_2 TEST FAILED")
-        fq_logger.debug("Flow_Del_2 TEST PASSED")
+        fq_logger.info("Flow_Del_2 TEST PASSED")
 
 
 # FLOW DELETE 4
@@ -2698,17 +2705,17 @@
     """
 
     def runTest(self):
-        fq_logger.debug("Flow_Del_4 TEST BEGIN")
+        fq_logger.info("Flow_Del_4 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.debug("Deleting all flows from switch")
+        fq_logger.info("Deleting all flows from switch")
         rc = delete_all_flows(self.controller, fq_logger)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
 
-        fq_logger.debug("Getting switch capabilities")        
+        fq_logger.info("Getting switch capabilities")        
         sw = Switch()
         sw.controller_set(self.controller)
         self.assertTrue(sw.features_get(), "Get switch features failed")
@@ -2732,8 +2739,8 @@
 
         # Send it to the switch. with "notify on removed"
 
-        fq_logger.debug("Sending flow add to switch:")
-        fq_logger.debug(str(fc))
+        fq_logger.info("Sending flow add to switch:")
+        fq_logger.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = True
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2752,8 +2759,8 @@
 
         # Delete strictly
         
-        fq_logger.debug("Sending strict flow del to switch:")
-        fq_logger.debug(str(fc2))
+        fq_logger.info("Sending strict flow del to switch:")
+        fq_logger.info(str(fc2))
         self.assertTrue(sw.flow_del(fc2, True), "Failed to delete flow")
         ft.delete(fc)
 
@@ -2778,5 +2785,5 @@
             result = False
 
         self.assertTrue(result, "Flow_Del_4 TEST FAILED")
-        fq_logger.debug("Flow_Del_4 TEST PASSED")
+        fq_logger.info("Flow_Del_4 TEST PASSED")
         
