aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/framework.py5
-rw-r--r--test/template_ipsec.py12
-rw-r--r--test/test_ipip.py10
-rw-r--r--test/test_nat.py113
-rw-r--r--test/test_punt.py2
-rw-r--r--test/test_stats_client.py6
6 files changed, 84 insertions, 64 deletions
diff --git a/test/framework.py b/test/framework.py
index 201892aea27..85bd6616c8b 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -1027,6 +1027,11 @@ class VppTestCase(unittest.TestCase):
counter_value = int(results[0])
break
+ def assert_error_counter_equal(self, counter, expected_value):
+ counter_value = self.statistics.get_err_counter(counter)
+ self.assert_equal(counter_value, expected_value,
+ "error counter `%s'" % counter)
+
@classmethod
def sleep(cls, timeout, remark=None):
diff --git a/test/template_ipsec.py b/test/template_ipsec.py
index 61ac0b5cd22..84b878440e9 100644
--- a/test/template_ipsec.py
+++ b/test/template_ipsec.py
@@ -293,7 +293,7 @@ class IpsecTra4(object):
# replayed packets are dropped
self.send_and_assert_no_replies(self.tra_if, pkt * 3)
- self.assert_packet_counter_equal(
+ self.assert_error_counter_equal(
'/err/%s/SA replayed packet' % self.tra4_decrypt_node_name, 3)
# the window size is 64 packets
@@ -321,7 +321,7 @@ class IpsecTra4(object):
seq_num=350))
self.send_and_assert_no_replies(self.tra_if, pkt * 17)
- self.assert_packet_counter_equal(
+ self.assert_error_counter_equal(
'/err/%s/Integrity check failed' % self.tra4_decrypt_node_name, 17)
# a malformed 'runt' packet
@@ -337,7 +337,7 @@ class IpsecTra4(object):
seq_num=350))
self.send_and_assert_no_replies(self.tra_if, pkt * 17)
- self.assert_packet_counter_equal(
+ self.assert_error_counter_equal(
'/err/%s/undersized packet' % self.tra4_decrypt_node_name, 17)
# which we can determine since this packet is still in the window
@@ -361,12 +361,12 @@ class IpsecTra4(object):
if use_esn:
# an out of window error with ESN looks like a high sequence
# wrap. but since it isn't then the verify will fail.
- self.assert_packet_counter_equal(
+ self.assert_error_counter_equal(
'/err/%s/Integrity check failed' %
self.tra4_decrypt_node_name, 34)
else:
- self.assert_packet_counter_equal(
+ self.assert_error_counter_equal(
'/err/%s/SA replayed packet' %
self.tra4_decrypt_node_name, 20)
@@ -411,7 +411,7 @@ class IpsecTra4(object):
decrypted = p.vpp_tra_sa.decrypt(rx[0][IP])
else:
self.send_and_assert_no_replies(self.tra_if, [pkt])
- self.assert_packet_counter_equal(
+ self.assert_error_counter_equal(
'/err/%s/sequence number cycled' %
self.tra4_encrypt_node_name, 1)
diff --git a/test/test_ipip.py b/test/test_ipip.py
index e5b9092a431..137e3c54dff 100644
--- a/test/test_ipip.py
+++ b/test/test_ipip.py
@@ -135,7 +135,7 @@ class TestIPIP(VppTestCase):
for p in rx:
self.validate(p[1], p4_reply)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/ipip4-input/packets decapsulated')
self.assertEqual(err, 10)
@@ -149,7 +149,7 @@ class TestIPIP(VppTestCase):
for p in rx:
self.validate(p[1], p6_reply)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/ipip4-input/packets decapsulated')
self.assertEqual(err, 20)
@@ -178,7 +178,7 @@ class TestIPIP(VppTestCase):
for p in rx:
self.validate(p[1], p4_reply)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/ipip4-input/packets decapsulated')
self.assertEqual(err, 1020)
@@ -426,7 +426,7 @@ class TestIPIP6(VppTestCase):
is_ip6=1)
# Send lots of fragments, verify reassembled packet
- before_cnt = self.statistics.get_counter(
+ before_cnt = self.statistics.get_err_counter(
'/err/ipip6-input/packets decapsulated')
frags, p6_reply = self.generate_ip6_frags(3131, 1400)
f = []
@@ -440,7 +440,7 @@ class TestIPIP6(VppTestCase):
for p in rx:
self.validate(p[1], p6_reply)
- cnt = self.statistics.get_counter(
+ cnt = self.statistics.get_err_counter(
'/err/ipip6-input/packets decapsulated')
self.assertEqual(cnt, before_cnt + 1000)
diff --git a/test/test_nat.py b/test/test_nat.py
index 848d7225296..f7364747efd 100644
--- a/test/test_nat.py
+++ b/test/test_nat.py
@@ -1577,13 +1577,13 @@ class TestNAT44(MethodHolder):
is_add=1)
# in2out
- tcpn = self.statistics.get_counter(
+ tcpn = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/TCP packets')
- udpn = self.statistics.get_counter(
+ udpn = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/UDP packets')
- icmpn = self.statistics.get_counter(
+ icmpn = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/ICMP packets')
- totaln = self.statistics.get_counter(
+ totaln = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/good in2out packets processed')
pkts = self.create_stream_in(self.pg0, self.pg1)
@@ -1593,24 +1593,25 @@ class TestNAT44(MethodHolder):
capture = self.pg1.get_capture(len(pkts))
self.verify_capture_out(capture)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/TCP packets')
self.assertEqual(err - tcpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/UDP packets')
self.assertEqual(err - udpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/ICMP packets')
self.assertEqual(err - icmpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-in2out-slowpath/good in2out packets processed')
self.assertEqual(err - totaln, 3)
# out2in
- tcpn = self.statistics.get_counter('/err/nat44-out2in/TCP packets')
- udpn = self.statistics.get_counter('/err/nat44-out2in/UDP packets')
- icmpn = self.statistics.get_counter('/err/nat44-out2in/ICMP packets')
- totaln = self.statistics.get_counter(
+ tcpn = self.statistics.get_err_counter('/err/nat44-out2in/TCP packets')
+ udpn = self.statistics.get_err_counter('/err/nat44-out2in/UDP packets')
+ icmpn = self.statistics.get_err_counter(
+ '/err/nat44-out2in/ICMP packets')
+ totaln = self.statistics.get_err_counter(
'/err/nat44-out2in/good out2in packets processed')
pkts = self.create_stream_out(self.pg1)
@@ -1620,13 +1621,13 @@ class TestNAT44(MethodHolder):
capture = self.pg0.get_capture(len(pkts))
self.verify_capture_in(capture, self.pg0)
- err = self.statistics.get_counter('/err/nat44-out2in/TCP packets')
+ err = self.statistics.get_err_counter('/err/nat44-out2in/TCP packets')
self.assertEqual(err - tcpn, 1)
- err = self.statistics.get_counter('/err/nat44-out2in/UDP packets')
+ err = self.statistics.get_err_counter('/err/nat44-out2in/UDP packets')
self.assertEqual(err - udpn, 1)
- err = self.statistics.get_counter('/err/nat44-out2in/ICMP packets')
+ err = self.statistics.get_err_counter('/err/nat44-out2in/ICMP packets')
self.assertEqual(err - icmpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-out2in/good out2in packets processed')
self.assertEqual(err - totaln, 3)
@@ -3655,9 +3656,11 @@ class TestNAT44(MethodHolder):
self.logger.error(ppp("Unexpected or invalid packet:", p))
raise
- err = self.statistics.get_counter('/err/nat44-classify/next in2out')
+ err = self.statistics.get_err_counter(
+ '/err/nat44-classify/next in2out')
self.assertEqual(err, 1)
- err = self.statistics.get_counter('/err/nat44-classify/next out2in')
+ err = self.statistics.get_err_counter(
+ '/err/nat44-classify/next out2in')
self.assertEqual(err, 1)
def test_del_session(self):
@@ -4349,7 +4352,7 @@ class TestNAT44(MethodHolder):
stats = self.statistics.get_counter('/nat44/ha/del-event-recv')
self.assertEqual(stats[0][0], 1)
- stats = self.statistics.get_counter('/err/nat-ha/pkts-processed')
+ stats = self.statistics.get_err_counter('/err/nat-ha/pkts-processed')
self.assertEqual(stats, 2)
# send HA session refresh event to failover/passive
@@ -4393,7 +4396,7 @@ class TestNAT44(MethodHolder):
stats = self.statistics.get_counter('/nat44/ha/refresh-event-recv')
self.assertEqual(stats[0][0], 1)
- stats = self.statistics.get_counter('/err/nat-ha/pkts-processed')
+ stats = self.statistics.get_err_counter('/err/nat-ha/pkts-processed')
self.assertEqual(stats, 3)
# send packet to test session created by HA
@@ -4734,13 +4737,13 @@ class TestNAT44EndpointDependent(MethodHolder):
self.assertEqual(1, nat_config.endpoint_dependent)
# in2out
- tcpn = self.statistics.get_counter(
+ tcpn = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/TCP packets')
- udpn = self.statistics.get_counter(
+ udpn = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/UDP packets')
- icmpn = self.statistics.get_counter(
+ icmpn = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/ICMP packets')
- totaln = self.statistics.get_counter(
+ totaln = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/good in2out packets processed')
pkts = self.create_stream_in(self.pg0, self.pg1)
@@ -4750,25 +4753,27 @@ class TestNAT44EndpointDependent(MethodHolder):
capture = self.pg1.get_capture(len(pkts))
self.verify_capture_out(capture)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/TCP packets')
self.assertEqual(err - tcpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/UDP packets')
self.assertEqual(err - udpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/ICMP packets')
self.assertEqual(err - icmpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-ed-in2out-slowpath/good in2out packets processed')
self.assertEqual(err - totaln, 3)
# out2in
- tcpn = self.statistics.get_counter('/err/nat44-ed-out2in/TCP packets')
- udpn = self.statistics.get_counter('/err/nat44-ed-out2in/UDP packets')
- icmpn = self.statistics.get_counter(
+ tcpn = self.statistics.get_err_counter(
+ '/err/nat44-ed-out2in/TCP packets')
+ udpn = self.statistics.get_err_counter(
+ '/err/nat44-ed-out2in/UDP packets')
+ icmpn = self.statistics.get_err_counter(
'/err/nat44-ed-out2in-slowpath/ICMP packets')
- totaln = self.statistics.get_counter(
+ totaln = self.statistics.get_err_counter(
'/err/nat44-ed-out2in/good out2in packets processed')
pkts = self.create_stream_out(self.pg1)
@@ -4778,14 +4783,16 @@ class TestNAT44EndpointDependent(MethodHolder):
capture = self.pg0.get_capture(len(pkts))
self.verify_capture_in(capture, self.pg0)
- err = self.statistics.get_counter('/err/nat44-ed-out2in/TCP packets')
+ err = self.statistics.get_err_counter(
+ '/err/nat44-ed-out2in/TCP packets')
self.assertEqual(err - tcpn, 1)
- err = self.statistics.get_counter('/err/nat44-ed-out2in/UDP packets')
+ err = self.statistics.get_err_counter(
+ '/err/nat44-ed-out2in/UDP packets')
self.assertEqual(err - udpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-ed-out2in-slowpath/ICMP packets')
self.assertEqual(err - icmpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat44-ed-out2in/good out2in packets processed')
self.assertEqual(err - totaln, 2)
@@ -7904,10 +7911,11 @@ class TestNAT64(MethodHolder):
sw_if_index=self.pg1.sw_if_index)
# in2out
- tcpn = self.statistics.get_counter('/err/nat64-in2out/TCP packets')
- udpn = self.statistics.get_counter('/err/nat64-in2out/UDP packets')
- icmpn = self.statistics.get_counter('/err/nat64-in2out/ICMP packets')
- totaln = self.statistics.get_counter(
+ tcpn = self.statistics.get_err_counter('/err/nat64-in2out/TCP packets')
+ udpn = self.statistics.get_err_counter('/err/nat64-in2out/UDP packets')
+ icmpn = self.statistics.get_err_counter(
+ '/err/nat64-in2out/ICMP packets')
+ totaln = self.statistics.get_err_counter(
'/err/nat64-in2out/good in2out packets processed')
pkts = self.create_stream_in_ip6(self.pg0, self.pg1)
@@ -7918,21 +7926,22 @@ class TestNAT64(MethodHolder):
self.verify_capture_out(capture, nat_ip=self.nat_addr,
dst_ip=self.pg1.remote_ip4)
- err = self.statistics.get_counter('/err/nat64-in2out/TCP packets')
+ err = self.statistics.get_err_counter('/err/nat64-in2out/TCP packets')
self.assertEqual(err - tcpn, 1)
- err = self.statistics.get_counter('/err/nat64-in2out/UDP packets')
+ err = self.statistics.get_err_counter('/err/nat64-in2out/UDP packets')
self.assertEqual(err - udpn, 1)
- err = self.statistics.get_counter('/err/nat64-in2out/ICMP packets')
+ err = self.statistics.get_err_counter('/err/nat64-in2out/ICMP packets')
self.assertEqual(err - icmpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat64-in2out/good in2out packets processed')
self.assertEqual(err - totaln, 3)
# out2in
- tcpn = self.statistics.get_counter('/err/nat64-out2in/TCP packets')
- udpn = self.statistics.get_counter('/err/nat64-out2in/UDP packets')
- icmpn = self.statistics.get_counter('/err/nat64-out2in/ICMP packets')
- totaln = self.statistics.get_counter(
+ tcpn = self.statistics.get_err_counter('/err/nat64-out2in/TCP packets')
+ udpn = self.statistics.get_err_counter('/err/nat64-out2in/UDP packets')
+ icmpn = self.statistics.get_err_counter(
+ '/err/nat64-out2in/ICMP packets')
+ totaln = self.statistics.get_err_counter(
'/err/nat64-out2in/good out2in packets processed')
pkts = self.create_stream_out(self.pg1, dst_ip=self.nat_addr)
@@ -7943,13 +7952,13 @@ class TestNAT64(MethodHolder):
ip = IPv6(src=''.join(['64:ff9b::', self.pg1.remote_ip4]))
self.verify_capture_in_ip6(capture, ip[IPv6].src, self.pg0.remote_ip6)
- err = self.statistics.get_counter('/err/nat64-out2in/TCP packets')
+ err = self.statistics.get_err_counter('/err/nat64-out2in/TCP packets')
self.assertEqual(err - tcpn, 1)
- err = self.statistics.get_counter('/err/nat64-out2in/UDP packets')
+ err = self.statistics.get_err_counter('/err/nat64-out2in/UDP packets')
self.assertEqual(err - udpn, 1)
- err = self.statistics.get_counter('/err/nat64-out2in/ICMP packets')
+ err = self.statistics.get_err_counter('/err/nat64-out2in/ICMP packets')
self.assertEqual(err - icmpn, 1)
- err = self.statistics.get_counter(
+ err = self.statistics.get_err_counter(
'/err/nat64-out2in/good out2in packets processed')
self.assertEqual(err - totaln, 3)
diff --git a/test/test_punt.py b/test/test_punt.py
index f68a38f7515..77847fe21f6 100644
--- a/test/test_punt.py
+++ b/test/test_punt.py
@@ -757,7 +757,7 @@ class TestPunt(VppTestCase):
# 2 - per-reason counters
# 2, 3 are the index of the assigned punt reason
#
- stats = self.statistics.get_counter(
+ stats = self.statistics.get_err_counter(
"/err/punt-dispatch/No registrations")
self.assertEqual(stats, 2*NUM_PKTS)
diff --git a/test/test_stats_client.py b/test/test_stats_client.py
index 87c9efd4f1c..a0504fc45ab 100644
--- a/test/test_stats_client.py
+++ b/test/test_stats_client.py
@@ -19,6 +19,12 @@ class StatsClientTestCase(VppTestCase):
def tearDownClass(cls):
super(StatsClientTestCase, cls).tearDownClass()
+ def test_set_errors(self):
+ """Test set errors"""
+ self.assertEqual(self.statistics.set_errors(), {})
+ self.assertEqual(self.statistics.get_counter('/err/ethernet-input/no'),
+ [0])
+
def test_client_fd_leak(self):
"""Test file descriptor count - VPP-1486"""