ipsec: Use .api declared error counters

Type: improvement

Signed-off-by: Neale Ranns <neale@graphiant.com>
Change-Id: Ica7de5a493389c6f53b7cf04e06939473a63d2b9
diff --git a/test/template_ipsec.py b/test/template_ipsec.py
index 2295b75..ce18862 100644
--- a/test/template_ipsec.py
+++ b/test/template_ipsec.py
@@ -330,12 +330,12 @@
     """verify methods for Transport v4"""
 
     def get_replay_counts(self, p):
-        replay_node_name = "/err/%s/SA replayed packet" % self.tra4_decrypt_node_name[0]
+        replay_node_name = "/err/%s/replay" % self.tra4_decrypt_node_name[0]
         count = self.statistics.get_err_counter(replay_node_name)
 
         if p.async_mode:
             replay_post_node_name = (
-                "/err/%s/SA replayed packet" % self.tra4_decrypt_node_name[p.async_mode]
+                "/err/%s/replay" % self.tra4_decrypt_node_name[p.async_mode]
             )
             count += self.statistics.get_err_counter(replay_post_node_name)
 
@@ -344,13 +344,11 @@
     def get_hash_failed_counts(self, p):
         if ESP == self.encryption_type and p.crypt_algo == "AES-GCM":
             hash_failed_node_name = (
-                "/err/%s/ESP decryption failed"
-                % self.tra4_decrypt_node_name[p.async_mode]
+                "/err/%s/decryption_failed" % self.tra4_decrypt_node_name[p.async_mode]
             )
         else:
             hash_failed_node_name = (
-                "/err/%s/Integrity check failed"
-                % self.tra4_decrypt_node_name[p.async_mode]
+                "/err/%s/integ_error" % self.tra4_decrypt_node_name[p.async_mode]
             )
         count = self.statistics.get_err_counter(hash_failed_node_name)
 
@@ -365,10 +363,7 @@
         esn_on = p.vpp_tra_sa.esn_en
         ar_on = p.flags & saf.IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY
 
-        seq_cycle_node_name = (
-            "/err/%s/sequence number cycled (packet dropped)"
-            % self.tra4_encrypt_node_name
-        )
+        seq_cycle_node_name = "/err/%s/seq_cycled" % self.tra4_encrypt_node_name
         replay_count = self.get_replay_counts(p)
         hash_failed_count = self.get_hash_failed_counts(p)
         seq_cycle_count = self.statistics.get_err_counter(seq_cycle_node_name)
@@ -605,18 +600,13 @@
         p = self.params[socket.AF_INET]
         esn_en = p.vpp_tra_sa.esn_en
 
-        seq_cycle_node_name = (
-            "/err/%s/sequence number cycled (packet dropped)"
-            % self.tra4_encrypt_node_name
-        )
+        seq_cycle_node_name = "/err/%s/seq_cycled" % self.tra4_encrypt_node_name
         replay_count = self.get_replay_counts(p)
         hash_failed_count = self.get_hash_failed_counts(p)
         seq_cycle_count = self.statistics.get_err_counter(seq_cycle_node_name)
 
         if ESP == self.encryption_type:
-            undersize_node_name = (
-                "/err/%s/undersized packet" % self.tra4_decrypt_node_name[0]
-            )
+            undersize_node_name = "/err/%s/runt" % self.tra4_decrypt_node_name[0]
             undersize_count = self.statistics.get_err_counter(undersize_node_name)
 
         #
@@ -1459,7 +1449,7 @@
         )
         self.send_and_assert_no_replies(self.tun_if, pkt * 31)
         self.assert_error_counter_equal(
-            "/err/%s/NAT Keepalive" % self.tun4_input_node, 31
+            "/err/%s/nat_keepalive" % self.tun4_input_node, 31
         )
 
         pkt = (
@@ -1469,7 +1459,7 @@
             / Raw(b"\xfe")
         )
         self.send_and_assert_no_replies(self.tun_if, pkt * 31)
-        self.assert_error_counter_equal("/err/%s/Too Short" % self.tun4_input_node, 31)
+        self.assert_error_counter_equal("/err/%s/too_short" % self.tun4_input_node, 31)
 
         pkt = (
             Ether(src=self.tun_if.remote_mac, dst=self.tun_if.local_mac)
@@ -1479,7 +1469,7 @@
             / Padding(0 * 21)
         )
         self.send_and_assert_no_replies(self.tun_if, pkt * 31)
-        self.assert_error_counter_equal("/err/%s/Too Short" % self.tun4_input_node, 62)
+        self.assert_error_counter_equal("/err/%s/too_short" % self.tun4_input_node, 62)
 
 
 class IpsecTun4Tests(IpsecTun4):
diff --git a/test/test_ipsec_tun_if_esp.py b/test/test_ipsec_tun_if_esp.py
index 9da75f0..d10ad21 100644
--- a/test/test_ipsec_tun_if_esp.py
+++ b/test/test_ipsec_tun_if_esp.py
@@ -1842,7 +1842,7 @@
             dst=self.pg1.remote_ip6,
         )
         self.send_and_assert_no_replies(self.tun_if, tx)
-        node_name = "/err/%s/unsupported payload" % self.tun4_decrypt_node_name[0]
+        node_name = "/err/%s/unsup_payload" % self.tun4_decrypt_node_name[0]
         self.assertEqual(1, self.statistics.get_err_counter(node_name))
 
 
@@ -2577,9 +2577,7 @@
         # bounce the interface state
         p.tun_if.admin_down()
         self.verify_drop_tun_66(np, count=127)
-        node = (
-            "/err/ipsec6-tun-input/%s" % "ipsec packets received on disabled interface"
-        )
+        node = "/err/ipsec6-tun-input/disabled"
         self.assertEqual(127, self.statistics.get_err_counter(node))
         p.tun_if.admin_up()
         self.verify_tun_66(np, count=127)