summaryrefslogtreecommitdiffstats
path: root/test/vpp_ipsec.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-12-23 04:10:25 +0000
committerNeale Ranns <nranns@cisco.com>2019-12-23 21:39:23 +0000
commit4a56f4e48f39f9e0560833115f85270c0c04b57f (patch)
treeda9d30b72cf953008bd3e15140219ba1240b5ba4 /test/vpp_ipsec.py
parent1de7167e7a12a80cc5996959aeb1fbe4b2853ccb (diff)
ipsec: Test and fix IPSec worker hand-off
Type: fix Change-Id: I5cb9a3845ddbc5f4de4eb4e9c481f606fe5cec9a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/vpp_ipsec.py')
-rw-r--r--test/vpp_ipsec.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/test/vpp_ipsec.py b/test/vpp_ipsec.py
index 0df8cb2a88a..8144ea27c8f 100644
--- a/test/vpp_ipsec.py
+++ b/test/vpp_ipsec.py
@@ -8,6 +8,10 @@ except NameError:
text_type = str
+def mk_counter():
+ return {'packets': 0, 'bytes': 0}
+
+
class VppIpsecSpd(VppObject):
"""
VPP SPD DB
@@ -163,9 +167,16 @@ class VppIpsecSpdEntry(VppObject):
return True
return False
- def get_stats(self):
+ def get_stats(self, worker=None):
c = self.test.statistics.get_counter("/net/ipsec/policy")
- return c[0][self.stat_index]
+ if worker is None:
+ total = mk_counter()
+ for t in c:
+ total['packets'] += t[self.stat_index]['packets']
+ return total
+ else:
+ # +1 to skip main thread
+ return c[worker+1][self.stat_index]
class VppIpsecSA(VppObject):
@@ -244,9 +255,16 @@ class VppIpsecSA(VppObject):
return True
return False
- def get_stats(self):
+ def get_stats(self, worker=None):
c = self.test.statistics.get_counter("/net/ipsec/sa")
- return c[0][self.stat_index]
+ if worker is None:
+ total = mk_counter()
+ for t in c:
+ total['packets'] += t[self.stat_index]['packets']
+ return total
+ else:
+ # +1 to skip main thread
+ return c[worker+1][self.stat_index]
class VppIpsecTunProtect(VppObject):