aboutsummaryrefslogtreecommitdiffstats
path: root/test/template_ipsec.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/template_ipsec.py')
-rw-r--r--test/template_ipsec.py54
1 files changed, 30 insertions, 24 deletions
diff --git a/test/template_ipsec.py b/test/template_ipsec.py
index d35cf420d37..ed7c1a32129 100644
--- a/test/template_ipsec.py
+++ b/test/template_ipsec.py
@@ -82,39 +82,46 @@ class TemplateIpsec(VppTestCase):
|tun_if| -------> |VPP| ------> |pg1|
------ --- ---
"""
- ipv4_params = IPsecIPv4Params()
- ipv6_params = IPsecIPv6Params()
- params = {ipv4_params.addr_type: ipv4_params,
- ipv6_params.addr_type: ipv6_params}
- payload = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+ def ipsec_select_backend(self):
+ """ empty method to be overloaded when necessary """
+ pass
- tun_spd_id = 1
- tra_spd_id = 2
+ def setUp(self):
+ super(TemplateIpsec, self).setUp()
- vpp_esp_protocol = 1
- vpp_ah_protocol = 0
+ self.ipv4_params = IPsecIPv4Params()
+ self.ipv6_params = IPsecIPv6Params()
+ self.params = {self.ipv4_params.addr_type: self.ipv4_params,
+ self.ipv6_params.addr_type: self.ipv6_params}
- @classmethod
- def ipsec_select_backend(cls):
- """ empty method to be overloaded when necessary """
- pass
+ self.payload = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"\
+ "XXXXXXXXXXXXXXXXXXXXX"
- @classmethod
- def setUpClass(cls):
- super(TemplateIpsec, cls).setUpClass()
- cls.create_pg_interfaces(range(3))
- cls.interfaces = list(cls.pg_interfaces)
- for i in cls.interfaces:
+ self.tun_spd_id = 1
+ self.tra_spd_id = 2
+
+ self.vpp_esp_protocol = 1
+ self.vpp_ah_protocol = 0
+
+ self.create_pg_interfaces(range(3))
+ self.interfaces = list(self.pg_interfaces)
+ for i in self.interfaces:
i.admin_up()
i.config_ip4()
i.resolve_arp()
i.config_ip6()
i.resolve_ndp()
- cls.ipsec_select_backend()
+ self.ipsec_select_backend()
def tearDown(self):
super(TemplateIpsec, self).tearDown()
+
+ for i in self.interfaces:
+ i.admin_down()
+ i.unconfig_ip4()
+ i.unconfig_ip6()
+
if not self.vpp_dead:
self.vapi.cli("show hardware")
@@ -158,15 +165,14 @@ class TemplateIpsec(VppTestCase):
src=self.tun_if.local_addr[params.addr_type]))
return vpp_tun_sa, scapy_tun_sa
- @classmethod
- def configure_sa_tra(cls, params):
- params.scapy_tra_sa = SecurityAssociation(cls.encryption_type,
+ def configure_sa_tra(self, params):
+ params.scapy_tra_sa = SecurityAssociation(self.encryption_type,
spi=params.vpp_tra_spi,
crypt_algo=params.crypt_algo,
crypt_key=params.crypt_key,
auth_algo=params.auth_algo,
auth_key=params.auth_key)
- params.vpp_tra_sa = SecurityAssociation(cls.encryption_type,
+ params.vpp_tra_sa = SecurityAssociation(self.encryption_type,
spi=params.scapy_tra_spi,
crypt_algo=params.crypt_algo,
crypt_key=params.crypt_key,