summaryrefslogtreecommitdiffstats
path: root/test/test_ipsec_esp.py
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-02-25 10:05:32 +0000
committerMatthew Smith <mgsmith@netgate.com>2021-02-25 16:12:48 +0000
commit8c609af230c157304c3ddb09bfcd6d8098c6ea92 (patch)
tree42ba1aab56a4ea16ff67bcdcd0f15f6c300a5671 /test/test_ipsec_esp.py
parent2d49830c7dabd3104770957724d61f8fa6998235 (diff)
tests: Add tests for IPSec async mode using the crypto SW scheduler
Type: test Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: Iabc8f2b09ee10a82aacebd36acfe8648cf69b7d7
Diffstat (limited to 'test/test_ipsec_esp.py')
-rw-r--r--test/test_ipsec_esp.py159
1 files changed, 111 insertions, 48 deletions
diff --git a/test/test_ipsec_esp.py b/test/test_ipsec_esp.py
index 11d44049aeb..209298a30a4 100644
--- a/test/test_ipsec_esp.py
+++ b/test/test_ipsec_esp.py
@@ -27,13 +27,13 @@ engines_supporting_chain_bufs = ["openssl"]
class ConfigIpsecESP(TemplateIpsec):
encryption_type = ESP
tra4_encrypt_node_name = "esp4-encrypt"
- tra4_decrypt_node_name = "esp4-decrypt"
+ tra4_decrypt_node_name = ["esp4-decrypt", "esp4-decrypt-post"]
tra6_encrypt_node_name = "esp6-encrypt"
- tra6_decrypt_node_name = "esp6-decrypt"
+ tra6_decrypt_node_name = ["esp6-decrypt", "esp6-decrypt-post"]
tun4_encrypt_node_name = "esp4-encrypt"
- tun4_decrypt_node_name = "esp4-decrypt"
+ tun4_decrypt_node_name = ["esp4-decrypt", "esp4-decrypt-post"]
tun6_encrypt_node_name = "esp6-encrypt"
- tun6_decrypt_node_name = "esp6-decrypt"
+ tun6_decrypt_node_name = ["esp6-decrypt", "esp6-decrypt-post"]
@classmethod
def setUpClass(cls):
@@ -645,6 +645,14 @@ class RunTestIpsecEspAll(ConfigIpsecESP,
IpsecTun4, IpsecTun6):
""" Ipsec ESP all Algos """
+ @classmethod
+ def setUpConstants(cls):
+ test_args = str.split(cls.__doc__, " ")
+ engine = test_args[0]
+ if engine == "async":
+ cls.worker_config = "workers 2"
+ super(RunTestIpsecEspAll, cls).setUpConstants()
+
def setUp(self):
super(RunTestIpsecEspAll, self).setUp()
test_args = str.split(self.__doc__, " ")
@@ -656,6 +664,9 @@ class RunTestIpsecEspAll(ConfigIpsecESP,
self.flag = params.flags[1]
self.algo = params.algos[test_args[2]]
+ self.async_mode = False
+ if self.engine == "async":
+ self.async_mode = True
def tearDown(self):
super(RunTestIpsecEspAll, self).tearDown()
@@ -664,10 +675,12 @@ class RunTestIpsecEspAll(ConfigIpsecESP,
self.run_a_test(self.engine, self.flag, self.algo)
def run_a_test(self, engine, flag, algo, payload_size=None):
- if engine == "ia32":
- engine = "native"
- self.vapi.cli("set crypto handler all %s" % engine)
+ if self.async_mode:
+ self.vapi.cli("set ipsec async mode on")
+ else:
+ self.vapi.cli("set crypto handler all %s" % engine)
+ self.logger.info(self.vapi.cli("show crypto async status"))
self.ipv4_params = IPsecIPv4Params()
self.ipv6_params = IPsecIPv6Params()
@@ -685,6 +698,7 @@ class RunTestIpsecEspAll(ConfigIpsecESP,
p.salt = algo['salt']
p.flags = p.flags | flag
p.outer_flow_label = 243224
+ p.async_mode = self.async_mode
self.reporter.send_keep_alive(self)
@@ -747,7 +761,7 @@ class RunTestIpsecEspAll(ConfigIpsecESP,
# To generate test classes, do:
# grep '# GEN' test_ipsec_esp.py | sed -e 's/# GEN //g' | bash
#
-# GEN for ENG in ia32 ipsecmb openssl; do \
+# GEN for ENG in native ipsecmb openssl; do \
# GEN for FLG in noESN ESN; do for ALG in AES-GCM-128/NONE \
# GEN AES-GCM-192/NONE AES-GCM-256/NONE AES-CBC-128/MD5-96 \
# GEN AES-CBC-192/SHA1-96 AES-CBC-256/SHA1-96 \
@@ -760,118 +774,129 @@ class RunTestIpsecEspAll(ConfigIpsecESP,
# GEN echo " def test_ipsec(self):";
# GEN echo " self.run_test()";
# GEN done; done; done
+#
+# GEN for FLG in noESN ESN; do for ALG in \
+# GEN AES-GCM-128/NONE AES-GCM-192/NONE AES-GCM-256/NONE \
+# GEN AES-CBC-192/SHA1-96 AES-CBC-256/SHA1-96; do \
+# GEN [[ ${FLG} == "ESN" && ${ALG} == *"NONE" ]] && continue
+# GEN echo -e "\n\nclass Test_async_${FLG}_${ALG}(RunTestIpsecEspAll):" |
+# GEN sed -e 's/-/_/g' -e 's#/#_#g' ; \
+# GEN echo ' """'async $FLG $ALG IPSec test'"""' ;
+# GEN echo " def test_ipsec(self):";
+# GEN echo " self.run_test()";
+# GEN done; done;
-class Test_ia32_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
- """ia32 noESN AES-GCM-128/NONE IPSec test"""
+class Test_native_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
+ """native noESN AES-GCM-128/NONE IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
- """ia32 noESN AES-GCM-192/NONE IPSec test"""
+class Test_native_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
+ """native noESN AES-GCM-192/NONE IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
- """ia32 noESN AES-GCM-256/NONE IPSec test"""
+class Test_native_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
+ """native noESN AES-GCM-256/NONE IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
- """ia32 noESN AES-CBC-128/MD5-96 IPSec test"""
+class Test_native_noESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
+ """native noESN AES-CBC-128/MD5-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
- """ia32 noESN AES-CBC-192/SHA1-96 IPSec test"""
+class Test_native_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
+ """native noESN AES-CBC-192/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
- """ia32 noESN AES-CBC-256/SHA1-96 IPSec test"""
+class Test_native_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
+ """native noESN AES-CBC-256/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
- """ia32 noESN 3DES-CBC/SHA1-96 IPSec test"""
+class Test_native_noESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
+ """native noESN 3DES-CBC/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
- """ia32 noESN NONE/SHA1-96 IPSec test"""
+class Test_native_noESN_NONE_SHA1_96(RunTestIpsecEspAll):
+ """native noESN NONE/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
- """ia32 noESN AES-CTR-128/SHA1-96 IPSec test"""
+class Test_native_noESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
+ """native noESN AES-CTR-128/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
- """ia32 noESN AES-CTR-192/SHA1-96 IPSec test"""
+class Test_native_noESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
+ """native noESN AES-CTR-192/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
- """ia32 noESN AES-CTR-256/SHA1-96 IPSec test"""
+class Test_native_noESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
+ """native noESN AES-CTR-256/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
- """ia32 ESN AES-CBC-128/MD5-96 IPSec test"""
+class Test_native_ESN_AES_CBC_128_MD5_96(RunTestIpsecEspAll):
+ """native ESN AES-CBC-128/MD5-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
- """ia32 ESN AES-CBC-192/SHA1-96 IPSec test"""
+class Test_native_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
+ """native ESN AES-CBC-192/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
- """ia32 ESN AES-CBC-256/SHA1-96 IPSec test"""
+class Test_native_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
+ """native ESN AES-CBC-256/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
- """ia32 ESN 3DES-CBC/SHA1-96 IPSec test"""
+class Test_native_ESN_3DES_CBC_SHA1_96(RunTestIpsecEspAll):
+ """native ESN 3DES-CBC/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
- """ia32 ESN NONE/SHA1-96 IPSec test"""
+class Test_native_ESN_NONE_SHA1_96(RunTestIpsecEspAll):
+ """native ESN NONE/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
- """ia32 ESN AES-CTR-128/SHA1-96 IPSec test"""
+class Test_native_ESN_AES_CTR_128_SHA1_96(RunTestIpsecEspAll):
+ """native ESN AES-CTR-128/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
- """ia32 ESN AES-CTR-192/SHA1-96 IPSec test"""
+class Test_native_ESN_AES_CTR_192_SHA1_96(RunTestIpsecEspAll):
+ """native ESN AES-CTR-192/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
-class Test_ia32_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
- """ia32 ESN AES-CTR-256/SHA1-96 IPSec test"""
+class Test_native_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
+ """native ESN AES-CTR-256/SHA1-96 IPSec test"""
def test_ipsec(self):
self.run_test()
@@ -1104,5 +1129,43 @@ class Test_openssl_ESN_AES_CTR_256_SHA1_96(RunTestIpsecEspAll):
self.run_test()
-if __name__ == '__main__':
- unittest.main(testRunner=VppTestRunner)
+class Test_async_noESN_AES_GCM_128_NONE(RunTestIpsecEspAll):
+ """async noESN AES-GCM-128/NONE IPSec test"""
+ def test_ipsec(self):
+ self.run_test()
+
+
+class Test_async_noESN_AES_GCM_192_NONE(RunTestIpsecEspAll):
+ """async noESN AES-GCM-192/NONE IPSec test"""
+ def test_ipsec(self):
+ self.run_test()
+
+
+class Test_async_noESN_AES_GCM_256_NONE(RunTestIpsecEspAll):
+ """async noESN AES-GCM-256/NONE IPSec test"""
+ def test_ipsec(self):
+ self.run_test()
+
+
+class Test_async_noESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
+ """async noESN AES-CBC-192/SHA1-96 IPSec test"""
+ def test_ipsec(self):
+ self.run_test()
+
+
+class Test_async_noESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
+ """async noESN AES-CBC-256/SHA1-96 IPSec test"""
+ def test_ipsec(self):
+ self.run_test()
+
+
+class Test_async_ESN_AES_CBC_192_SHA1_96(RunTestIpsecEspAll):
+ """async ESN AES-CBC-192/SHA1-96 IPSec test"""
+ def test_ipsec(self):
+ self.run_test()
+
+
+class Test_async_ESN_AES_CBC_256_SHA1_96(RunTestIpsecEspAll):
+ """async ESN AES-CBC-256/SHA1-96 IPSec test"""
+ def test_ipsec(self):
+ self.run_test()