blob: e354cfc8ac6f57d9d67a7c5aa819c6b7e2990c8f [file] [log] [blame]
Paul Vinciguerraa279d9c2019-02-28 09:00:09 -08001from vpp_object import VppObject
Neale Ranns311124e2019-01-24 04:52:25 -08002from ipaddress import ip_address
Neale Ranns17dcec02019-01-09 21:22:20 -08003from vpp_papi import VppEnum
Neale Rannsdd4ccf22020-06-30 07:47:14 +00004from vpp_interface import VppInterface
Neale Ranns311124e2019-01-24 04:52:25 -08005
6try:
7 text_type = unicode
8except NameError:
9 text_type = str
10
11
Neale Ranns4a56f4e2019-12-23 04:10:25 +000012def mk_counter():
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020013 return {"packets": 0, "bytes": 0}
Neale Ranns4a56f4e2019-12-23 04:10:25 +000014
15
Neale Ranns311124e2019-01-24 04:52:25 -080016class VppIpsecSpd(VppObject):
17 """
18 VPP SPD DB
19 """
20
21 def __init__(self, test, id):
22 self.test = test
23 self.id = id
24
25 def add_vpp_config(self):
26 self.test.vapi.ipsec_spd_add_del(self.id)
27 self.test.registry.register(self, self.test.logger)
28
29 def remove_vpp_config(self):
30 self.test.vapi.ipsec_spd_add_del(self.id, is_add=0)
31
Neale Ranns311124e2019-01-24 04:52:25 -080032 def object_id(self):
33 return "ipsec-spd-%d" % self.id
34
35 def query_vpp_config(self):
36 spds = self.test.vapi.ipsec_spds_dump()
37 for spd in spds:
38 if spd.spd_id == self.id:
39 return True
40 return False
41
42
43class VppIpsecSpdItfBinding(VppObject):
44 """
45 VPP SPD DB to interface binding
Paul Vinciguerra8feeaff2019-03-27 11:25:48 -070046 (i.e. this SPD is used on this interface)
Neale Ranns311124e2019-01-24 04:52:25 -080047 """
48
49 def __init__(self, test, spd, itf):
50 self.test = test
51 self.spd = spd
52 self.itf = itf
53
54 def add_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020055 self.test.vapi.ipsec_interface_add_del_spd(self.spd.id, self.itf.sw_if_index)
Neale Ranns311124e2019-01-24 04:52:25 -080056 self.test.registry.register(self, self.test.logger)
57
58 def remove_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020059 self.test.vapi.ipsec_interface_add_del_spd(
60 self.spd.id, self.itf.sw_if_index, is_add=0
61 )
Neale Ranns311124e2019-01-24 04:52:25 -080062
Neale Ranns311124e2019-01-24 04:52:25 -080063 def object_id(self):
64 return "bind-%s-to-%s" % (self.spd.id, self.itf)
65
66 def query_vpp_config(self):
67 bs = self.test.vapi.ipsec_spd_interface_dump()
68 for b in bs:
69 if b.sw_if_index == self.itf.sw_if_index:
70 return True
71 return False
72
73
74class VppIpsecSpdEntry(VppObject):
75 """
76 VPP SPD DB Entry
77 """
78
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020079 def __init__(
80 self,
81 test,
82 spd,
83 sa_id,
84 local_start,
85 local_stop,
86 remote_start,
87 remote_stop,
Piotr Bronowski815c6a42022-06-09 09:09:28 +000088 proto=socket.IPPROTO_RAW,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020089 priority=100,
90 policy=None,
91 is_outbound=1,
92 remote_port_start=0,
93 remote_port_stop=65535,
94 local_port_start=0,
95 local_port_stop=65535,
96 ):
Neale Ranns311124e2019-01-24 04:52:25 -080097 self.test = test
98 self.spd = spd
99 self.sa_id = sa_id
100 self.local_start = ip_address(text_type(local_start))
101 self.local_stop = ip_address(text_type(local_stop))
102 self.remote_start = ip_address(text_type(remote_start))
103 self.remote_stop = ip_address(text_type(remote_stop))
104 self.proto = proto
105 self.is_outbound = is_outbound
106 self.priority = priority
Neale Ranns17dcec02019-01-09 21:22:20 -0800107 if not policy:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200108 self.policy = VppEnum.vl_api_ipsec_spd_action_t.IPSEC_API_SPD_ACTION_BYPASS
Neale Ranns17dcec02019-01-09 21:22:20 -0800109 else:
110 self.policy = policy
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200111 self.is_ipv6 = 0 if self.local_start.version == 4 else 1
Neale Ranns311124e2019-01-24 04:52:25 -0800112 self.local_port_start = local_port_start
113 self.local_port_stop = local_port_stop
114 self.remote_port_start = remote_port_start
115 self.remote_port_stop = remote_port_stop
116
117 def add_vpp_config(self):
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800118 rv = self.test.vapi.ipsec_spd_entry_add_del(
Neale Ranns311124e2019-01-24 04:52:25 -0800119 self.spd.id,
120 self.sa_id,
Neale Ranns17dcec02019-01-09 21:22:20 -0800121 self.local_start,
122 self.local_stop,
123 self.remote_start,
124 self.remote_stop,
Neale Ranns311124e2019-01-24 04:52:25 -0800125 protocol=self.proto,
126 is_ipv6=self.is_ipv6,
127 is_outbound=self.is_outbound,
128 priority=self.priority,
129 policy=self.policy,
130 local_port_start=self.local_port_start,
131 local_port_stop=self.local_port_stop,
132 remote_port_start=self.remote_port_start,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200133 remote_port_stop=self.remote_port_stop,
134 )
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800135 self.stat_index = rv.stat_index
Neale Ranns311124e2019-01-24 04:52:25 -0800136 self.test.registry.register(self, self.test.logger)
Neale Rannsfc811342021-02-26 10:35:33 +0000137 return self
Neale Ranns311124e2019-01-24 04:52:25 -0800138
139 def remove_vpp_config(self):
Neale Ranns17dcec02019-01-09 21:22:20 -0800140 self.test.vapi.ipsec_spd_entry_add_del(
Neale Ranns311124e2019-01-24 04:52:25 -0800141 self.spd.id,
142 self.sa_id,
Neale Ranns17dcec02019-01-09 21:22:20 -0800143 self.local_start,
144 self.local_stop,
145 self.remote_start,
146 self.remote_stop,
Neale Ranns311124e2019-01-24 04:52:25 -0800147 protocol=self.proto,
148 is_ipv6=self.is_ipv6,
149 is_outbound=self.is_outbound,
150 priority=self.priority,
151 policy=self.policy,
152 local_port_start=self.local_port_start,
153 local_port_stop=self.local_port_stop,
154 remote_port_start=self.remote_port_start,
155 remote_port_stop=self.remote_port_stop,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200156 is_add=0,
157 )
Neale Ranns311124e2019-01-24 04:52:25 -0800158
Neale Ranns311124e2019-01-24 04:52:25 -0800159 def object_id(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200160 return "spd-entry-%d-%d-%d-%d-%d-%d" % (
161 self.spd.id,
162 self.priority,
163 self.policy,
164 self.is_outbound,
165 self.is_ipv6,
166 self.remote_port_start,
167 )
Neale Ranns311124e2019-01-24 04:52:25 -0800168
169 def query_vpp_config(self):
170 ss = self.test.vapi.ipsec_spd_dump(self.spd.id)
171 for s in ss:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200172 if (
173 s.entry.sa_id == self.sa_id
174 and s.entry.is_outbound == self.is_outbound
175 and s.entry.priority == self.priority
176 and s.entry.policy == self.policy
177 and s.entry.remote_address_start == self.remote_start
178 and s.entry.remote_port_start == self.remote_port_start
179 ):
Neale Ranns311124e2019-01-24 04:52:25 -0800180 return True
181 return False
182
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000183 def get_stats(self, worker=None):
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800184 c = self.test.statistics.get_counter("/net/ipsec/policy")
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000185 if worker is None:
186 total = mk_counter()
187 for t in c:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200188 total["packets"] += t[self.stat_index]["packets"]
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000189 return total
190 else:
191 # +1 to skip main thread
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200192 return c[worker + 1][self.stat_index]
Neale Rannsa09c1ff2019-02-04 01:10:30 -0800193
Neale Ranns311124e2019-01-24 04:52:25 -0800194
195class VppIpsecSA(VppObject):
196 """
197 VPP SAD Entry
198 """
199
Neale Rannsabc56602020-04-01 09:45:23 +0000200 DEFAULT_UDP_PORT = 4500
201
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200202 def __init__(
203 self,
204 test,
205 id,
206 spi,
207 integ_alg,
208 integ_key,
209 crypto_alg,
210 crypto_key,
211 proto,
212 tun_src=None,
213 tun_dst=None,
214 flags=None,
215 salt=0,
216 tun_flags=None,
217 dscp=None,
218 udp_src=None,
219 udp_dst=None,
220 hop_limit=None,
Maxime Peim0e2f1882022-12-22 11:26:57 +0000221 anti_replay_window_size=0,
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200222 ):
Neale Ranns17dcec02019-01-09 21:22:20 -0800223 e = VppEnum.vl_api_ipsec_sad_flags_t
Neale Ranns311124e2019-01-24 04:52:25 -0800224 self.test = test
225 self.id = id
226 self.spi = spi
227 self.integ_alg = integ_alg
228 self.integ_key = integ_key
229 self.crypto_alg = crypto_alg
230 self.crypto_key = crypto_key
231 self.proto = proto
Neale Ranns80f6fd52019-04-16 02:41:34 +0000232 self.salt = salt
Maxime Peim0e2f1882022-12-22 11:26:57 +0000233 self.anti_replay_window_size = anti_replay_window_size
Neale Ranns17dcec02019-01-09 21:22:20 -0800234
Neale Ranns9ec846c2021-02-09 14:04:02 +0000235 self.table_id = 0
Neale Ranns311124e2019-01-24 04:52:25 -0800236 self.tun_src = tun_src
237 self.tun_dst = tun_dst
Neale Ranns17dcec02019-01-09 21:22:20 -0800238 if not flags:
239 self.flags = e.IPSEC_API_SAD_FLAG_NONE
240 else:
241 self.flags = flags
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200242 if tun_src:
Neale Ranns311124e2019-01-24 04:52:25 -0800243 self.tun_src = ip_address(text_type(tun_src))
Neale Ranns17dcec02019-01-09 21:22:20 -0800244 self.flags = self.flags | e.IPSEC_API_SAD_FLAG_IS_TUNNEL
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200245 if tun_dst:
Neale Ranns311124e2019-01-24 04:52:25 -0800246 self.tun_dst = ip_address(text_type(tun_dst))
Neale Rannsabc56602020-04-01 09:45:23 +0000247 self.udp_src = udp_src
248 self.udp_dst = udp_dst
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200249 self.tun_flags = (
250 VppEnum.vl_api_tunnel_encap_decap_flags_t.TUNNEL_API_ENCAP_DECAP_FLAG_NONE
251 )
Neale Ranns041add72020-01-02 04:06:10 +0000252 if tun_flags:
253 self.tun_flags = tun_flags
254 self.dscp = VppEnum.vl_api_ip_dscp_t.IP_API_DSCP_CS0
255 if dscp:
256 self.dscp = dscp
Neale Ranns9ec846c2021-02-09 14:04:02 +0000257 self.hop_limit = 255
258 if hop_limit:
259 self.hop_limit = hop_limit
260
261 def tunnel_encode(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200262 return {
263 "src": (self.tun_src if self.tun_src else []),
264 "dst": (self.tun_dst if self.tun_dst else []),
265 "encap_decap_flags": self.tun_flags,
266 "dscp": self.dscp,
267 "hop_limit": self.hop_limit,
268 "table_id": self.table_id,
269 }
Neale Ranns311124e2019-01-24 04:52:25 -0800270
271 def add_vpp_config(self):
Neale Rannsabc56602020-04-01 09:45:23 +0000272 entry = {
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200273 "sad_id": self.id,
274 "spi": self.spi,
275 "integrity_algorithm": self.integ_alg,
276 "integrity_key": {
277 "length": len(self.integ_key),
278 "data": self.integ_key,
Neale Rannsabc56602020-04-01 09:45:23 +0000279 },
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200280 "crypto_algorithm": self.crypto_alg,
281 "crypto_key": {
282 "data": self.crypto_key,
283 "length": len(self.crypto_key),
Neale Rannsabc56602020-04-01 09:45:23 +0000284 },
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200285 "protocol": self.proto,
286 "tunnel": self.tunnel_encode(),
287 "flags": self.flags,
288 "salt": self.salt,
Maxime Peim0e2f1882022-12-22 11:26:57 +0000289 "anti_replay_window_size": self.anti_replay_window_size,
Neale Rannsabc56602020-04-01 09:45:23 +0000290 }
291 # don't explicitly send the defaults, let papi fill them in
292 if self.udp_src:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200293 entry["udp_src_port"] = self.udp_src
Neale Rannsabc56602020-04-01 09:45:23 +0000294 if self.udp_dst:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200295 entry["udp_dst_port"] = self.udp_dst
Maxime Peim0e2f1882022-12-22 11:26:57 +0000296 r = self.test.vapi.ipsec_sad_entry_add_v2(entry=entry)
Neale Rannseba31ec2019-02-17 18:04:27 +0000297 self.stat_index = r.stat_index
Neale Ranns311124e2019-01-24 04:52:25 -0800298 self.test.registry.register(self, self.test.logger)
Neale Rannsa9e27742020-12-23 16:22:28 +0000299 return self
Neale Ranns311124e2019-01-24 04:52:25 -0800300
Arthur de Kerhor4117b242022-08-31 19:13:03 +0200301 def update_vpp_config(
302 self, udp_src=None, udp_dst=None, is_tun=False, tun_src=None, tun_dst=None
303 ):
304 if is_tun:
305 if tun_src:
306 self.tun_src = ip_address(text_type(tun_src))
307 if tun_dst:
308 self.tun_dst = ip_address(text_type(tun_dst))
309 if udp_src:
310 self.udp_src = udp_src
311 if udp_dst:
312 self.udp_dst = udp_dst
313 self.test.vapi.ipsec_sad_entry_update(
314 sad_id=self.id,
315 is_tun=is_tun,
316 tunnel=self.tunnel_encode(),
317 udp_src_port=udp_src,
318 udp_dst_port=udp_dst,
319 )
320
Neale Ranns311124e2019-01-24 04:52:25 -0800321 def remove_vpp_config(self):
Neale Rannsff2e4132021-06-24 14:57:56 +0000322 self.test.vapi.ipsec_sad_entry_del(id=self.id)
Neale Ranns311124e2019-01-24 04:52:25 -0800323
Neale Ranns311124e2019-01-24 04:52:25 -0800324 def object_id(self):
325 return "ipsec-sa-%d" % self.id
326
327 def query_vpp_config(self):
Neale Rannsabc56602020-04-01 09:45:23 +0000328 e = VppEnum.vl_api_ipsec_sad_flags_t
329
Maxime Peim0e2f1882022-12-22 11:26:57 +0000330 bs = self.test.vapi.ipsec_sa_v5_dump()
Neale Ranns311124e2019-01-24 04:52:25 -0800331 for b in bs:
Neale Ranns8d7c5022019-02-06 01:41:05 -0800332 if b.entry.sad_id == self.id:
Neale Rannsabc56602020-04-01 09:45:23 +0000333 # if udp encap is configured then the ports should match
334 # those configured or the default
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200335 if self.flags & e.IPSEC_API_SAD_FLAG_UDP_ENCAP:
Neale Rannsabc56602020-04-01 09:45:23 +0000336 if not b.entry.flags & e.IPSEC_API_SAD_FLAG_UDP_ENCAP:
337 return False
338 if self.udp_src:
339 if self.udp_src != b.entry.udp_src_port:
340 return False
341 else:
342 if self.DEFAULT_UDP_PORT != b.entry.udp_src_port:
343 return False
344 if self.udp_dst:
345 if self.udp_dst != b.entry.udp_dst_port:
346 return False
347 else:
348 if self.DEFAULT_UDP_PORT != b.entry.udp_dst_port:
349 return False
Neale Ranns311124e2019-01-24 04:52:25 -0800350 return True
351 return False
Neale Rannseba31ec2019-02-17 18:04:27 +0000352
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000353 def get_stats(self, worker=None):
Neale Rannseba31ec2019-02-17 18:04:27 +0000354 c = self.test.statistics.get_counter("/net/ipsec/sa")
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000355 if worker is None:
356 total = mk_counter()
357 for t in c:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200358 total["packets"] += t[self.stat_index]["packets"]
Neale Ranns4a56f4e2019-12-23 04:10:25 +0000359 return total
360 else:
361 # +1 to skip main thread
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200362 return c[worker + 1][self.stat_index]
Neale Rannsc87b66c2019-02-07 07:26:12 -0800363
Arthur de Kerhorad95b062022-11-16 19:12:05 +0100364 def get_err(self, name, worker=None):
365 c = self.test.statistics.get_counter("/net/ipsec/sa/err/" + name)
Neale Rannse11203e2021-09-21 12:34:19 +0000366 if worker is None:
367 total = 0
368 for t in c:
369 total += t[self.stat_index]
370 return total
371 else:
372 # +1 to skip main thread
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200373 return c[worker + 1][self.stat_index]
Neale Rannse11203e2021-09-21 12:34:19 +0000374
Neale Rannsc87b66c2019-02-07 07:26:12 -0800375
376class VppIpsecTunProtect(VppObject):
377 """
378 VPP IPSEC tunnel protection
379 """
380
Neale Ranns28287212019-12-16 00:53:11 +0000381 def __init__(self, test, itf, sa_out, sas_in, nh=None):
Neale Rannsc87b66c2019-02-07 07:26:12 -0800382 self.test = test
383 self.itf = itf
384 self.sas_in = []
385 for sa in sas_in:
386 self.sas_in.append(sa.id)
387 self.sa_out = sa_out.id
Neale Ranns28287212019-12-16 00:53:11 +0000388 self.nh = nh
389 if not self.nh:
390 self.nh = "0.0.0.0"
Neale Rannsc87b66c2019-02-07 07:26:12 -0800391
392 def update_vpp_config(self, sa_out, sas_in):
393 self.sas_in = []
394 for sa in sas_in:
395 self.sas_in.append(sa.id)
396 self.sa_out = sa_out.id
397 self.test.vapi.ipsec_tunnel_protect_update(
398 tunnel={
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200399 "sw_if_index": self.itf._sw_if_index,
400 "n_sa_in": len(self.sas_in),
401 "sa_out": self.sa_out,
402 "sa_in": self.sas_in,
403 "nh": self.nh,
404 }
405 )
Neale Rannsc87b66c2019-02-07 07:26:12 -0800406
407 def object_id(self):
Neale Ranns28287212019-12-16 00:53:11 +0000408 return "ipsec-tun-protect-%s-%s" % (self.itf, self.nh)
Neale Rannsc87b66c2019-02-07 07:26:12 -0800409
410 def add_vpp_config(self):
411 self.test.vapi.ipsec_tunnel_protect_update(
412 tunnel={
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200413 "sw_if_index": self.itf._sw_if_index,
414 "n_sa_in": len(self.sas_in),
415 "sa_out": self.sa_out,
416 "sa_in": self.sas_in,
417 "nh": self.nh,
418 }
419 )
Neale Rannsc87b66c2019-02-07 07:26:12 -0800420 self.test.registry.register(self, self.test.logger)
421
422 def remove_vpp_config(self):
423 self.test.vapi.ipsec_tunnel_protect_del(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200424 sw_if_index=self.itf.sw_if_index, nh=self.nh
425 )
Neale Rannsc87b66c2019-02-07 07:26:12 -0800426
427 def query_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200428 bs = self.test.vapi.ipsec_tunnel_protect_dump(sw_if_index=self.itf.sw_if_index)
Neale Rannsc87b66c2019-02-07 07:26:12 -0800429 for b in bs:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200430 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 -0800431 return True
432 return False
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000433
434
435class VppIpsecInterface(VppInterface):
436 """
437 VPP IPSec interface
438 """
439
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200440 def __init__(self, test, mode=None, instance=0xFFFFFFFF):
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000441 super(VppIpsecInterface, self).__init__(test)
442
Neale Ranns6ba4e412020-10-19 09:59:41 +0000443 self.mode = mode
444 if not self.mode:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200445 self.mode = VppEnum.vl_api_tunnel_mode_t.TUNNEL_API_MODE_P2P
Eric Kinzie609d5792020-10-13 20:02:11 -0400446 self.instance = instance
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000447
448 def add_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200449 r = self.test.vapi.ipsec_itf_create(
450 itf={
451 "user_instance": self.instance,
452 "mode": self.mode,
453 }
454 )
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000455 self.set_sw_if_index(r.sw_if_index)
456 self.test.registry.register(self, self.test.logger)
Neale Ranns89d939e2021-06-07 09:34:07 +0000457 ts = self.test.vapi.ipsec_itf_dump(sw_if_index=self._sw_if_index)
458 self.instance = ts[0].itf.user_instance
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000459 return self
460
461 def remove_vpp_config(self):
462 self.test.vapi.ipsec_itf_delete(sw_if_index=self._sw_if_index)
463
464 def query_vpp_config(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200465 ts = self.test.vapi.ipsec_itf_dump(sw_if_index=0xFFFFFFFF)
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000466 for t in ts:
Neale Ranns89d939e2021-06-07 09:34:07 +0000467 if t.itf.sw_if_index == self._sw_if_index:
Neale Rannsdd4ccf22020-06-30 07:47:14 +0000468 return True
469 return False
470
471 def __str__(self):
472 return self.object_id()
473
474 def object_id(self):
Neale Ranns89d939e2021-06-07 09:34:07 +0000475 return "ipsec%d" % self.instance