refactor verify_flowstats and move to testutils

This needs to be centralized for later byte counter fuzzing changes.
diff --git a/tests/FuncUtils.py b/tests/FuncUtils.py
index 87df355..aa35221 100644
--- a/tests/FuncUtils.py
+++ b/tests/FuncUtils.py
@@ -512,44 +512,6 @@
         self.assertEqual(expect_active, active ,"active counter is not incremented properly")
 
 
-def verify_flowstats(self,match,byte_count=None,packet_count=None):
-    # Verify flow counters : byte_count and packet_count
-
-    stat_req = message.flow_stats_request()
-    stat_req.match = match
-    stat_req.table_id = 0xff
-    stat_req.out_port = ofp.OFPP_NONE
-    
-    for i in range(0,100):
-        logging.info("Sending stats request")
-        # TODO: move REPLY_MORE handling to controller.transact?
-        response, pkt = self.controller.transact(stat_req,
-                                                     timeout=5)
-        self.assertTrue(response is not None,"No response to stats request")
-
-        packet_counter = 0
-        byte_counter = 0 
-
-        for item in response.stats:
-            packet_counter += item.packet_count
-            byte_counter += item.byte_count
-
-        logging.info("Received %d packets", packet_counter)
-        logging.info("Received %d bytes", byte_counter)
-
-        if (packet_count == None or packet_counter >= packet_count) and \
-           (byte_count == None or byte_counter >= byte_count):
-            break
-
-        sleep(0.1)
-    
-    if packet_count != None :
-        self.assertEqual(packet_count, packet_counter, "packet_count counter is not incremented correctly")
-
-    if byte_count != None :   
-        self.assertEqual(byte_count, byte_counter, "byte_count counter is not incremented correctly")
-
-
 def verify_portstats(self, port,tx_packets=None,rx_packets=None,rx_byte=None,tx_byte=None):
 
     
diff --git a/tests/counters.py b/tests/counters.py
index 4caae4f..d23cf75 100644
--- a/tests/counters.py
+++ b/tests/counters.py
@@ -60,9 +60,9 @@
         num_pkts = 5 
         for pkt_cnt in range(num_pkts):
             self.dataplane.send(of_ports[0],str(pkt))
-         
-        #Verify Recieved Packets/Bytes Per Flow  
-        verify_flowstats(self,match,packet_count=num_pkts)
+
+        # Verify the packet counter was updated
+        verify_flow_stats(self, match, pkts=num_pkts)
 
 
 class BytPerFlow(base_tests.SimpleDataPlane):
@@ -93,9 +93,9 @@
         byte_count = num_pkts*len(str(pkt))
         for pkt_cnt in range(num_pkts):
             self.dataplane.send(of_ports[0],str(pkt))
-         
-        #Verify Recieved Packets/Bytes Per Flow  
-        verify_flowstats(self,match,byte_count=byte_count)
+
+        # Verify the byte counter was updated
+        verify_flow_stats(self, match, bytes=byte_count)
 
 
 class DurationPerFlow(base_tests.SimpleDataPlane):
diff --git a/tests/detailed_contr_sw_messages.py b/tests/detailed_contr_sw_messages.py
index 601cc72..4ca6a6b 100644
--- a/tests/detailed_contr_sw_messages.py
+++ b/tests/detailed_contr_sw_messages.py
@@ -140,7 +140,7 @@
         send_packet(self,pkt,of_ports[0],of_ports[1])
 
         # Verify Flow counters have incremented
-        verify_flowstats(self,match,byte_count=len(str(pkt)),packet_count=1)
+        verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt)))
         
         #Send Identical flow 
         (pkt1,match1) = wildcard_all(self,of_ports)
@@ -149,7 +149,7 @@
         verify_tablestats(self,expect_active=1)
 
         # Verify Flow counters reset
-        verify_flowstats(self,match,byte_count=0,packet_count=0)
+        verify_flow_stats(self, match, pkts=0, bytes=0)
 
    
 class EmerFlowTimeout(base_tests.SimpleProtocol): 
@@ -265,7 +265,7 @@
         send_packet(self,pkt,of_ports[0],of_ports[1])
 
         #Verify flow counters
-        verify_flowstats(self,match,byte_count=len(str(pkt)),packet_count=1)
+        verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt)))
 
         #Modify flow- 1 
         modify_flow_action(self,of_ports,match)
@@ -274,7 +274,7 @@
         send_packet(self,pkt,of_ports[0],of_ports[2])
         
         #Verify flow counters are preserved
-        verify_flowstats(self,match,byte_count=(2*len(str(pkt))),packet_count=2)
+        verify_flow_stats(self, match, pkts=2, bytes=len(str(pkt))*2)
 
 
 class StrictModifyAction(base_tests.SimpleDataPlane):
@@ -308,7 +308,7 @@
         send_packet(self,pkt,of_ports[0],of_ports[1])
 
         # Verify flow counters of the flow-1
-        verify_flowstats(self,match,byte_count=len(str(pkt)),packet_count=1)
+        verify_flow_stats(self, match, pkts=1, bytes=len(str(pkt)))
 
         # Strict-Modify flow- 1 
         strict_modify_flow_action(self,of_ports[2],match,priority=100)
@@ -317,7 +317,7 @@
         send_packet(self,pkt,of_ports[0],of_ports[2])
         
         # Verify flow counters are preserved
-        verify_flowstats(self,match,byte_count=(2*len(str(pkt))),packet_count=2)
+        verify_flow_stats(self, match, pkts=2, bytes=2*len(str(pkt)))
 
 
 class DeleteNonexistingFlow(base_tests.SimpleDataPlane):