Typos. A bunch of typos I've been collecting.
[vpp.git] / test / vpp_ipsec.py
index 69aebc5..5866a0b 100644 (file)
@@ -1,4 +1,4 @@
-from vpp_object import *
+from vpp_object import VppObject
 from ipaddress import ip_address
 from vpp_papi import VppEnum
 
@@ -41,7 +41,7 @@ class VppIpsecSpd(VppObject):
 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):
@@ -213,7 +213,7 @@ class VppIpsecSA(VppObject):
             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,
@@ -224,6 +224,7 @@ class VppIpsecSA(VppObject):
             (self.tun_src if self.tun_src else []),
             (self.tun_dst if self.tun_dst else []),
             flags=self.flags)
+        self.stat_index = r.stat_index
         self.test.registry.register(self, self.test.logger)
 
     def remove_vpp_config(self):
@@ -249,6 +250,10 @@ class VppIpsecSA(VppObject):
     def query_vpp_config(self):
         bs = self.test.vapi.ipsec_sa_dump()
         for b in bs:
-            if b.sa_id == 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]