aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_ipsec_tun_if_esp.py
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2018-06-24 22:49:55 +0200
committerKlement Sekera <ksekera@cisco.com>2018-06-24 22:53:37 +0200
commit31da2e30317bc1fcb4586e1dc0d560600d9b29d3 (patch)
tree4c025f26e8aa9e4f6499144deea9028154b63fe0 /test/test_ipsec_tun_if_esp.py
parent2a8d02df15e71881754bab0bb16b85ccd65f8f74 (diff)
Revert "Revert "ipsec: VPP-1316 calculate IP/TCP/UDP inner checksums""
This reverts commit e0d2bd6bd7fc59c0c6ac48195d7f825dc99bfd91. Change-Id: If491e16f9ea66b2493a6a7c7f3c684ed585f8f51 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test/test_ipsec_tun_if_esp.py')
-rw-r--r--test/test_ipsec_tun_if_esp.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/test/test_ipsec_tun_if_esp.py b/test/test_ipsec_tun_if_esp.py
new file mode 100644
index 00000000000..c260f03b63d
--- /dev/null
+++ b/test/test_ipsec_tun_if_esp.py
@@ -0,0 +1,52 @@
+import unittest
+import socket
+from scapy.layers.ipsec import ESP
+from framework import VppTestRunner
+from template_ipsec import TemplateIpsec, IpsecTunTests, IpsecTcpTests
+from vpp_ipsec_tun_interface import VppIpsecTunInterface
+
+
+class TemplateIpsecTunIfEsp(TemplateIpsec):
+ """ IPsec tunnel interface tests """
+
+ encryption_type = ESP
+
+ @classmethod
+ def setUpClass(cls):
+ super(TemplateIpsecTunIfEsp, cls).setUpClass()
+ cls.tun_if = cls.pg0
+
+ def setUp(self):
+ self.ipsec_tun_if = VppIpsecTunInterface(self, self.pg0,
+ self.vpp_tun_spi,
+ self.scapy_tun_spi,
+ self.crypt_algo_vpp_id,
+ self.crypt_key,
+ self.crypt_key,
+ self.auth_algo_vpp_id,
+ self.auth_key,
+ self.auth_key)
+ self.ipsec_tun_if.add_vpp_config()
+ self.ipsec_tun_if.admin_up()
+ self.ipsec_tun_if.config_ip4()
+ src4 = socket.inet_pton(socket.AF_INET, self.remote_tun_if_host)
+ self.vapi.ip_add_del_route(src4, 32, self.ipsec_tun_if.remote_ip4n)
+
+ def tearDown(self):
+ if not self.vpp_dead:
+ self.vapi.cli("show hardware")
+ super(TemplateIpsecTunIfEsp, self).tearDown()
+
+
+class TestIpsecTunIfEsp1(TemplateIpsecTunIfEsp, IpsecTunTests):
+ """ Ipsec ESP - TUN tests """
+ pass
+
+
+class TestIpsecTunIfEsp2(TemplateIpsecTunIfEsp, IpsecTcpTests):
+ """ Ipsec ESP - TCP tests """
+ pass
+
+
+if __name__ == '__main__':
+ unittest.main(testRunner=VppTestRunner)