blob: 96a585a6e778e5ff1340b9ba01f71e92a3ec67f0 [file] [log] [blame]
Tom Jones800386a2024-02-07 13:26:41 +00001import socket
2
Paul Vinciguerraa279d9c2019-02-28 09:00:09 -08003from vpp_object import VppObject
Neale Ranns311124e2019-01-24 04:52:25 -08004from ipaddress import ip_address
Neale Ranns17dcec02019-01-09 21:22:20 -08005from vpp_papi import VppEnum
Neale Rannsdd4ccf22020-06-30 07:47:14 +00006from vpp_interface import VppInterface
Neale Ranns311124e2019-01-24 04:52:25 -08007
8try:
9 text_type = unicode
10except NameError:
11 text_type = str
12
13
Neale Ranns4a56f4e2019-12-23 04:10:25 +000014def mk_counter():
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020015 return {"packets": 0, "bytes": 0}
Neale Ranns4a56f4e2019-12-23 04:10:25 +000016
17
Neale Ranns311124e2019-01-24 04:52:25 -080018class VppIpsecSpd(VppObject):
19 """
20 VPP SPD DB
21 """
22
23 def __init__(self, test, id):
24 self.test = test
25 self.id = id
26
27 def add_vpp_config(self):
28 self.test.vapi.ipsec_spd_add_del(self.id)
29 self.test.registry.register(self, self.test.logger)
30
31 def remove_vpp_config(self):
32 self.test.vapi.ipsec_spd_add_del(self.id, is_add=0)
33
Neale Ranns311124e2019-01-24 04:52:25 -080034 def object_id(self):
35 return "ipsec-spd-%d" % self.id
36
37 def query_vpp_config(self):
38 spds = self.test.vapi.ipsec_spds_dump()
39 for spd in spds:
40 if spd.spd_id == self.id:
41 return True
42 return False
43
44
45class VppIpsecSpdItfBinding(VppObject):
46 """
47 VPP SPD DB to interface binding
Paul Vinciguerra8feeaff2019-03-27 11:25:48 -070048 (i.e. this SPD is used on this interface)
Neale Ranns311124e2019-01-24 04:52:25 -080049 """
50
51 def __init__(self, test, spd, itf):
52 self.test = test
53 self.spd = spd
54 self.itf = itf
55
56 def add_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020057 self.test.vapi.ipsec_interface_add_del_spd(self.spd.id, self.itf.sw_if_index)
Neale Ranns311124e2019-01-24 04:52:25 -080058 self.test.registry.register(self, self.test.logger)
59
60 def remove_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020061 self.test.vapi.ipsec_interface_add_del_spd(
62 self.spd.id, self.itf.sw_if_index, is_add=0
63 )
Neale Ranns311124e2019-01-24 04:52:25 -080064
Neale Ranns311124e2019-01-24 04:52:25 -080065 def object_id(self):
66 return "bind-%s-to-%s" % (self.spd.id, self.itf)
67
68 def query_vpp_config(self):
69 bs = self.test.vapi.ipsec_spd_interface_dump()
70 for b in bs:
71 if b.sw_if_index == self.itf.sw_if_index:
72 return True
73 return False
74
75
76class VppIpsecSpdEntry(VppObject):
77 """
78 VPP SPD DB Entry
79 """
80
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020081 def __init__(
82 self,
83 test,
84 spd,
85 sa_id,
86 local_start,
87 local_stop,
88 remote_start,
89 remote_stop,
Piotr Bronowski815c6a42022-06-09 09:09:28 +000090 proto=socket.IPPROTO_RAW,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020091 priority=100,
92 policy=None,
93 is_outbound=1,
94 remote_port_start=0,
95 remote_port_stop=65535,
96 local_port_start=0,
97 local_port_stop=65535,
98 ):
Neale Ranns311124e2019-01-24 04:52:25 -080099 self.test = test
100 self.spd = spd
101 self.sa_id = sa_id
102 self.local_start = ip_address(text_type(local_start))
103 self.local_stop = ip_address(text_type(local_stop))
104 self.remote_start = ip_address(text_type(remote_start))
105 self.remote_stop = ip_address(text_type(remote_stop))
106 self.proto = proto
107 self.is_outbound = is_outbound
108 self.priority = priority
Neale Ranns17dcec02019-01-09 21:22:20 -0800109 if not policy:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200110 self.policy = VppEnum.vl_api_ipsec_spd_action_t.IPSEC_API_SPD_ACTION_BYPASS
Neale Ranns17dcec02019-01-09 21:22:20 -0800111 else:
112 self.policy = policy
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200113 self.is_ipv6 = 0 if self.local_start.version == 4 else 1
Neale Ranns311124e2019-01-24 04:52:25 -0800114 self.local_port_start = local_port_start
115 self.local_port_stop = local_port_stop
116 self.remote_port_start = remote_port_start
117 self.remote_port_stop = remote_port_stop
118
119 def add_vpp_config(self):
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800120 rv = self.test.vapi.ipsec_spd_entry_add_del(
Neale Ranns311124e2019-01-24 04:52:25 -0800121 self.spd.id,
122 self.sa_id,
Neale Ranns17dcec02019-01-09 21:22:20 -0800123 self.local_start,
124 self.local_stop,
125 self.remote_start,
126 self.remote_stop,
Neale Ranns311124e2019-01-24 04:52:25 -0800127 protocol=self.proto,
128 is_ipv6=self.is_ipv6,
129 is_outbound=self.is_outbound,
130 priority=self.priority,
131 policy=self.policy,
132 local_port_start=self.local_port_start,
133 local_port_stop=self.local_port_stop,
134 remote_port_start=self.remote_port_start,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200135 remote_port_stop=self.remote_port_stop,
136 )
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800137 self.stat_index = rv.stat_index
Neale Ranns311124e2019-01-24 04:52:25 -0800138 self.test.registry.register(self, self.test.logger)
Neale Rannsfc811342021-02-26 10:35:33 +0000139 return self
Neale Ranns311124e2019-01-24 04:52:25 -0800140
141 def remove_vpp_config(self):
Neale Ranns17dcec02019-01-09 21:22:20 -0800142 self.test.vapi.ipsec_spd_entry_add_del(
Neale Ranns311124e2019-01-24 04:52:25 -0800143 self.spd.id,
144 self.sa_id,
Neale Ranns17dcec02019-01-09 21:22:20 -0800145 self.local_start,
146 self.local_stop,
147 self.remote_start,
148 self.remote_stop,
Neale Ranns311124e2019-01-24 04:52:25 -0800149 protocol=self.proto,
150 is_ipv6=self.is_ipv6,
151 is_outbound=self.is_outbound,
152 priority=self.priority,
153 policy=self.policy,
154 local_port_start=self.local_port_start,
155 local_port_stop=self.local_port_stop,
156 remote_port_start=self.remote_port_start,
157 remote_port_stop=self.remote_port_stop,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200158 is_add=0,
159 )
Neale Ranns311124e2019-01-24 04:52:25 -0800160
Neale Ranns311124e2019-01-24 04:52:25 -0800161 def object_id(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200162 return "spd-entry-%d-%d-%d-%d-%d-%d" % (
163 self.spd.id,
164 self.priority,
165 self.policy,
166 self.is_outbound,
167 self.is_ipv6,
168 self.remote_port_start,
169 )
Neale Ranns311124e2019-01-24 04:52:25 -0800170
171 def query_vpp_config(self):
172 ss = self.test.vapi.ipsec_spd_dump(self.spd.id)
173 for s in ss:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200174 if (
175 s.entry.sa_id == self.sa_id
176 and s.entry.is_outbound == self.is_outbound
177 and s.entry.priority == self.priority
178 and s.entry.policy == self.policy
179 and s.entry.remote_address_start == self.remote_start
180 and s.entry.remote_port_start == self.remote_port_start
181 ):
Neale Ranns311124e2019-01-24 04:52:25 -0800182 return True
183 return False
184
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000185 def get_stats(self, worker=None):
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800186 c = self.test.statistics.get_counter("/net/ipsec/policy")
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000187 if worker is None:
188 total = mk_counter()
189 for t in c:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200190 total["packets"] += t[self.stat_index]["packets"]
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000191 return total
192 else:
193 # +1 to skip main thread
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200194 return c[worker + 1][self.stat_index]
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800195
Neale Ranns311124e2019-01-24 04:52:25 -0800196
197class VppIpsecSA(VppObject):
198 """
199 VPP SAD Entry
200 """
201
Neale Rannsabc56602020-04-01 09:45:23 +0000202 DEFAULT_UDP_PORT = 4500
203
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200204 def __init__(
205 self,
206 test,
207 id,
208 spi,
209 integ_alg,
210 integ_key,
211 crypto_alg,
212 crypto_key,
213 proto,
214 tun_src=None,
215 tun_dst=None,
216 flags=None,
217 salt=0,
218 tun_flags=None,
219 dscp=None,
220 udp_src=None,
221 udp_dst=None,
222 hop_limit=None,
Maxime Peim0e2f1882022-12-22 11:26:57 +0000223 anti_replay_window_size=0,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200224 ):
Neale Ranns17dcec02019-01-09 21:22:20 -0800225 e = VppEnum.vl_api_ipsec_sad_flags_t
Neale Ranns311124e2019-01-24 04:52:25 -0800226 self.test = test
227 self.id = id
228 self.spi = spi
229 self.integ_alg = integ_alg
230 self.integ_key = integ_key
231 self.crypto_alg = crypto_alg
232 self.crypto_key = crypto_key
233 self.proto = proto
Neale Ranns80f6fd52019-04-16 02:41:34 +0000234 self.salt = salt
Maxime Peim0e2f1882022-12-22 11:26:57 +0000235 self.anti_replay_window_size = anti_replay_window_size
Neale Ranns17dcec02019-01-09 21:22:20 -0800236
Neale Ranns9ec846c2021-02-09 14:04:02 +0000237 self.table_id = 0
Neale Ranns311124e2019-01-24 04:52:25 -0800238 self.tun_src = tun_src
239 self.tun_dst = tun_dst
Neale Ranns17dcec02019-01-09 21:22:20 -0800240 if not flags:
241 self.flags = e.IPSEC_API_SAD_FLAG_NONE
242 else:
243 self.flags = flags
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200244 if tun_src:
Neale Ranns311124e2019-01-24 04:52:25 -0800245 self.tun_src = ip_address(text_type(tun_src))
Neale Ranns17dcec02019-01-09 21:22:20 -0800246 self.flags = self.flags | e.IPSEC_API_SAD_FLAG_IS_TUNNEL
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200247 if tun_dst:
Neale Ranns311124e2019-01-24 04:52:25 -0800248 self.tun_dst = ip_address(text_type(tun_dst))
Neale Rannsabc56602020-04-01 09:45:23 +0000249 self.udp_src = udp_src
250 self.udp_dst = udp_dst
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200251 self.tun_flags = (
252 VppEnum.vl_api_tunnel_encap_decap_flags_t.TUNNEL_API_ENCAP_DECAP_FLAG_NONE
253 )
Neale Ranns041add72020-01-02 04:06:10 +0000254 if tun_flags:
255 self.tun_flags = tun_flags
256 self.dscp = VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_CS0
257 if dscp:
258 self.dscp = dscp
Neale Ranns9ec846c2021-02-09 14:04:02 +0000259 self.hop_limit = 255
260 if hop_limit:
261 self.hop_limit = hop_limit
262
263 def tunnel_encode(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200264 return {
265 "src": (self.tun_src if self.tun_src else []),
266 "dst": (self.tun_dst if self.tun_dst else []),
267 "encap_decap_flags": self.tun_flags,
268 "dscp": self.dscp,
269 "hop_limit": self.hop_limit,
270 "table_id": self.table_id,
271 }
Neale Ranns311124e2019-01-24 04:52:25 -0800272
273 def add_vpp_config(self):
Neale Rannsabc56602020-04-01 09:45:23 +0000274 entry = {
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200275 "sad_id": self.id,
276 "spi": self.spi,
277 "integrity_algorithm": self.integ_alg,
278 "integrity_key": {
279 "length": len(self.integ_key),
280 "data": self.integ_key,
Neale Rannsabc56602020-04-01 09:45:23 +0000281 },
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200282 "crypto_algorithm": self.crypto_alg,
283 "crypto_key": {
284 "data": self.crypto_key,
285 "length": len(self.crypto_key),
Neale Rannsabc56602020-04-01 09:45:23 +0000286 },
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200287 "protocol": self.proto,
288 "tunnel": self.tunnel_encode(),
289 "flags": self.flags,
290 "salt": self.salt,
Maxime Peim0e2f1882022-12-22 11:26:57 +0000291 "anti_replay_window_size": self.anti_replay_window_size,
Neale Rannsabc56602020-04-01 09:45:23 +0000292 }
293 # don't explicitly send the defaults, let papi fill them in
294 if self.udp_src:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200295 entry["udp_src_port"] = self.udp_src
Neale Rannsabc56602020-04-01 09:45:23 +0000296 if self.udp_dst:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200297 entry["udp_dst_port"] = self.udp_dst
Maxime Peim0e2f1882022-12-22 11:26:57 +0000298 r = self.test.vapi.ipsec_sad_entry_add_v2(entry=entry)
Neale Rannseba31ec2019-02-17 18:04:27 +0000299 self.stat_index = r.stat_index
Neale Ranns311124e2019-01-24 04:52:25 -0800300 self.test.registry.register(self, self.test.logger)
Neale Rannsa9e27742020-12-23 16:22:28 +0000301 return self
Neale Ranns311124e2019-01-24 04:52:25 -0800302
Arthur de Kerhor4117b242022-08-31 19:13:03 +0200303 def update_vpp_config(
304 self, udp_src=None, udp_dst=None, is_tun=False, tun_src=None, tun_dst=None
305 ):
306 if is_tun:
307 if tun_src:
308 self.tun_src = ip_address(text_type(tun_src))
309 if tun_dst:
310 self.tun_dst = ip_address(text_type(tun_dst))
311 if udp_src:
312 self.udp_src = udp_src
313 if udp_dst:
314 self.udp_dst = udp_dst
315 self.test.vapi.ipsec_sad_entry_update(
316 sad_id=self.id,
317 is_tun=is_tun,
318 tunnel=self.tunnel_encode(),
319 udp_src_port=udp_src,
320 udp_dst_port=udp_dst,
321 )
322
Neale Ranns311124e2019-01-24 04:52:25 -0800323 def remove_vpp_config(self):
Neale Rannsff2e4132021-06-24 14:57:56 +0000324 self.test.vapi.ipsec_sad_entry_del(id=self.id)
Neale Ranns311124e2019-01-24 04:52:25 -0800325
Neale Ranns311124e2019-01-24 04:52:25 -0800326 def object_id(self):
327 return "ipsec-sa-%d" % self.id
328
329 def query_vpp_config(self):
Neale Rannsabc56602020-04-01 09:45:23 +0000330 e = VppEnum.vl_api_ipsec_sad_flags_t
331
Maxime Peim0e2f1882022-12-22 11:26:57 +0000332 bs = self.test.vapi.ipsec_sa_v5_dump()
Neale Ranns311124e2019-01-24 04:52:25 -0800333 for b in bs:
Neale Ranns8d7c5022019-02-06 01:41:05 -0800334 if b.entry.sad_id == self.id:
Neale Rannsabc56602020-04-01 09:45:23 +0000335 # if udp encap is configured then the ports should match
336 # those configured or the default
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200337 if self.flags & e.IPSEC_API_SAD_FLAG_UDP_ENCAP:
Neale Rannsabc56602020-04-01 09:45:23 +0000338 if not b.entry.flags & e.IPSEC_API_SAD_FLAG_UDP_ENCAP:
339 return False
340 if self.udp_src:
341 if self.udp_src != b.entry.udp_src_port:
342 return False
343 else:
344 if self.DEFAULT_UDP_PORT != b.entry.udp_src_port:
345 return False
346 if self.udp_dst:
347 if self.udp_dst != b.entry.udp_dst_port:
348 return False
349 else:
350 if self.DEFAULT_UDP_PORT != b.entry.udp_dst_port:
351 return False
Neale Ranns311124e2019-01-24 04:52:25 -0800352 return True
353 return False
Neale Rannseba31ec2019-02-17 18:04:27 +0000354
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000355 def get_stats(self, worker=None):
Neale Rannseba31ec2019-02-17 18:04:27 +0000356 c = self.test.statistics.get_counter("/net/ipsec/sa")
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000357 if worker is None:
358 total = mk_counter()
359 for t in c:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200360 total["packets"] += t[self.stat_index]["packets"]
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000361 return total
362 else:
363 # +1 to skip main thread
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200364 return c[worker + 1][self.stat_index]
Neale Rannsc87b66c2019-02-07 07:26:12 -0800365
Arthur de Kerhorad95b062022-11-16 19:12:05 +0100366 def get_err(self, name, worker=None):
367 c = self.test.statistics.get_counter("/net/ipsec/sa/err/" + name)
Neale Rannse11203e2021-09-21 12:34:19 +0000368 if worker is None:
369 total = 0
370 for t in c:
371 total += t[self.stat_index]
372 return total
373 else:
374 # +1 to skip main thread
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200375 return c[worker + 1][self.stat_index]
Neale Rannse11203e2021-09-21 12:34:19 +0000376
Neale Rannsc87b66c2019-02-07 07:26:12 -0800377
378class VppIpsecTunProtect(VppObject):
379 """
380 VPP IPSEC tunnel protection
381 """
382
Neale Ranns28287212019-12-16 00:53:11 +0000383 def __init__(self, test, itf, sa_out, sas_in, nh=None):
Neale Rannsc87b66c2019-02-07 07:26:12 -0800384 self.test = test
385 self.itf = itf
386 self.sas_in = []
387 for sa in sas_in:
388 self.sas_in.append(sa.id)
389 self.sa_out = sa_out.id
Neale Ranns28287212019-12-16 00:53:11 +0000390 self.nh = nh
391 if not self.nh:
392 self.nh = "0.0.0.0"
Neale Rannsc87b66c2019-02-07 07:26:12 -0800393
394 def update_vpp_config(self, sa_out, sas_in):
395 self.sas_in = []
396 for sa in sas_in:
397 self.sas_in.append(sa.id)
398 self.sa_out = sa_out.id
399 self.test.vapi.ipsec_tunnel_protect_update(
400 tunnel={
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200401 "sw_if_index": self.itf._sw_if_index,
402 "n_sa_in": len(self.sas_in),
403 "sa_out": self.sa_out,
404 "sa_in": self.sas_in,
405 "nh": self.nh,
406 }
407 )
Neale Rannsc87b66c2019-02-07 07:26:12 -0800408
409 def object_id(self):
Neale Ranns28287212019-12-16 00:53:11 +0000410 return "ipsec-tun-protect-%s-%s" % (self.itf, self.nh)
Neale Rannsc87b66c2019-02-07 07:26:12 -0800411
412 def add_vpp_config(self):
413 self.test.vapi.ipsec_tunnel_protect_update(
414 tunnel={
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200415 "sw_if_index": self.itf._sw_if_index,
416 "n_sa_in": len(self.sas_in),
417 "sa_out": self.sa_out,
418 "sa_in": self.sas_in,
419 "nh": self.nh,
420 }
421 )
Neale Rannsc87b66c2019-02-07 07:26:12 -0800422 self.test.registry.register(self, self.test.logger)
423
424 def remove_vpp_config(self):
425 self.test.vapi.ipsec_tunnel_protect_del(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200426 sw_if_index=self.itf.sw_if_index, nh=self.nh
427 )
Neale Rannsc87b66c2019-02-07 07:26:12 -0800428
429 def query_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200430 bs = self.test.vapi.ipsec_tunnel_protect_dump(sw_if_index=self.itf.sw_if_index)
Neale Rannsc87b66c2019-02-07 07:26:12 -0800431 for b in bs:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200432 if b.tun.sw_if_index == self.itf.sw_if_index and self.nh == str(b.tun.nh):
Neale Rannsc87b66c2019-02-07 07:26:12 -0800433 return True
434 return False
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000435
436
437class VppIpsecInterface(VppInterface):
438 """
439 VPP IPSec interface
440 """
441
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200442 def __init__(self, test, mode=None, instance=0xFFFFFFFF):
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000443 super(VppIpsecInterface, self).__init__(test)
444
Neale Ranns6ba4e412020-10-19 09:59:41 +0000445 self.mode = mode
446 if not self.mode:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200447 self.mode = VppEnum.vl_api_tunnel_mode_t.TUNNEL_API_MODE_P2P
Eric Kinzie609d5792020-10-13 20:02:11 -0400448 self.instance = instance
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000449
450 def add_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200451 r = self.test.vapi.ipsec_itf_create(
452 itf={
453 "user_instance": self.instance,
454 "mode": self.mode,
455 }
456 )
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000457 self.set_sw_if_index(r.sw_if_index)
458 self.test.registry.register(self, self.test.logger)
Neale Ranns89d939e2021-06-07 09:34:07 +0000459 ts = self.test.vapi.ipsec_itf_dump(sw_if_index=self._sw_if_index)
460 self.instance = ts[0].itf.user_instance
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000461 return self
462
463 def remove_vpp_config(self):
464 self.test.vapi.ipsec_itf_delete(sw_if_index=self._sw_if_index)
465
466 def query_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200467 ts = self.test.vapi.ipsec_itf_dump(sw_if_index=0xFFFFFFFF)
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000468 for t in ts:
Neale Ranns89d939e2021-06-07 09:34:07 +0000469 if t.itf.sw_if_index == self._sw_if_index:
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000470 return True
471 return False
472
473 def __str__(self):
474 return self.object_id()
475
476 def object_id(self):
Neale Ranns89d939e2021-06-07 09:34:07 +0000477 return "ipsec%d" % self.instance