make test: fix packet counter assert

Change-Id: Ic6e6ac0629bbf07f7dad1803a85aabfdccbc2035
Signed-off-by: Klement Sekera <ksekera@cisco.com>
diff --git a/test/framework.py b/test/framework.py
index 85bd661..efb1e6b 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -144,12 +144,14 @@
 def _is_skip_aarch64_set():
     return os.getenv('SKIP_AARCH64', 'n').lower() in ('yes', 'y', '1')
 
+
 is_skip_aarch64_set = _is_skip_aarch64_set()
 
 
 def _is_platform_aarch64():
     return platform.machine() == 'aarch64'
 
+
 is_platform_aarch64 = _is_platform_aarch64()
 
 
@@ -157,6 +159,7 @@
     s = os.getenv("EXTENDED_TESTS", "n")
     return True if s.lower() in ("y", "yes", "1") else False
 
+
 running_extended_tests = _running_extended_tests()
 
 
@@ -164,6 +167,7 @@
     os_id = os.getenv("OS_ID", "")
     return True if "centos" in os_id.lower() else False
 
+
 running_on_centos = _running_on_centos
 
 
@@ -926,8 +930,8 @@
                 for cf in checksum_fields:
                     if hasattr(layer, cf):
                         if ignore_zero_udp_checksums and \
-                                        0 == getattr(layer, cf) and \
-                                        layer.name in udp_layers:
+                                0 == getattr(layer, cf) and \
+                                layer.name in udp_layers:
                             continue
                         delattr(layer, cf)
                         checksums.append((counter, cf))
@@ -1005,7 +1009,7 @@
             counter_value = self.statistics.get_counter(counter)
         else:
             counters = self.vapi.cli("sh errors").split('\n')
-            counter_value = -1
+            counter_value = 0
             for i in range(1, len(counters) - 1):
                 results = counters[i].split()
                 if results[1] == counter:
@@ -1014,18 +1018,9 @@
         return counter_value
 
     def assert_packet_counter_equal(self, counter, expected_value):
-        if counter.startswith("/"):
-            counter_value = self.statistics.get_counter(counter)
-            self.assert_equal(counter_value, expected_value,
-                              "packet counter `%s'" % counter)
-        else:
-            counters = self.vapi.cli("sh errors").split('\n')
-            counter_value = -1
-            for i in range(1, len(counters) - 1):
-                results = counters[i].split()
-                if results[1] == counter:
-                    counter_value = int(results[0])
-                    break
+        counter_value = self.get_packet_counter(counter)
+        self.assert_equal(counter_value, expected_value,
+                          "packet counter `%s'" % counter)
 
     def assert_error_counter_equal(self, counter, expected_value):
         counter_value = self.statistics.get_err_counter(counter)
@@ -1455,5 +1450,6 @@
         self.logger.info(single_line_delim)
         self.result = self.process.returncode
 
+
 if __name__ == '__main__':
     pass