forked from opencis/opencis-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_cxl_component_switch_connection_manager.py
614 lines (519 loc) · 21.6 KB
/
test_cxl_component_switch_connection_manager.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
"""
Copyright (c) 2024, Eeum, Inc.
This software is licensed under the terms of the Revised BSD License.
See LICENSE for details.
"""
from asyncio import gather, create_task
import pytest
from opencxl.util.logger import logger
from opencxl.cxl.component.switch_connection_manager import (
SwitchConnectionManager,
CxlConnection,
)
from opencxl.cxl.component.switch_connection_client import (
SwitchConnectionClient,
INJECTED_ERRORS,
)
from opencxl.cxl.component.cxl_component import (
PortConfig,
PORT_TYPE,
)
from opencxl.cxl.component.common import CXL_COMPONENT_TYPE
from opencxl.util.pci import create_bdf
from opencxl.cxl.transport.transaction import (
CxlIoCfgRdPacket,
CxlIoCfgWrPacket,
CxlIoMemRdPacket,
CxlIoMemWrPacket,
CxlIoCompletionWithDataPacket,
CxlMemMemRdPacket,
CxlMemMemWrPacket,
CxlMemMemDataPacket,
CxlMemBIRspPacket,
CxlMemBISnpPacket,
CxlMemCmpPacket,
CXL_IO_CPL_STATUS,
CXL_MEM_M2SBIRSP_OPCODE,
CXL_MEM_S2MBISNP_OPCODE,
)
BASE_TEST_PORT = 9100
def test_switch_connection_manager_check_ports():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_1
manager = SwitchConnectionManager(port_configs, port=port)
for port in range(len(port_configs)):
connection = manager.get_cxl_connection(port)
assert isinstance(connection, CxlConnection)
with pytest.raises(Exception):
manager.get_cxl_connection(len(port_configs))
@pytest.mark.asyncio
async def test_switch_connection_manager_run_and_stop():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_2
manager = SwitchConnectionManager(port_configs, port=port)
async def wait_and_stop():
await manager.wait_for_ready()
await manager.stop()
tasks = [create_task(wait_and_stop()), create_task(manager.run())]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_run_and_run():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_3
manager = SwitchConnectionManager(port_configs, port=port)
async def wait_and_run():
await manager.wait_for_ready()
with pytest.raises(Exception, match="Cannot run when it is not stopped"):
await manager.run()
await manager.stop()
tasks = [create_task(manager.run()), create_task(wait_and_run())]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_stop_before_run():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_4
manager = SwitchConnectionManager(port_configs, port=port)
with pytest.raises(Exception, match="Cannot stop when it is not running"):
await manager.stop()
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_connection():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_5
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(stop()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_connection_oob():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_6
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=4, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
with pytest.raises(Exception, match="Connection rejected"):
await client.run()
await manager.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_connection_after_connection():
# pylint: disable=protected-access
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_7
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
with pytest.raises(Exception, match="Connection rejected"):
await client._connect()
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(stop()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_connection_errors():
# pylint: disable=function-redefined
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_8
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def wait_and_connect():
await manager.wait_for_ready()
with pytest.raises(Exception, match="Connection rejected"):
client.inject_error(INJECTED_ERRORS.NON_SIDEBAND)
await client.run()
with pytest.raises(Exception, match="Connection rejected"):
client.inject_error(INJECTED_ERRORS.NON_CONNNECTION_REQUEST)
await client.run()
await manager.stop()
tasks = [create_task(start()), create_task(wait_and_connect())]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_cfg_packet():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_9
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def send_packets_and_stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
logger.info("[PyTest] Sending config space request packets from client")
client_connection = client.get_cxl_connection()
packet = CxlIoCfgWrPacket.create(create_bdf(0, 0, 0), 0x10, 4, 0xDEADBEEF)
await client_connection.cfg_fifo.host_to_target.put(packet)
packet = CxlIoCfgRdPacket.create(create_bdf(0, 0, 0), 0x10, 4)
await client_connection.cfg_fifo.host_to_target.put(packet)
logger.info("[PyTest] Checking config space request packets received from server")
server_connection = manager.get_cxl_connection(0)
await server_connection.cfg_fifo.host_to_target.get()
await server_connection.cfg_fifo.host_to_target.get()
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(send_packets_and_stop()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_mmio_packet():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_10
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def send_packets_and_stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
logger.info("[PyTest] Sending MMIO request packets from client")
client_connection = client.get_cxl_connection()
packet = CxlIoMemWrPacket.create(0, 4, 0)
await client_connection.mmio_fifo.host_to_target.put(packet)
packet = CxlIoMemRdPacket.create(0, 4)
await client_connection.mmio_fifo.host_to_target.put(packet)
logger.info("[PyTest] Checking MMIO request packets received from server")
server_connection = manager.get_cxl_connection(0)
await server_connection.mmio_fifo.host_to_target.get()
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(send_packets_and_stop()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_cxl_mem_packet_m2s():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_11
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def send_packets_and_stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
logger.info("[PyTest] Sending CXL.mem request packets from client")
client_connection = client.get_cxl_connection()
packet = CxlMemMemWrPacket.create(0x80, 0xDEADBEEF)
await client_connection.cxl_mem_fifo.host_to_target.put(packet)
packet = CxlMemMemRdPacket.create(0x80)
await client_connection.cxl_mem_fifo.host_to_target.put(packet)
packet = CxlMemBIRspPacket.create(CXL_MEM_M2SBIRSP_OPCODE.BIRSP_E, 0, 0)
await client_connection.cxl_mem_fifo.host_to_target.put(packet)
logger.info("[PyTest] Checking CXL.mem request packets received from server")
server_connection = manager.get_cxl_connection(0)
await server_connection.cxl_mem_fifo.host_to_target.get()
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(send_packets_and_stop()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_cfg_completion():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_12
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def send_packets_and_stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
logger.info("[PyTest] Sending config space completion packets from server")
server_connection = manager.get_cxl_connection(0)
client_connection = client.get_cxl_connection()
req_id = 0x10
tag = 0xA5
req1 = CxlIoCfgWrPacket.create(0, 0x10, 4, 0xDEADBEEF, req_id=req_id, tag=tag)
await client_connection.cfg_fifo.host_to_target.put(req1)
tag = 0xA6
req2 = CxlIoCfgRdPacket.create(0, 0x10, 4, req_id=req_id, tag=tag)
await client_connection.cfg_fifo.host_to_target.put(req2)
cpl2 = CxlIoCompletionWithDataPacket.create(req_id, tag, CXL_IO_CPL_STATUS.SC, 0xDEADBEEF)
await server_connection.cfg_fifo.target_to_host.put(cpl2)
logger.info("[PyTest] Checking config space completion packets received from client")
rcvd_packets = []
rcvd_packets.append(await client_connection.cfg_fifo.host_to_target.get())
rcvd_packets.append(await client_connection.cfg_fifo.host_to_target.get())
rcvd_packets.append(await server_connection.cfg_fifo.target_to_host.get())
assert bytes(rcvd_packets[0]) == bytes(req1)
assert bytes(rcvd_packets[1]) == bytes(req2)
assert bytes(rcvd_packets[2]) == bytes(cpl2)
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(send_packets_and_stop()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_mmio_completion():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_13
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def send_packets_and_stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
logger.info("[PyTest] Sending MMIO completion packets from server")
server_connection = manager.get_cxl_connection(0)
client_connection = client.get_cxl_connection()
req_id = 0x10
tag = 0x1
req1 = CxlIoMemWrPacket.create(0x10, 4, 0xDEADBEEF, req_id=req_id, tag=tag)
await client_connection.mmio_fifo.host_to_target.put(req1)
tag = 0x2
req2 = CxlIoMemRdPacket.create(0x10, 4, req_id=req_id, tag=tag)
await client_connection.mmio_fifo.host_to_target.put(req2)
cpl2 = CxlIoCompletionWithDataPacket.create(req_id, tag, data=0)
await server_connection.mmio_fifo.target_to_host.put(cpl2)
logger.info("[PyTest] Checking MMIO completion packets received from client")
rcvd_packets = []
rcvd_packets.append(await client_connection.mmio_fifo.host_to_target.get()) # wr
rcvd_packets.append(await client_connection.mmio_fifo.host_to_target.get()) # rd
rcvd_packets.append(await server_connection.mmio_fifo.target_to_host.get()) # cpld
assert bytes(rcvd_packets[0]) == bytes(req1)
assert bytes(rcvd_packets[1]) == bytes(req2)
assert bytes(rcvd_packets[2]) == bytes(cpl2)
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(send_packets_and_stop()),
]
await gather(*tasks)
@pytest.mark.asyncio
async def test_switch_connection_manager_handle_cxl_mem_s2m():
port_configs = [
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.USP),
PortConfig(PORT_TYPE.DSP),
PortConfig(PORT_TYPE.DSP),
]
port = BASE_TEST_PORT + pytest.PORT.TEST_14
manager = SwitchConnectionManager(port_configs, port=port)
client = SwitchConnectionClient(
port_index=0, component_type=CXL_COMPONENT_TYPE.R, retry=False, port=port
)
async def start():
logger.info("[PyTest] Starting SwitchConnectionManager")
await manager.run()
async def wait_and_connect():
await manager.wait_for_ready()
logger.info("[PyTest] SwitchConnectionManager is ready")
logger.info("[PyTest] Starting SwitchConnectionClient")
await client.run()
async def send_packets_and_stop():
await client.wait_for_ready()
logger.info("[PyTest] SwitchConnectionClient is ready")
logger.info("[PyTest] Sending CXL.mem completion packets from server")
server_connection = manager.get_cxl_connection(0)
sent_packet1 = CxlMemMemDataPacket.create(0xDEADBEEF)
await server_connection.cxl_mem_fifo.target_to_host.put(sent_packet1)
sent_packet2 = CxlMemCmpPacket.create()
await server_connection.cxl_mem_fifo.target_to_host.put(sent_packet2)
sent_packet3 = CxlMemBISnpPacket.create(0x0, CXL_MEM_S2MBISNP_OPCODE.BISNP_DATA)
await server_connection.cxl_mem_fifo.target_to_host.put(sent_packet3)
logger.info("[PyTest] Checking CXL.mem completion packets received from client")
client_connection = client.get_cxl_connection()
received_packet1 = await client_connection.cxl_mem_fifo.target_to_host.get()
assert bytes(received_packet1) == bytes(sent_packet1)
received_packet2 = await client_connection.cxl_mem_fifo.target_to_host.get()
assert bytes(received_packet2) == bytes(sent_packet2)
received_packet3 = await client_connection.cxl_mem_fifo.target_to_host.get()
assert bytes(received_packet3) == bytes(sent_packet3)
logger.info("[PyTest] Stopping SwitchConnectionManager")
await manager.stop()
logger.info("[PyTest] Stopping SwitchConnectionClient")
await client.stop()
tasks = [
create_task(start()),
create_task(wait_and_connect()),
create_task(send_packets_and_stop()),
]
await gather(*tasks)