From b23edf1a86f82e7b9e45b70c55f0119143f97dd5 Mon Sep 17 00:00:00 2001 From: Patrik Hrnciar Date: Wed, 12 Oct 2016 14:01:16 +0200 Subject: CSIT-385 CSIT-386 IPv4/IPv6 IPsec tests - encryption/integrity key update tests Change-Id: Iddbe35e2f421b5048e60663bff2b0bf1968a9782 Signed-off-by: Patrik Hrnciar Signed-off-by: Matej Klotton --- resources/libraries/python/IPsecUtil.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'resources/libraries/python/IPsecUtil.py') diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py index e033e04b48..70d44e0936 100644 --- a/resources/libraries/python/IPsecUtil.py +++ b/resources/libraries/python/IPsecUtil.py @@ -240,6 +240,30 @@ class IPsecUtil(object): out[0], err_msg='Add SAD entry failed on {0}'.format(node['host'])) + @staticmethod + def vpp_ipsec_sa_set_key(node, sa_id, crypto_key, integ_key): + """Update Security Association (SA) keys. + + :param node: VPP node to update SA keys. + :param sa_id: SAD entry ID. + :param crypto_key: The encryption key string. + :param integ_key: The integrity key string. + :type node: dict + :type sa_id: int + :type crypto_key: str + :type integ_key: str + """ + ckey = crypto_key.encode('hex') + ikey = integ_key.encode('hex') + + out = VatExecutor.cmd_from_template(node, + "ipsec/ipsec_sa_set_key.vat", + sa_id=sa_id, + ckey=ckey, ikey=ikey) + VatJsonUtil.verify_vat_retval( + out[0], + err_msg='Update SA key failed on {0}'.format(node['host'])) + @staticmethod def vpp_ipsec_add_spd(node, spd_id): """Create Security Policy Database on the VPP node. -- cgit 1.2.3-korg