ipsec: ipsec-tun protect

please consult the new tunnel proposal at:
  https://wiki.fd.io/view/VPP/IPSec

Type: feature

Change-Id: I52857fc92ae068b85f59be08bdbea1bd5932e291
Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:
Neale Ranns
2019-02-07 07:26:12 -08:00
committed by Damjan Marion
parent 097fa66b98
commit c87b66c862
47 changed files with 2447 additions and 2125 deletions

View File

@ -247,3 +247,53 @@ class VppIpsecSA(VppObject):
def get_stats(self):
c = self.test.statistics.get_counter("/net/ipsec/sa")
return c[0][self.stat_index]
class VppIpsecTunProtect(VppObject):
"""
VPP IPSEC tunnel protection
"""
def __init__(self, test, itf, sa_out, sas_in):
self.test = test
self.itf = itf
self.sas_in = []
for sa in sas_in:
self.sas_in.append(sa.id)
self.sa_out = sa_out.id
def update_vpp_config(self, sa_out, sas_in):
self.sas_in = []
for sa in sas_in:
self.sas_in.append(sa.id)
self.sa_out = sa_out.id
self.test.vapi.ipsec_tunnel_protect_update(
tunnel={
'sw_if_index': self.itf._sw_if_index,
'n_sa_in': len(self.sas_in),
'sa_out': self.sa_out,
'sa_in': self.sas_in})
def object_id(self):
return "ipsec-tun-protect-%s" % self.itf
def add_vpp_config(self):
self.test.vapi.ipsec_tunnel_protect_update(
tunnel={
'sw_if_index': self.itf._sw_if_index,
'n_sa_in': len(self.sas_in),
'sa_out': self.sa_out,
'sa_in': self.sas_in})
self.test.registry.register(self, self.test.logger)
def remove_vpp_config(self):
self.test.vapi.ipsec_tunnel_protect_del(
sw_if_index=self.itf.sw_if_index)
def query_vpp_config(self):
bs = self.test.vapi.ipsec_tunnel_protect_dump(
sw_if_index=self.itf.sw_if_index)
for b in bs:
if b.tun.sw_if_index == self.itf.sw_if_index:
return True
return False