1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 """IPsec utilities library."""
17 from ipaddress import ip_network, ip_address
21 from resources.libraries.python.VatExecutor import VatExecutor
22 from resources.libraries.python.topology import Topology
23 from resources.libraries.python.VatJsonUtil import VatJsonUtil
26 class PolicyAction(Enum):
32 def __init__(self, string):
36 class CryptoAlg(Enum):
37 """Encryption algorithms."""
38 AES_CBC_128 = ('aes-cbc-128', 'AES-CBC', 16)
39 AES_CBC_192 = ('aes-cbc-192', 'AES-CBC', 24)
40 AES_CBC_256 = ('aes-cbc-256', 'AES-CBC', 32)
41 AES_GCM_128 = ('aes-gcm-128', 'AES-GCM', 20)
43 def __init__(self, alg_name, scapy_name, key_len):
44 self.alg_name = alg_name
45 self.scapy_name = scapy_name
46 self.key_len = key_len
50 """Integrity algorithm."""
51 SHA1_96 = ('sha1-96', 'HMAC-SHA1-96', 20)
52 SHA_256_128 = ('sha-256-128', 'SHA2-256-128', 32)
53 SHA_384_192 = ('sha-384-192', 'SHA2-384-192', 48)
54 SHA_512_256 = ('sha-512-256', 'SHA2-512-256', 64)
55 AES_GCM_128 = ('aes-gcm-128', 'AES-GCM', 20)
57 def __init__(self, alg_name, scapy_name, key_len):
58 self.alg_name = alg_name
59 self.scapy_name = scapy_name
60 self.key_len = key_len
63 class IPsecUtil(object):
64 """IPsec utilities."""
67 def policy_action_bypass():
68 """Return policy action bypass.
70 :returns: PolicyAction enum BYPASS object.
73 return PolicyAction.BYPASS
76 def policy_action_discard():
77 """Return policy action discard.
79 :returns: PolicyAction enum DISCARD object.
82 return PolicyAction.DISCARD
85 def policy_action_protect():
86 """Return policy action protect.
88 :returns: PolicyAction enum PROTECT object.
91 return PolicyAction.PROTECT
94 def crypto_alg_aes_cbc_128():
95 """Return encryption algorithm aes-cbc-128.
97 :returns: CryptoAlg enum AES_CBC_128 object.
100 return CryptoAlg.AES_CBC_128
103 def crypto_alg_aes_cbc_192():
104 """Return encryption algorithm aes-cbc-192.
106 :returns: CryptoAlg enum AES_CBC_192 objec.
109 return CryptoAlg.AES_CBC_192
112 def crypto_alg_aes_cbc_256():
113 """Return encryption algorithm aes-cbc-256.
115 :returns: CryptoAlg enum AES_CBC_256 object.
118 return CryptoAlg.AES_CBC_256
121 def crypto_alg_aes_gcm_128():
122 """Return encryption algorithm aes-gcm-128.
124 :returns: CryptoAlg enum AES_GCM_128 object.
127 return CryptoAlg.AES_GCM_128
130 def get_crypto_alg_key_len(crypto_alg):
131 """Return encryption algorithm key length.
133 :param crypto_alg: Encryption algorithm.
134 :type crypto_alg: CryptoAlg
135 :returns: Key length.
138 return crypto_alg.key_len
141 def get_crypto_alg_scapy_name(crypto_alg):
142 """Return encryption algorithm scapy name.
144 :param crypto_alg: Encryption algorithm.
145 :type crypto_alg: CryptoAlg
146 :returns: Algorithm scapy name.
149 return crypto_alg.scapy_name
152 def integ_alg_sha1_96():
153 """Return integrity algorithm SHA1-96.
155 :returns: IntegAlg enum SHA1_96 object.
158 return IntegAlg.SHA1_96
161 def integ_alg_sha_256_128():
162 """Return integrity algorithm SHA-256-128.
164 :returns: IntegAlg enum SHA_256_128 object.
167 return IntegAlg.SHA_256_128
170 def integ_alg_sha_384_192():
171 """Return integrity algorithm SHA-384-192.
173 :returns: IntegAlg enum SHA_384_192 object.
176 return IntegAlg.SHA_384_192
179 def integ_alg_sha_512_256():
180 """Return integrity algorithm SHA-512-256.
182 :returns: IntegAlg enum SHA_512_256 object.
185 return IntegAlg.SHA_512_256
188 def integ_alg_aes_gcm_128():
189 """Return integrity algorithm AES-GCM-128.
191 :returns: IntegAlg enum AES_GCM_128 object.
194 return IntegAlg.AES_GCM_128
197 def get_integ_alg_key_len(integ_alg):
198 """Return integrity algorithm key length.
200 :param integ_alg: Integrity algorithm.
201 :type integ_alg: IntegAlg
202 :returns: Key length.
205 return integ_alg.key_len
208 def get_integ_alg_scapy_name(integ_alg):
209 """Return integrity algorithm scapy name.
211 :param integ_alg: Integrity algorithm.
212 :type integ_alg: IntegAlg
213 :returns: Algorithm scapy name.
216 return integ_alg.scapy_name
219 def vpp_ipsec_add_sad_entry(node, sad_id, spi, crypto_alg, crypto_key,
220 integ_alg, integ_key, tunnel_src=None,
222 """Create Security Association Database entry on the VPP node.
224 :param node: VPP node to add SAD entry on.
225 :param sad_id: SAD entry ID.
226 :param spi: Security Parameter Index of this SAD entry.
227 :param crypto_alg: The encryption algorithm name.
228 :param crypto_key: The encryption key string.
229 :param integ_alg: The integrity algorithm name.
230 :param integ_key: The integrity key string.
231 :param tunnel_src: Tunnel header source IPv4 or IPv6 address. If not
232 specified ESP transport mode is used.
233 :param tunnel_dst: Tunnel header destination IPv4 or IPv6 address. If
234 not specified ESP transport mode is used.
238 :type crypto_alg: CryptoAlg
239 :type crypto_key: str
242 :type tunnel_src: str
243 :type tunnel_dst: str
245 ckey = crypto_key.encode('hex')
246 ikey = integ_key.encode('hex')
247 tunnel = 'tunnel_src {0} tunnel_dst {1}'.format(tunnel_src, tunnel_dst)\
248 if tunnel_src is not None and tunnel_dst is not None else ''
250 out = VatExecutor.cmd_from_template(node,
251 "ipsec/ipsec_sad_add_entry.vat",
252 sad_id=sad_id, spi=spi,
253 calg=crypto_alg.alg_name, ckey=ckey,
254 ialg=integ_alg.alg_name, ikey=ikey,
256 VatJsonUtil.verify_vat_retval(
258 err_msg='Add SAD entry failed on {0}'.format(node['host']))
261 def vpp_ipsec_add_sad_entries(node, n_entries, sad_id, spi, crypto_alg,
262 crypto_key, integ_alg, integ_key,
263 tunnel_src=None, tunnel_dst=None):
264 """Create multiple Security Association Database entries on VPP node.
266 :param node: VPP node to add SAD entry on.
267 :param n_entries: Number of SAD entries to be created.
268 :param sad_id: First SAD entry ID. All subsequent SAD entries will have
270 :param spi: Security Parameter Index of first SAD entry. All subsequent
271 SAD entries will have spi incremented by 1.
272 :param crypto_alg: The encryption algorithm name.
273 :param crypto_key: The encryption key string.
274 :param integ_alg: The integrity algorithm name.
275 :param integ_key: The integrity key string.
276 :param tunnel_src: Tunnel header source IPv4 or IPv6 address. If not
277 specified ESP transport mode is used.
278 :param tunnel_dst: Tunnel header destination IPv4 or IPv6 address. If
279 not specified ESP transport mode is used.
284 :type crypto_alg: CryptoAlg
285 :type crypto_key: str
286 :type integ_alg: IntegAlg
288 :type tunnel_src: str
289 :type tunnel_dst: str
291 tmp_filename = '/tmp/ipsec_sad_{}_add_del_entry.vat'.format(sad_id)
292 ckey = crypto_key.encode('hex')
293 ikey = integ_key.encode('hex')
294 tunnel = 'tunnel_src {0} tunnel_dst {1}'.format(tunnel_src, tunnel_dst)\
295 if tunnel_src is not None and tunnel_dst is not None else ''
297 integ = 'integ_alg {0} integ_key {1}'.format(integ_alg.alg_name, ikey)\
298 if crypto_alg.alg_name != 'aes-gcm-128' else ''
300 with open(tmp_filename, 'w') as tmp_file:
301 for i in range(0, n_entries):
302 buf_str = 'ipsec_sad_add_del_entry esp sad_id {0} spi {1} ' \
303 'crypto_alg {2} crypto_key {3} {4} {5}\n'.format(
304 sad_id+i, spi+i, crypto_alg.alg_name, ckey, integ,
306 tmp_file.write(buf_str)
308 vat.scp_and_execute_script(tmp_filename, node, 300)
309 os.remove(tmp_filename)
312 def vpp_ipsec_sa_set_key(node, sa_id, crypto_key, integ_key):
313 """Update Security Association (SA) keys.
315 :param node: VPP node to update SA keys.
316 :param sa_id: SAD entry ID.
317 :param crypto_key: The encryption key string.
318 :param integ_key: The integrity key string.
321 :type crypto_key: str
324 ckey = crypto_key.encode('hex')
325 ikey = integ_key.encode('hex')
327 out = VatExecutor.cmd_from_template(node,
328 "ipsec/ipsec_sa_set_key.vat",
330 ckey=ckey, ikey=ikey)
331 VatJsonUtil.verify_vat_retval(
333 err_msg='Update SA key failed on {0}'.format(node['host']))
336 def vpp_ipsec_add_spd(node, spd_id):
337 """Create Security Policy Database on the VPP node.
339 :param node: VPP node to add SPD on.
340 :param spd_id: SPD ID.
344 out = VatExecutor.cmd_from_template(node, "ipsec/ipsec_spd_add.vat",
346 VatJsonUtil.verify_vat_retval(
348 err_msg='Add SPD {0} failed on {1}'.format(spd_id, node['host']))
351 def vpp_ipsec_spd_add_if(node, spd_id, interface):
352 """Add interface to the Security Policy Database.
354 :param node: VPP node.
355 :param spd_id: SPD ID to add interface on.
356 :param interface: Interface name or sw_if_index.
359 :type interface: str or int
361 sw_if_index = Topology.get_interface_sw_index(node, interface)\
362 if isinstance(interface, basestring) else interface
364 out = VatExecutor.cmd_from_template(node,
365 "ipsec/ipsec_interface_add_spd.vat",
366 spd_id=spd_id, sw_if_id=sw_if_index)
367 VatJsonUtil.verify_vat_retval(
369 err_msg='Add interface {0} to SPD {1} failed on {2}'.format(
370 interface, spd_id, node['host']))
373 def vpp_ipsec_spd_add_entry(node, spd_id, priority, action, inbound=True,
374 sa_id=None, laddr_range=None, raddr_range=None,
375 proto=None, lport_range=None, rport_range=None):
376 """Create Security Policy Database entry on the VPP node.
378 :param node: VPP node to add SPD entry on.
379 :param spd_id: SPD ID to add entry on.
380 :param priority: SPD entry priority, higher number = higher priority.
381 :param action: Policy action.
382 :param inbound: If True policy is for inbound traffic, otherwise
384 :param sa_id: SAD entry ID for protect action.
385 :param laddr_range: Policy selector local IPv4 or IPv6 address range in
386 format IP/prefix or IP/mask. If no mask is provided, it's considered
388 :param raddr_range: Policy selector remote IPv4 or IPv6 address range in
389 format IP/prefix or IP/mask. If no mask is provided, it's considered
391 :param proto: Policy selector next layer protocol number.
392 :param lport_range: Policy selector local TCP/UDP port range in format
393 <port_start>-<port_end>.
394 :param rport_range: Policy selector remote TCP/UDP port range in format
395 <port_start>-<port_end>.
399 :type action: PolicyAction
402 :type laddr_range: string
403 :type raddr_range: string
405 :type lport_range: string
406 :type rport_range: string
408 direction = 'inbound' if inbound else 'outbound'
410 act_str = action.value
411 if PolicyAction.PROTECT == action and sa_id is not None:
412 act_str += 'sa_id {0}'.format(sa_id)
415 if laddr_range is not None:
416 net = ip_network(unicode(laddr_range), strict=False)
417 selector += 'laddr_start {0} laddr_stop {1} '.format(
418 net.network_address, net.broadcast_address)
419 if raddr_range is not None:
420 net = ip_network(unicode(raddr_range), strict=False)
421 selector += 'raddr_start {0} raddr_stop {1} '.format(
422 net.network_address, net.broadcast_address)
423 if proto is not None:
424 selector += 'protocol {0} '.format(proto)
425 if lport_range is not None:
426 selector += 'lport_start {p[0]} lport_stop {p[1]} '.format(
427 p=lport_range.split('-'))
428 if rport_range is not None:
429 selector += 'rport_start {p[0]} rport_stop {p[1]} '.format(
430 p=rport_range.split('-'))
432 out = VatExecutor.cmd_from_template(node,
433 "ipsec/ipsec_spd_add_entry.vat",
434 spd_id=spd_id, priority=priority,
435 action=act_str, direction=direction,
437 VatJsonUtil.verify_vat_retval(
439 err_msg='Add entry to SPD {0} failed on {1}'.format(spd_id,
443 def vpp_ipsec_spd_add_entries(node, n_entries, spd_id, priority, inbound,
444 sa_id, raddr_ip, raddr_range):
445 """Create multiple Security Policy Database entries on the VPP node.
447 :param node: VPP node to add SPD entries on.
448 :param n_entries: Number of SPD entries to be added.
449 :param spd_id: SPD ID to add entries on.
450 :param priority: SPD entries priority, higher number = higher priority.
451 :param inbound: If True policy is for inbound traffic, otherwise
453 :param sa_id: SAD entry ID for first entry. Each subsequent entry will
454 SAD entry ID incremented by 1.
455 :param raddr_ip: Policy selector remote IPv4 start address for the first
456 entry. Remote IPv4 end address will be calculated depending on
457 raddr_range parameter. Each subsequent entry will have start address
458 next after IPv4 end address of previous entry.
459 :param raddr_range: Mask specifying range of Policy selector Remote IPv4
460 addresses. Valid values are from 1 to 32.
467 :type raddr_ip: string
468 :type raddr_range: int
470 tmp_filename = '/tmp/ipsec_spd_{}_add_del_entry.vat'.format(sa_id)
471 direction = 'inbound' if inbound else 'outbound'
472 addr_incr = 1 << (32 - raddr_range)
473 addr_ip = int(ip_address(unicode(raddr_ip)))
474 start_str = 'ipsec_spd_add_del_entry spd_id {0} priority {1} {2} ' \
475 'action protect sa_id'.format(spd_id, priority, direction)
476 with open(tmp_filename, 'w') as tmp_file:
477 for i in range(0, n_entries):
478 r_ip_s = ip_address(addr_ip + addr_incr * i)
479 r_ip_e = ip_address(addr_ip + addr_incr * (i+1) - 1)
480 buf_str = '{0} {1} raddr_start {2} raddr_stop {3}\n'.format(
481 start_str, sa_id+i, r_ip_s, r_ip_e)
482 tmp_file.write(buf_str)
484 vat.scp_and_execute_script(tmp_filename, node, 300)
485 os.remove(tmp_filename)
488 def vpp_ipsec_create_tunnel_interfaces(node1, node2, if1_ip_addr,
489 if2_ip_addr, if1_key, if2_key,
490 n_tunnels, crypto_alg, crypto_key,
491 integ_alg, integ_key, raddr_ip1,
492 raddr_ip2, raddr_range):
493 """Create multiple IPsec tunnel interfaces between two VPP nodes.
495 :param node1: VPP node 1 to create tunnel interfaces.
496 :param node2: VPP node 2 to create tunnel interfaces.
497 :param if1_ip_addr: VPP node 1 interface IP4 address.
498 :param if2_ip_addr: VPP node 2 interface IP4 address.
499 :param if1_key: VPP node 1 interface key from topology file.
500 :param if2_key: VPP node 2 interface key from topology file.
501 :param n_tunnels: Number of tunnell interfaces to create.
502 :param crypto_alg: The encryption algorithm name.
503 :param crypto_key: The encryption key string.
504 :param integ_alg: The integrity algorithm name.
505 :param integ_key: The integrity key string.
506 :param raddr_ip1: Policy selector remote IPv4 start address for the
507 first tunnel in direction node1->node2.
508 :param raddr_ip2: Policy selector remote IPv4 start address for the
509 first tunnel in direction node2->node1.
510 :param raddr_range: Mask specifying range of Policy selector Remote IPv4
511 addresses. Valid values are from 1 to 32.
514 :type if1_ip_addr: str
515 :type if2_ip_addr: str
519 :type crypto_alg: CryptoAlg
520 :type crypto_key: str
521 :type integ_alg: IntegAlg
523 :type raddr_ip1: string
524 :type raddr_ip2: string
525 :type raddr_range: int
531 raddr_ip1_i = int(ip_address(unicode(raddr_ip1)))
532 raddr_ip2_i = int(ip_address(unicode(raddr_ip2)))
533 addr_incr = 1 << (32 - raddr_range)
535 tmp_fn1 = '/tmp/ipsec_create_tunnel_dut1.config'
536 tmp_fn2 = '/tmp/ipsec_create_tunnel_dut2.config'
538 ckey = crypto_key.encode('hex')
539 ikey = integ_key.encode('hex')
541 with open(tmp_fn1, 'w') as tmp_f1, open(tmp_fn2, 'w') as tmp_f2:
542 for i in range(0, n_tunnels):
543 if_s = 'ipsec{}'.format(i)
544 dut1_tunnel_s = 'create ipsec tunnel local-ip {0} local-spi ' \
545 '{1} remote-ip {2} remote-spi {3}\n'.format(
546 if1_ip_addr, spi_1+i, if2_ip_addr, spi_2+i)
547 tmp_f1.write(dut1_tunnel_s)
548 dut2_tunnel_s = 'create ipsec tunnel local-ip {0} local-spi ' \
549 '{1} remote-ip {2} remote-spi {3}\n'.format(
550 if2_ip_addr, spi_2+i, if1_ip_addr, spi_1+i)
551 tmp_f2.write(dut2_tunnel_s)
552 loc_c_key = 'set interface ipsec key {0} local crypto {1} ' \
553 '{2}\n'.format(if_s, crypto_alg.alg_name, ckey)
554 tmp_f1.write(loc_c_key)
555 tmp_f2.write(loc_c_key)
556 rem_c_key = 'set interface ipsec key {0} remote crypto {1} ' \
557 '{2}\n'.format(if_s, crypto_alg.alg_name, ckey)
558 tmp_f1.write(rem_c_key)
559 tmp_f2.write(rem_c_key)
560 if crypto_alg.alg_name != 'aes-gcm-128':
561 loc_i_key = 'set interface ipsec key {0} local integ {1} ' \
562 '{2}\n'.format(if_s, integ_alg.alg_name, ikey)
563 tmp_f1.write(loc_i_key)
564 tmp_f2.write(loc_i_key)
565 rem_i_key = 'set interface ipsec key {0} remote integ {1}' \
566 ' {2}\n'.format(if_s, integ_alg.alg_name, ikey)
567 tmp_f1.write(rem_i_key)
568 tmp_f2.write(rem_i_key)
569 raddr_ip1_s = ip_address(raddr_ip1_i + addr_incr*i)
570 raddr_ip2_s = ip_address(raddr_ip2_i + addr_incr*i)
571 dut1_rte_s = 'ip route add {0}/{1} via {2} {3}\n'.format(
572 raddr_ip2_s, raddr_range, if2_ip_addr, if_s)
573 tmp_f1.write(dut1_rte_s)
574 dut2_rte_s = 'ip route add {0}/{1} via {2} {3}\n'.format(
575 raddr_ip1_s, raddr_range, if1_ip_addr, if_s)
576 tmp_f2.write(dut2_rte_s)
577 dut1_if = Topology.get_interface_name(node1, if1_key)
578 dut1_unnum_s = 'set interface unnumbered {0} use {1}\n'.format(
580 tmp_f1.write(dut1_unnum_s)
581 dut2_if = Topology.get_interface_name(node2, if2_key)
582 dut2_unnum_s = 'set interface unnumbered {0} use {1}\n'.format(
584 tmp_f2.write(dut2_unnum_s)
585 up_s = 'set int state {0} up\n'.format(if_s)
590 vat.scp_and_execute_cli_script(tmp_fn1, node1, 300)
591 vat.scp_and_execute_cli_script(tmp_fn2, node2, 300)
596 def vpp_ipsec_add_multiple_tunnels(node1, node2, interface1, interface2,
597 n_tunnels, crypto_alg, crypto_key,
598 integ_alg, integ_key, tunnel_ip1,
599 tunnel_ip2, raddr_ip1, raddr_ip2,
601 """Create multiple IPsec tunnels between two VPP nodes.
603 :param node1: VPP node 1 to create tunnels.
604 :param node2: VPP node 2 to create tunnels.
605 :param interface1: Interface name or sw_if_index on node 1.
606 :param interface2: Interface name or sw_if_index on node 2.
607 :param n_tunnels: Number of tunnels to create.
608 :param crypto_alg: The encryption algorithm name.
609 :param crypto_key: The encryption key string.
610 :param integ_alg: The integrity algorithm name.
611 :param integ_key: The integrity key string.
612 :param tunnel_ip1: Tunnel node1 IPv4 address.
613 :param tunnel_ip2: Tunnel node2 IPv4 address.
614 :param raddr_ip1: Policy selector remote IPv4 start address for the
615 first tunnel in direction node1->node2.
616 :param raddr_ip2: Policy selector remote IPv4 start address for the
617 first tunnel in direction node2->node1.
618 :param raddr_range: Mask specifying range of Policy selector Remote IPv4
619 addresses. Valid values are from 1 to 32.
622 :type interface1: str or int
623 :type interface2: str or int
625 :type crypto_alg: CryptoAlg
626 :type crypto_key: str
629 :type tunnel_ip1: str
630 :type tunnel_ip2: str
631 :type raddr_ip1: string
632 :type raddr_ip2: string
633 :type raddr_range: int
644 IPsecUtil.vpp_ipsec_add_spd(node1, spd_id)
645 IPsecUtil.vpp_ipsec_spd_add_if(node1, spd_id, interface1)
646 IPsecUtil.vpp_ipsec_spd_add_entry(node1, spd_id, p_hi,
647 PolicyAction.BYPASS, inbound=False,
649 IPsecUtil.vpp_ipsec_spd_add_entry(node1, spd_id, p_hi,
650 PolicyAction.BYPASS, inbound=True,
653 IPsecUtil.vpp_ipsec_add_spd(node2, spd_id)
654 IPsecUtil.vpp_ipsec_spd_add_if(node2, spd_id, interface2)
655 IPsecUtil.vpp_ipsec_spd_add_entry(node2, spd_id, p_hi,
656 PolicyAction.BYPASS, inbound=False,
658 IPsecUtil.vpp_ipsec_spd_add_entry(node2, spd_id, p_hi,
659 PolicyAction.BYPASS, inbound=True,
662 IPsecUtil.vpp_ipsec_add_sad_entries(node1, n_tunnels, sa_id_1, spi_1,
663 crypto_alg, crypto_key, integ_alg,
664 integ_key, tunnel_ip1, tunnel_ip2)
666 IPsecUtil.vpp_ipsec_spd_add_entries(node1, n_tunnels, spd_id, p_lo,
667 False, sa_id_1, raddr_ip2,
670 IPsecUtil.vpp_ipsec_add_sad_entries(node2, n_tunnels, sa_id_1, spi_1,
671 crypto_alg, crypto_key, integ_alg,
672 integ_key, tunnel_ip1, tunnel_ip2)
674 IPsecUtil.vpp_ipsec_spd_add_entries(node2, n_tunnels, spd_id, p_lo,
675 True, sa_id_1, raddr_ip2,
678 IPsecUtil.vpp_ipsec_add_sad_entries(node2, n_tunnels, sa_id_2, spi_2,
679 crypto_alg, crypto_key, integ_alg,
680 integ_key, tunnel_ip2, tunnel_ip1)
682 IPsecUtil.vpp_ipsec_spd_add_entries(node2, n_tunnels, spd_id, p_lo,
683 False, sa_id_2, raddr_ip1,
686 IPsecUtil.vpp_ipsec_add_sad_entries(node1, n_tunnels, sa_id_2, spi_2,
687 crypto_alg, crypto_key, integ_alg,
688 integ_key, tunnel_ip2, tunnel_ip1)
690 IPsecUtil.vpp_ipsec_spd_add_entries(node1, n_tunnels, spd_id, p_lo,
691 True, sa_id_2, raddr_ip1,
695 def vpp_ipsec_show(node):
696 """Run "show ipsec" debug CLI command.
698 :param node: Node to run command on.
701 VatExecutor().execute_script("ipsec/ipsec_show.vat", node,