-from vpp_object import *
+from vpp_object import VppObject
from ipaddress import ip_address
from vpp_papi import VppEnum
def remove_vpp_config(self):
self.test.vapi.ipsec_spd_add_del(self.id, is_add=0)
- def __str__(self):
- return self.object_id()
-
def object_id(self):
return "ipsec-spd-%d" % self.id
class VppIpsecSpdItfBinding(VppObject):
"""
VPP SPD DB to interface binding
- (i.e. this SPD is used on this interfce)
+ (i.e. this SPD is used on this interface)
"""
def __init__(self, test, spd, itf):
self.itf.sw_if_index,
is_add=0)
- def __str__(self):
- return self.object_id()
-
def object_id(self):
return "bind-%s-to-%s" % (self.spd.id, self.itf)
remote_port_stop=self.remote_port_stop,
is_add=0)
- def __str__(self):
- return self.object_id()
-
def object_id(self):
return "spd-entry-%d-%d-%d-%d-%d-%d" % (self.spd.id,
self.priority,
crypto_alg, crypto_key,
proto,
tun_src=None, tun_dst=None,
- flags=None):
+ flags=None, salt=0):
e = VppEnum.vl_api_ipsec_sad_flags_t
self.test = test
self.id = id
self.crypto_alg = crypto_alg
self.crypto_key = crypto_key
self.proto = proto
+ self.salt = salt
self.tun_src = tun_src
self.tun_dst = tun_dst
self.tun_dst = ip_address(text_type(tun_dst))
def add_vpp_config(self):
- self.test.vapi.ipsec_sad_entry_add_del(
+ r = self.test.vapi.ipsec_sad_entry_add_del(
self.id,
self.spi,
self.integ_alg,
self.proto,
(self.tun_src if self.tun_src else []),
(self.tun_dst if self.tun_dst else []),
- flags=self.flags)
+ flags=self.flags,
+ salt=self.salt)
+ self.stat_index = r.stat_index
self.test.registry.register(self, self.test.logger)
def remove_vpp_config(self):
flags=self.flags,
is_add=0)
- def __str__(self):
- return self.object_id()
-
def object_id(self):
return "ipsec-sa-%d" % self.id
if b.entry.sad_id == self.id:
return True
return False
+
+ def get_stats(self):
+ c = self.test.statistics.get_counter("/net/ipsec/sa")
+ return c[0][self.stat_index]