summaryrefslogtreecommitdiffstats
path: root/test/template_ipsec.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-01-23 08:16:17 -0800
committerDamjan Marion <dmarion@me.com>2019-01-24 19:51:37 +0000
commit8e4a89bf42196308601de7544abe554df7b0df45 (patch)
tree622d478674fa634efae76a926f7f87bbaeb6bd35 /test/template_ipsec.py
parente18b45caeb22b5dfe38b86be6beea55efaecf40d (diff)
IPSEC Tests: to per-test setup and tearDown
don't do the setup and teardown in class methods so that with each test the config is added and deleted. that way we test that delete actually removes state. more helpful error codes from VPP for existing IPSEC state. Change-Id: I5de1578f73b935b420d4cdd85aa98d5fdcc682f6 Signed-off-by: Neale Ranns <nranns@cisco.com>
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,