blob: 8d9b3ecb9e2c90c2c2306de13570ad6f3c423c60 [file] [log] [blame]
“mystarrocks”23f0c452017-12-11 07:11:51 -08001import socket
Klement Sekera28fb03f2018-04-17 11:36:55 +02002import unittest
Neale Ranns47feb112019-04-11 15:14:07 +00003import struct
Klement Sekera31da2e32018-06-24 22:49:55 +02004from scapy.layers.ipsec import ESP
Neale Ranns53f526b2019-02-25 14:32:02 +00005from scapy.layers.inet import UDP
“mystarrocks”23f0c452017-12-11 07:11:51 -08006
Klement Sekera31da2e32018-06-24 22:49:55 +02007from framework import VppTestRunner
Neale Ranns53f526b2019-02-25 14:32:02 +00008from template_ipsec import IpsecTra46Tests, IpsecTun46Tests, TemplateIpsec, \
Neale Ranns4f33c802019-04-10 12:39:10 +00009 IpsecTcpTests, IpsecTun4Tests, IpsecTra4Tests, config_tra_params, \
10 IPsecIPv4Params, IPsecIPv6Params, \
11 IpsecTra4, IpsecTun4, IpsecTra6, IpsecTun6
Klement Sekerabf613952019-01-29 11:38:08 +010012from vpp_ipsec import VppIpsecSpd, VppIpsecSpdEntry, VppIpsecSA,\
Neale Ranns4f33c802019-04-10 12:39:10 +000013 VppIpsecSpdItfBinding
Neale Ranns311124e2019-01-24 04:52:25 -080014from vpp_ip_route import VppIpRoute, VppRoutePath
15from vpp_ip import DpoProto
Neale Ranns17dcec02019-01-09 21:22:20 -080016from vpp_papi import VppEnum
“mystarrocks”23f0c452017-12-11 07:11:51 -080017
18
Neale Ranns4f33c802019-04-10 12:39:10 +000019class ConfigIpsecESP(TemplateIpsec):
20 encryption_type = ESP
21 tra4_encrypt_node_name = "esp4-encrypt"
22 tra4_decrypt_node_name = "esp4-decrypt"
23 tra6_encrypt_node_name = "esp6-encrypt"
24 tra6_decrypt_node_name = "esp6-decrypt"
25 tun4_encrypt_node_name = "esp4-encrypt"
26 tun4_decrypt_node_name = "esp4-decrypt"
27 tun6_encrypt_node_name = "esp6-encrypt"
28 tun6_decrypt_node_name = "esp6-decrypt"
Neale Ranns53f526b2019-02-25 14:32:02 +000029
Neale Ranns4f33c802019-04-10 12:39:10 +000030 @classmethod
31 def setUpClass(cls):
32 super(ConfigIpsecESP, cls).setUpClass()
Neale Ranns53f526b2019-02-25 14:32:02 +000033
Neale Ranns4f33c802019-04-10 12:39:10 +000034 @classmethod
35 def tearDownClass(cls):
36 super(ConfigIpsecESP, cls).tearDownClass()
Neale Ranns53f526b2019-02-25 14:32:02 +000037
Neale Ranns4f33c802019-04-10 12:39:10 +000038 def setUp(self):
39 super(ConfigIpsecESP, self).setUp()
Neale Ranns53f526b2019-02-25 14:32:02 +000040
Neale Ranns4f33c802019-04-10 12:39:10 +000041 def tearDown(self):
42 super(ConfigIpsecESP, self).tearDown()
43
44 def config_network(self, params):
45 self.net_objs = []
46 self.tun_if = self.pg0
47 self.tra_if = self.pg2
48 self.logger.info(self.vapi.ppcli("show int addr"))
49
50 self.tra_spd = VppIpsecSpd(self, self.tra_spd_id)
51 self.tra_spd.add_vpp_config()
52 self.net_objs.append(self.tra_spd)
53 self.tun_spd = VppIpsecSpd(self, self.tun_spd_id)
54 self.tun_spd.add_vpp_config()
55 self.net_objs.append(self.tun_spd)
56
57 b = VppIpsecSpdItfBinding(self, self.tun_spd,
58 self.tun_if)
59 b.add_vpp_config()
60 self.net_objs.append(b)
61
62 b = VppIpsecSpdItfBinding(self, self.tra_spd,
63 self.tra_if)
64 b.add_vpp_config()
65 self.net_objs.append(b)
66
67 for p in params:
68 self.config_esp_tra(p)
69 config_tra_params(p, self.encryption_type)
70 for p in params:
71 self.config_esp_tun(p)
72
73 for p in params:
74 d = DpoProto.DPO_PROTO_IP6 if p.is_ipv6 else DpoProto.DPO_PROTO_IP4
75 r = VppIpRoute(self, p.remote_tun_if_host, p.addr_len,
76 [VppRoutePath(self.tun_if.remote_addr[p.addr_type],
77 0xffffffff,
78 proto=d)],
79 is_ip6=p.is_ipv6)
80 r.add_vpp_config()
81 self.net_objs.append(r)
82
83 self.logger.info(self.vapi.ppcli("show ipsec all"))
84
85 def unconfig_network(self):
86 for o in reversed(self.net_objs):
87 o.remove_vpp_config()
88 self.net_objs = []
89
90 def config_esp_tun(self, params):
91 addr_type = params.addr_type
92 scapy_tun_sa_id = params.scapy_tun_sa_id
93 scapy_tun_spi = params.scapy_tun_spi
94 vpp_tun_sa_id = params.vpp_tun_sa_id
95 vpp_tun_spi = params.vpp_tun_spi
96 auth_algo_vpp_id = params.auth_algo_vpp_id
97 auth_key = params.auth_key
98 crypt_algo_vpp_id = params.crypt_algo_vpp_id
99 crypt_key = params.crypt_key
100 remote_tun_if_host = params.remote_tun_if_host
101 addr_any = params.addr_any
102 addr_bcast = params.addr_bcast
103 e = VppEnum.vl_api_ipsec_spd_action_t
Neale Ranns49e7ef62019-04-10 17:24:29 +0000104 flags = params.flags
Neale Ranns4f33c802019-04-10 12:39:10 +0000105 objs = []
106
107 params.tun_sa_in = VppIpsecSA(self, scapy_tun_sa_id, scapy_tun_spi,
108 auth_algo_vpp_id, auth_key,
109 crypt_algo_vpp_id, crypt_key,
110 self.vpp_esp_protocol,
111 self.tun_if.local_addr[addr_type],
Neale Ranns49e7ef62019-04-10 17:24:29 +0000112 self.tun_if.remote_addr[addr_type],
113 flags=flags)
Neale Ranns4f33c802019-04-10 12:39:10 +0000114 params.tun_sa_out = VppIpsecSA(self, vpp_tun_sa_id, vpp_tun_spi,
115 auth_algo_vpp_id, auth_key,
116 crypt_algo_vpp_id, crypt_key,
117 self.vpp_esp_protocol,
118 self.tun_if.remote_addr[addr_type],
Neale Ranns49e7ef62019-04-10 17:24:29 +0000119 self.tun_if.local_addr[addr_type],
120 flags=flags)
Neale Ranns4f33c802019-04-10 12:39:10 +0000121 objs.append(params.tun_sa_in)
122 objs.append(params.tun_sa_out)
123
124 params.spd_policy_in_any = VppIpsecSpdEntry(self, self.tun_spd,
125 scapy_tun_sa_id,
126 addr_any, addr_bcast,
127 addr_any, addr_bcast,
128 socket.IPPROTO_ESP)
129 params.spd_policy_out_any = VppIpsecSpdEntry(self, self.tun_spd,
130 scapy_tun_sa_id,
131 addr_any, addr_bcast,
132 addr_any, addr_bcast,
133 socket.IPPROTO_ESP,
134 is_outbound=0)
135 objs.append(params.spd_policy_out_any)
136 objs.append(params.spd_policy_in_any)
137
138 objs.append(VppIpsecSpdEntry(self, self.tun_spd, vpp_tun_sa_id,
139 remote_tun_if_host, remote_tun_if_host,
140 self.pg1.remote_addr[addr_type],
141 self.pg1.remote_addr[addr_type],
142 0,
143 priority=10,
144 policy=e.IPSEC_API_SPD_ACTION_PROTECT,
145 is_outbound=0))
146 objs.append(VppIpsecSpdEntry(self, self.tun_spd, scapy_tun_sa_id,
147 self.pg1.remote_addr[addr_type],
148 self.pg1.remote_addr[addr_type],
149 remote_tun_if_host, remote_tun_if_host,
150 0,
151 policy=e.IPSEC_API_SPD_ACTION_PROTECT,
152 priority=10))
153 objs.append(VppIpsecSpdEntry(self, self.tun_spd, vpp_tun_sa_id,
154 remote_tun_if_host, remote_tun_if_host,
155 self.pg0.local_addr[addr_type],
156 self.pg0.local_addr[addr_type],
157 0,
158 priority=20,
159 policy=e.IPSEC_API_SPD_ACTION_PROTECT,
160 is_outbound=0))
161 objs.append(VppIpsecSpdEntry(self, self.tun_spd, scapy_tun_sa_id,
162 self.pg0.local_addr[addr_type],
163 self.pg0.local_addr[addr_type],
164 remote_tun_if_host, remote_tun_if_host,
165 0,
166 policy=e.IPSEC_API_SPD_ACTION_PROTECT,
167 priority=20))
168 for o in objs:
169 o.add_vpp_config()
170 self.net_objs = self.net_objs + objs
171
172 def config_esp_tra(self, params):
173 addr_type = params.addr_type
174 scapy_tra_sa_id = params.scapy_tra_sa_id
175 scapy_tra_spi = params.scapy_tra_spi
176 vpp_tra_sa_id = params.vpp_tra_sa_id
177 vpp_tra_spi = params.vpp_tra_spi
178 auth_algo_vpp_id = params.auth_algo_vpp_id
179 auth_key = params.auth_key
180 crypt_algo_vpp_id = params.crypt_algo_vpp_id
181 crypt_key = params.crypt_key
182 addr_any = params.addr_any
183 addr_bcast = params.addr_bcast
184 flags = (VppEnum.vl_api_ipsec_sad_flags_t.
185 IPSEC_API_SAD_FLAG_USE_ANTI_REPLAY)
186 e = VppEnum.vl_api_ipsec_spd_action_t
187 flags = params.flags | flags
188 objs = []
189
190 params.tra_sa_in = VppIpsecSA(self, scapy_tra_sa_id, scapy_tra_spi,
191 auth_algo_vpp_id, auth_key,
192 crypt_algo_vpp_id, crypt_key,
193 self.vpp_esp_protocol,
194 flags=flags)
195 params.tra_sa_out = VppIpsecSA(self, vpp_tra_sa_id, vpp_tra_spi,
196 auth_algo_vpp_id, auth_key,
197 crypt_algo_vpp_id, crypt_key,
198 self.vpp_esp_protocol,
199 flags=flags)
200 objs.append(params.tra_sa_in)
201 objs.append(params.tra_sa_out)
202
203 objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id,
204 addr_any, addr_bcast,
205 addr_any, addr_bcast,
206 socket.IPPROTO_ESP))
207 objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id,
208 addr_any, addr_bcast,
209 addr_any, addr_bcast,
210 socket.IPPROTO_ESP,
211 is_outbound=0))
212 objs.append(VppIpsecSpdEntry(self, self.tra_spd, vpp_tra_sa_id,
213 self.tra_if.local_addr[addr_type],
214 self.tra_if.local_addr[addr_type],
215 self.tra_if.remote_addr[addr_type],
216 self.tra_if.remote_addr[addr_type],
217 0, priority=10,
218 policy=e.IPSEC_API_SPD_ACTION_PROTECT,
219 is_outbound=0))
220 objs.append(VppIpsecSpdEntry(self, self.tra_spd, scapy_tra_sa_id,
221 self.tra_if.local_addr[addr_type],
222 self.tra_if.local_addr[addr_type],
223 self.tra_if.remote_addr[addr_type],
224 self.tra_if.remote_addr[addr_type],
225 0, policy=e.IPSEC_API_SPD_ACTION_PROTECT,
226 priority=10))
227 for o in objs:
228 o.add_vpp_config()
229 self.net_objs = self.net_objs + objs
Neale Ranns53f526b2019-02-25 14:32:02 +0000230
231
Neale Ranns4f33c802019-04-10 12:39:10 +0000232class TemplateIpsecEsp(ConfigIpsecESP):
“mystarrocks”23f0c452017-12-11 07:11:51 -0800233 """
234 Basic test for ipsec esp sanity - tunnel and transport modes.
235
236 Below 4 cases are covered as part of this test
237 1) ipsec esp v4 transport basic test - IPv4 Transport mode
Paul Vinciguerra8feeaff2019-03-27 11:25:48 -0700238 scenario using HMAC-SHA1-96 integrity algo
“mystarrocks”23f0c452017-12-11 07:11:51 -0800239 2) ipsec esp v4 transport burst test
240 Above test for 257 pkts
241 3) ipsec esp 4o4 tunnel basic test - IPv4 Tunnel mode
Paul Vinciguerra8feeaff2019-03-27 11:25:48 -0700242 scenario using HMAC-SHA1-96 integrity algo
“mystarrocks”23f0c452017-12-11 07:11:51 -0800243 4) ipsec esp 4o4 tunnel burst test
244 Above test for 257 pkts
245
246 TRANSPORT MODE:
247
248 --- encrypt ---
249 |pg2| <-------> |VPP|
250 --- decrypt ---
251
252 TUNNEL MODE:
253
254 --- encrypt --- plain ---
Klement Sekera4b089f22018-04-17 18:04:57 +0200255 |pg0| <------- |VPP| <------ |pg1|
“mystarrocks”23f0c452017-12-11 07:11:51 -0800256 --- --- ---
257
258 --- decrypt --- plain ---
Klement Sekera4b089f22018-04-17 18:04:57 +0200259 |pg0| -------> |VPP| ------> |pg1|
“mystarrocks”23f0c452017-12-11 07:11:51 -0800260 --- --- ---
“mystarrocks”23f0c452017-12-11 07:11:51 -0800261 """
262
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -0700263 @classmethod
264 def setUpClass(cls):
265 super(TemplateIpsecEsp, cls).setUpClass()
266
267 @classmethod
268 def tearDownClass(cls):
269 super(TemplateIpsecEsp, cls).tearDownClass()
270
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800271 def setUp(self):
272 super(TemplateIpsecEsp, self).setUp()
Neale Ranns4f33c802019-04-10 12:39:10 +0000273 self.config_network(self.params.values())
Klement Sekera611864f2018-09-26 11:19:00 +0200274
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800275 def tearDown(self):
Neale Ranns4f33c802019-04-10 12:39:10 +0000276 self.unconfig_network()
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800277 super(TemplateIpsecEsp, self).tearDown()
Neale Ranns8e4a89b2019-01-23 08:16:17 -0800278
Klement Sekera611864f2018-09-26 11:19:00 +0200279
Neale Ranns53f526b2019-02-25 14:32:02 +0000280class TestIpsecEsp1(TemplateIpsecEsp, IpsecTra46Tests, IpsecTun46Tests):
Klement Sekera31da2e32018-06-24 22:49:55 +0200281 """ Ipsec ESP - TUN & TRA tests """
Neale Ranns4f33c802019-04-10 12:39:10 +0000282 pass
“mystarrocks”23f0c452017-12-11 07:11:51 -0800283
“mystarrocks”23f0c452017-12-11 07:11:51 -0800284
Klement Sekera31da2e32018-06-24 22:49:55 +0200285class TestIpsecEsp2(TemplateIpsecEsp, IpsecTcpTests):
286 """ Ipsec ESP - TCP tests """
287 pass
“mystarrocks”23f0c452017-12-11 07:11:51 -0800288
289
Neale Ranns4f33c802019-04-10 12:39:10 +0000290class TemplateIpsecEspUdp(ConfigIpsecESP):
Neale Ranns53f526b2019-02-25 14:32:02 +0000291 """
292 UDP encapped ESP
293 """
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -0700294
295 @classmethod
296 def setUpClass(cls):
297 super(TemplateIpsecEspUdp, cls).setUpClass()
298
299 @classmethod
300 def tearDownClass(cls):
301 super(TemplateIpsecEspUdp, cls).tearDownClass()
302
Neale Ranns53f526b2019-02-25 14:32:02 +0000303 def setUp(self):
304 super(TemplateIpsecEspUdp, self).setUp()
Neale Ranns4f33c802019-04-10 12:39:10 +0000305 self.net_objs = []
Neale Ranns53f526b2019-02-25 14:32:02 +0000306 self.tun_if = self.pg0
307 self.tra_if = self.pg2
308 self.logger.info(self.vapi.ppcli("show int addr"))
309
310 p = self.ipv4_params
311 p.flags = (VppEnum.vl_api_ipsec_sad_flags_t.
312 IPSEC_API_SAD_FLAG_UDP_ENCAP)
313 p.nat_header = UDP(sport=5454, dport=4500)
314
315 self.tra_spd = VppIpsecSpd(self, self.tra_spd_id)
316 self.tra_spd.add_vpp_config()
317 VppIpsecSpdItfBinding(self, self.tra_spd,
318 self.tra_if).add_vpp_config()
319
Neale Ranns4f33c802019-04-10 12:39:10 +0000320 self.config_esp_tra(p)
Neale Ranns2ac885c2019-03-20 18:24:43 +0000321 config_tra_params(p, self.encryption_type)
Neale Ranns53f526b2019-02-25 14:32:02 +0000322
323 self.tun_spd = VppIpsecSpd(self, self.tun_spd_id)
324 self.tun_spd.add_vpp_config()
325 VppIpsecSpdItfBinding(self, self.tun_spd,
326 self.tun_if).add_vpp_config()
327
Neale Ranns4f33c802019-04-10 12:39:10 +0000328 self.config_esp_tun(p)
Neale Ranns92e93842019-04-08 07:36:50 +0000329 self.logger.info(self.vapi.ppcli("show ipsec all"))
Neale Ranns53f526b2019-02-25 14:32:02 +0000330
331 d = DpoProto.DPO_PROTO_IP4
332 VppIpRoute(self, p.remote_tun_if_host, p.addr_len,
333 [VppRoutePath(self.tun_if.remote_addr[p.addr_type],
334 0xffffffff,
335 proto=d)]).add_vpp_config()
336
337 def tearDown(self):
338 super(TemplateIpsecEspUdp, self).tearDown()
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700339
340 def show_commands_at_teardown(self):
341 self.logger.info(self.vapi.cli("show hardware"))
Neale Ranns53f526b2019-02-25 14:32:02 +0000342
343
Neale Ranns49e7ef62019-04-10 17:24:29 +0000344class TestIpsecEspUdp(TemplateIpsecEspUdp, IpsecTra4Tests):
Neale Ranns53f526b2019-02-25 14:32:02 +0000345 """ Ipsec NAT-T ESP UDP tests """
Neale Ranns53f526b2019-02-25 14:32:02 +0000346 pass
347
348
Neale Ranns4f33c802019-04-10 12:39:10 +0000349class TestIpsecEspAll(ConfigIpsecESP,
350 IpsecTra4, IpsecTra6,
351 IpsecTun4, IpsecTun6):
352 """ Ipsec ESP all Algos """
353
354 def setUp(self):
355 super(TestIpsecEspAll, self).setUp()
356
357 def tearDown(self):
358 super(TestIpsecEspAll, self).tearDown()
359
360 def test_crypto_algs(self):
Neale Ranns47feb112019-04-11 15:14:07 +0000361 """All engines AES-[CBC, GCM]-[128, 192, 256] w/ & w/o ESN"""
Neale Ranns4f33c802019-04-10 12:39:10 +0000362
363 # foreach VPP crypto engine
Neale Ranns92e93842019-04-08 07:36:50 +0000364 engines = ["ia32", "ipsecmb", "openssl"]
Neale Ranns4f33c802019-04-10 12:39:10 +0000365
366 # foreach crypto algorithm
Neale Ranns47feb112019-04-11 15:14:07 +0000367 algos = [{'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
368 IPSEC_API_CRYPTO_ALG_AES_GCM_128),
369 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
370 IPSEC_API_INTEG_ALG_NONE),
371 'scapy-crypto': "AES-GCM",
372 'scapy-integ': "NULL",
373 'key': "JPjyOWBeVEQiMe7h",
374 'salt': struct.pack("!L", 0)},
375 {'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
376 IPSEC_API_CRYPTO_ALG_AES_GCM_256),
377 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
378 IPSEC_API_INTEG_ALG_NONE),
379 'scapy-crypto': "AES-GCM",
380 'scapy-integ': "NULL",
381 'key': "JPjyOWBeVEQiMe7h0123456787654321",
382 'salt': struct.pack("!L", 0)},
383 {'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
384 IPSEC_API_CRYPTO_ALG_AES_CBC_128),
385 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
386 IPSEC_API_INTEG_ALG_SHA1_96),
387 'scapy-crypto': "AES-CBC",
388 'scapy-integ': "HMAC-SHA1-96",
389 'salt': '',
Neale Ranns4f33c802019-04-10 12:39:10 +0000390 'key': "JPjyOWBeVEQiMe7h"},
Neale Ranns47feb112019-04-11 15:14:07 +0000391 {'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
392 IPSEC_API_CRYPTO_ALG_AES_CBC_192),
393 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
394 IPSEC_API_INTEG_ALG_SHA1_96),
395 'scapy-crypto': "AES-CBC",
396 'scapy-integ': "HMAC-SHA1-96",
397 'salt': '',
Neale Ranns4f33c802019-04-10 12:39:10 +0000398 'key': "JPjyOWBeVEQiMe7hJPjyOWBe"},
Neale Ranns47feb112019-04-11 15:14:07 +0000399 {'vpp-crypto': (VppEnum.vl_api_ipsec_crypto_alg_t.
400 IPSEC_API_CRYPTO_ALG_AES_CBC_256),
401 'vpp-integ': (VppEnum.vl_api_ipsec_integ_alg_t.
402 IPSEC_API_INTEG_ALG_SHA1_96),
403 'scapy-crypto': "AES-CBC",
404 'scapy-integ': "HMAC-SHA1-96",
405 'salt': '',
Neale Ranns4f33c802019-04-10 12:39:10 +0000406 'key': "JPjyOWBeVEQiMe7hJPjyOWBeVEQiMe7h"}]
407
Neale Ranns49e7ef62019-04-10 17:24:29 +0000408 # with and without ESN
409 flags = [0,
410 VppEnum.vl_api_ipsec_sad_flags_t.IPSEC_API_SAD_FLAG_USE_ESN]
Neale Ranns4f33c802019-04-10 12:39:10 +0000411
412 #
413 # loop through the VPP engines
414 #
415 for engine in engines:
Neale Ranns21ada3b2019-04-11 08:18:34 +0000416 self.vapi.cli("set crypto handler all %s" % engine)
Neale Ranns4f33c802019-04-10 12:39:10 +0000417
418 #
419 # loop through each of the algorithms
420 #
421 for algo in algos:
422 # with self.subTest(algo=algo['scapy']):
423 for flag in flags:
424 #
425 # setup up the config paramters
426 #
427 self.ipv4_params = IPsecIPv4Params()
428 self.ipv6_params = IPsecIPv6Params()
429
430 self.params = {self.ipv4_params.addr_type:
431 self.ipv4_params,
432 self.ipv6_params.addr_type:
433 self.ipv6_params}
434
435 for _, p in self.params.items():
Neale Ranns47feb112019-04-11 15:14:07 +0000436 p.auth_algo_vpp_id = algo['vpp-integ']
437 p.crypt_algo_vpp_id = algo['vpp-crypto']
438 p.crypt_algo = algo['scapy-crypto']
439 p.auth_algo = algo['scapy-integ']
Neale Ranns4f33c802019-04-10 12:39:10 +0000440 p.crypt_key = algo['key']
Neale Ranns47feb112019-04-11 15:14:07 +0000441 p.crypt_salt = algo['salt']
Neale Ranns4f33c802019-04-10 12:39:10 +0000442 p.flags = p.flags | flag
443
444 #
445 # configure the SPDs. SAs, etc
446 #
447 self.config_network(self.params.values())
448
449 #
450 # run some traffic.
451 # An exhautsive 4o6, 6o4 is not necessary
452 # for each algo
453 #
454 self.verify_tra_basic6(count=17)
455 self.verify_tra_basic4(count=17)
Neale Ranns47feb112019-04-11 15:14:07 +0000456 self.verify_tun_66(self.params[socket.AF_INET6], 17)
457 self.verify_tun_44(self.params[socket.AF_INET], 17)
Neale Ranns4f33c802019-04-10 12:39:10 +0000458
459 #
460 # remove the SPDs, SAs, etc
461 #
462 self.unconfig_network()
463
464
“mystarrocks”23f0c452017-12-11 07:11:51 -0800465if __name__ == '__main__':
466 unittest.main(testRunner=VppTestRunner)