tdl-xoa-driver 1.5.0b2__py3-none-any.whl → 1.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tdl_xoa_driver-1.5.0b2.dist-info → tdl_xoa_driver-1.6.0.dist-info}/METADATA +8 -8
- {tdl_xoa_driver-1.5.0b2.dist-info → tdl_xoa_driver-1.6.0.dist-info}/RECORD +91 -89
- xoa_driver/__init__.py +2 -2
- xoa_driver/enums.py +10 -10
- xoa_driver/functions/anlt.py +60 -78
- xoa_driver/functions/cli/__init__.py +5 -5
- xoa_driver/functions/cli/port_config.py +16 -7
- xoa_driver/functions/cli/{test_case_config.py → testbed_config.py} +53 -46
- xoa_driver/functions/cmis/_replies.py +4 -4
- xoa_driver/functions/mgmt.py +206 -250
- xoa_driver/functions/tools.py +11 -6
- xoa_driver/internals/commands/c_commands.py +59 -0
- xoa_driver/internals/commands/enums.py +101 -90
- xoa_driver/internals/commands/m4_commands.py +25 -0
- xoa_driver/internals/commands/m4e_commands.py +6 -0
- xoa_driver/internals/commands/m_commands.py +51 -1
- xoa_driver/internals/commands/p4_commands.py +63 -1
- xoa_driver/internals/commands/p4e_commands.py +9 -0
- xoa_driver/internals/commands/p4g_commands.py +139 -0
- xoa_driver/internals/commands/p_commands.py +493 -63
- xoa_driver/internals/commands/pc_commands.py +9 -0
- xoa_driver/internals/commands/pd_commands.py +11 -0
- xoa_driver/internals/commands/pe_commands.py +27 -0
- xoa_driver/internals/commands/pec_commands.py +9 -0
- xoa_driver/internals/commands/ped_commands.py +23 -0
- xoa_driver/internals/commands/pef_commands.py +43 -0
- xoa_driver/internals/commands/pf_commands.py +11 -0
- xoa_driver/internals/commands/pl1_commands.py +442 -118
- xoa_driver/internals/commands/pl_commands.py +8 -0
- xoa_driver/internals/commands/pm_commands.py +11 -0
- xoa_driver/internals/commands/pp_commands.py +128 -82
- xoa_driver/internals/commands/pr_commands.py +25 -0
- xoa_driver/internals/commands/ps_commands.py +47 -1
- xoa_driver/internals/commands/pt_commands.py +15 -0
- xoa_driver/internals/commands/px_commands.py +180 -136
- xoa_driver/internals/commands/subtypes.py +4 -3
- xoa_driver/internals/core/transporter/protocol/payload/base_struct.py +1 -1
- xoa_driver/internals/hli/indices/macsecscs/base_macsecsc.py +41 -3
- xoa_driver/internals/hli/modules/modules_l23/family_combi.py +0 -64
- xoa_driver/internals/hli/modules/modules_l23/family_edun.py +0 -2
- xoa_driver/internals/hli/modules/modules_l23/{family_g.py → family_loki.py} +29 -1
- xoa_driver/internals/hli/modules/modules_l23/family_odin.py +412 -0
- xoa_driver/internals/hli/modules/modules_l23/{family_l.py → family_thor.py} +44 -0
- xoa_driver/internals/hli/ports/port_l23/chimera/port_chimera.py +3 -3
- xoa_driver/internals/hli/ports/port_l23/family_edun.py +9 -44
- xoa_driver/internals/hli/ports/port_l23/{family_l1.py → family_freya.py} +10 -45
- xoa_driver/internals/hli/ports/port_l23/{family_g.py → family_loki.py} +33 -32
- xoa_driver/internals/hli/ports/port_l23/family_odin.py +225 -0
- xoa_driver/internals/hli/ports/port_l23/family_thor.py +67 -0
- xoa_driver/internals/hli/ports/port_l23/layer1/anlt.py +512 -0
- xoa_driver/internals/hli/ports/port_l23/layer1/brr.py +26 -0
- xoa_driver/internals/hli/ports/port_l23/layer1/eye_diagram.py +71 -0
- xoa_driver/internals/hli/ports/port_l23/{pcs_pma_ijkl_chimera.py → layer1/impair.py} +7 -7
- xoa_driver/internals/hli/ports/port_l23/layer1/laser_power.py +28 -0
- xoa_driver/internals/hli/ports/port_l23/{family_e.py → layer1/lower_power.py} +1 -51
- xoa_driver/internals/hli/ports/port_l23/{freya_l1.py → layer1/medium.py} +38 -358
- xoa_driver/internals/hli/ports/port_l23/layer1/pcs_fec.py +219 -0
- xoa_driver/internals/hli/ports/port_l23/layer1/pma.py +43 -0
- xoa_driver/internals/hli/ports/port_l23/layer1/prbs.py +39 -0
- xoa_driver/internals/hli/ports/port_l23/layer1/preamble.py +25 -0
- xoa_driver/internals/hli/ports/port_l23/{fault_jkl.py → layer1/rs_fault.py} +2 -2
- xoa_driver/internals/hli/ports/port_l23/layer1/siv.py +69 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_edun.py +103 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_freya.py +103 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_loki.py +74 -0
- xoa_driver/internals/hli/ports/port_l23/layer1_thor.py +70 -0
- xoa_driver/internals/hli/ports/port_l23/port_l23ve.py +4 -4
- xoa_driver/internals/hli/ports/port_l23/sec/__init__.py +0 -0
- xoa_driver/internals/hli/ports/port_l23/sec/macsec.py +108 -0
- xoa_driver/internals/hli/ports/port_l23/tcvr/__init__.py +0 -0
- xoa_driver/internals/hli/ports/port_l23/{bases/port_transceiver.py → tcvr/cmis.py} +4 -118
- xoa_driver/internals/hli/ports/port_l23/tcvr/transceiver.py +124 -0
- xoa_driver/internals/hli/ports/port_l23/trafficgen/__init__.py +0 -0
- xoa_driver/internals/hli/ports/port_l23/{bases → trafficgen}/port_l23.py +1 -1
- xoa_driver/internals/hli/ports/port_l23/{bases → trafficgen}/port_l23_genuine.py +5 -45
- xoa_driver/internals/hli/ports/port_l23/{bases/port_reception_statistics.py → trafficgen/port_rx_stats.py} +0 -21
- xoa_driver/internals/hli/ports/port_l23/{bases/port_transmission_statistics.py → trafficgen/port_tx_stats.py} +2 -22
- xoa_driver/internals/hli/ports/port_l23/trafficgen/runt.py +32 -0
- xoa_driver/internals/hli/testers/l23_tester.py +1 -3
- xoa_driver/internals/utils/indices/_interfaces.py +18 -6
- xoa_driver/internals/utils/indices/index_manager.py +8 -2
- xoa_driver/internals/utils/managers/ports_manager.py +5 -2
- xoa_driver/misc.py +6 -6
- xoa_driver/modules.py +31 -47
- xoa_driver/ports.py +10 -29
- xoa_driver/internals/hli/modules/modules_l23/family_d.py +0 -75
- xoa_driver/internals/hli/modules/modules_l23/family_e.py +0 -85
- xoa_driver/internals/hli/modules/modules_l23/family_f.py +0 -145
- xoa_driver/internals/hli/modules/modules_l23/family_h.py +0 -40
- xoa_driver/internals/hli/modules/modules_l23/family_i.py +0 -25
- xoa_driver/internals/hli/modules/modules_l23/family_j.py +0 -25
- xoa_driver/internals/hli/modules/modules_l23/family_k.py +0 -39
- xoa_driver/internals/hli/modules/modules_l23/family_m.py +0 -25
- xoa_driver/internals/hli/modules/modules_l23/family_n.py +0 -40
- xoa_driver/internals/hli/ports/port_l23/family_combi.py +0 -37
- xoa_driver/internals/hli/ports/port_l23/family_d.py +0 -51
- xoa_driver/internals/hli/ports/port_l23/family_f.py +0 -151
- xoa_driver/internals/hli/ports/port_l23/family_h.py +0 -67
- xoa_driver/internals/hli/ports/port_l23/family_i.py +0 -84
- xoa_driver/internals/hli/ports/port_l23/family_j.py +0 -68
- xoa_driver/internals/hli/ports/port_l23/family_k.py +0 -73
- xoa_driver/internals/hli/ports/port_l23/family_l.py +0 -82
- xoa_driver/internals/hli/ports/port_l23/family_m.py +0 -29
- xoa_driver/internals/hli/ports/port_l23/pcs_pma_ghijkl.py +0 -369
- xoa_driver/internals/hli/ports/port_l23/pcs_pma_l.py +0 -78
- {tdl_xoa_driver-1.5.0b2.dist-info → tdl_xoa_driver-1.6.0.dist-info}/WHEEL +0 -0
- {tdl_xoa_driver-1.5.0b2.dist-info → tdl_xoa_driver-1.6.0.dist-info}/licenses/LICENSE +0 -0
- {tdl_xoa_driver-1.5.0b2.dist-info → tdl_xoa_driver-1.6.0.dist-info}/top_level.txt +0 -0
- /xoa_driver/internals/hli/modules/modules_l23/{family_l1.py → family_freya.py} +0 -0
- /xoa_driver/internals/hli/ports/port_l23/{bases → layer1}/__init__.py +0 -0
- /xoa_driver/internals/hli/ports/port_l23/{bases → trafficgen}/port_capture.py +0 -0
xoa_driver/functions/anlt.py
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"""The anlt high-level function module."""
|
|
2
|
-
|
|
3
2
|
from __future__ import annotations
|
|
4
3
|
from dataclasses import dataclass, field
|
|
5
|
-
|
|
4
|
+
from typing import (
|
|
5
|
+
TYPE_CHECKING,
|
|
6
|
+
Union,
|
|
7
|
+
Any,
|
|
8
|
+
Generator,
|
|
9
|
+
List,
|
|
10
|
+
)
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from xoa_driver.ports import Z800FreyaPort
|
|
6
13
|
from xoa_driver import enums
|
|
7
14
|
from xoa_driver.utils import apply
|
|
8
|
-
from xoa_driver.internals.hli.ports.port_l23.family_l import FamilyL
|
|
9
|
-
from xoa_driver.internals.hli.ports.port_l23.family_l1 import FamilyFreya
|
|
10
|
-
from xoa_driver.ports import GenericL23Port
|
|
11
15
|
from xoa_driver.lli import commands
|
|
12
16
|
from xoa_driver.internals.core import interfaces as itf
|
|
13
17
|
from xoa_driver.misc import Token
|
|
@@ -23,14 +27,9 @@ from .tools import (
|
|
|
23
27
|
)
|
|
24
28
|
import asyncio
|
|
25
29
|
|
|
26
|
-
PcsPmaSupported = (FamilyL, FamilyFreya)
|
|
27
|
-
AutoNegSupported = (FamilyL, FamilyFreya)
|
|
28
|
-
LinkTrainingSupported = FamilyL
|
|
29
|
-
|
|
30
|
-
|
|
31
30
|
@dataclass
|
|
32
31
|
class DoAnlt:
|
|
33
|
-
port:
|
|
32
|
+
port: "Z800FreyaPort"
|
|
34
33
|
"""port object"""
|
|
35
34
|
should_do_an: bool
|
|
36
35
|
"""should the port do autoneg?"""
|
|
@@ -117,7 +116,7 @@ class DoAnlt:
|
|
|
117
116
|
|
|
118
117
|
return _an_mode, _lt_mode, _timeout_mode
|
|
119
118
|
|
|
120
|
-
def __builder__(self) ->
|
|
119
|
+
def __builder__(self) -> Generator[Token, None, None]:
|
|
121
120
|
"""Defining commands sequence"""
|
|
122
121
|
|
|
123
122
|
# # Set autoneg timeout
|
|
@@ -169,7 +168,7 @@ class DoAnlt:
|
|
|
169
168
|
|
|
170
169
|
|
|
171
170
|
async def anlt_start(
|
|
172
|
-
port:
|
|
171
|
+
port: "Z800FreyaPort",
|
|
173
172
|
should_do_an: bool,
|
|
174
173
|
should_do_lt: bool,
|
|
175
174
|
an_allow_loopback: bool,
|
|
@@ -180,12 +179,10 @@ async def anlt_start(
|
|
|
180
179
|
should_enable_lt_timeout: bool,
|
|
181
180
|
) -> None:
|
|
182
181
|
"""
|
|
183
|
-
.. versionchanged:: 2.5
|
|
184
|
-
|
|
185
182
|
Start ANLT on a port
|
|
186
183
|
|
|
187
184
|
:param port: the port object
|
|
188
|
-
:type port: :class:`~xoa_driver.ports.
|
|
185
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
189
186
|
:param should_do_an: should the port do autoneg?
|
|
190
187
|
:type should_do_an: bool
|
|
191
188
|
:param should_do_lt: should the port do link training?
|
|
@@ -218,14 +215,12 @@ async def anlt_start(
|
|
|
218
215
|
await anlt.run()
|
|
219
216
|
|
|
220
217
|
|
|
221
|
-
async def autoneg_status(port:
|
|
218
|
+
async def autoneg_status(port: "Z800FreyaPort") -> dict[str, Any]:
|
|
222
219
|
"""
|
|
223
|
-
.. versionchanged:: 2.5
|
|
224
|
-
|
|
225
220
|
Get the auto-negotiation status
|
|
226
221
|
|
|
227
222
|
:param port: the port object
|
|
228
|
-
:type port: :class:`~xoa_driver.ports.
|
|
223
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
229
224
|
:return:
|
|
230
225
|
:rtype: typing.Dict[str, typing.Any]
|
|
231
226
|
"""
|
|
@@ -240,7 +235,7 @@ async def autoneg_status(port: GenericL23Port) -> dict[str, t.Any]:
|
|
|
240
235
|
return dictionize_autoneg_status(loopback, auto_neg_info, status)
|
|
241
236
|
|
|
242
237
|
|
|
243
|
-
LinkTrainType =
|
|
238
|
+
LinkTrainType = Union[
|
|
244
239
|
enums.LinkTrainCoeffs,
|
|
245
240
|
enums.LinkTrainPresets,
|
|
246
241
|
enums.LinkTrainEncoding,
|
|
@@ -249,7 +244,7 @@ LinkTrainType = t.Union[
|
|
|
249
244
|
|
|
250
245
|
|
|
251
246
|
async def __lt_coeff(
|
|
252
|
-
port:
|
|
247
|
+
port: "Z800FreyaPort",
|
|
253
248
|
serdes: int,
|
|
254
249
|
arg: LinkTrainType,
|
|
255
250
|
*,
|
|
@@ -268,7 +263,7 @@ async def __lt_coeff(
|
|
|
268
263
|
|
|
269
264
|
|
|
270
265
|
async def lt_coeff_inc(
|
|
271
|
-
port:
|
|
266
|
+
port: "Z800FreyaPort",
|
|
272
267
|
serdes: int,
|
|
273
268
|
emphasis: enums.LinkTrainCoeffs
|
|
274
269
|
) -> enums.LinkTrainCmdResults:
|
|
@@ -276,7 +271,7 @@ async def lt_coeff_inc(
|
|
|
276
271
|
Ask the remote port to increase coeff of the specified serdes.
|
|
277
272
|
|
|
278
273
|
:param port: the port object
|
|
279
|
-
:type port: :class:`~xoa_driver.ports.
|
|
274
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
280
275
|
:param serdes: the serdes index, starting from 0
|
|
281
276
|
:type serdes: int
|
|
282
277
|
:param emphasis: the emphasis to increase
|
|
@@ -288,7 +283,7 @@ async def lt_coeff_inc(
|
|
|
288
283
|
|
|
289
284
|
|
|
290
285
|
async def lt_coeff_dec(
|
|
291
|
-
port:
|
|
286
|
+
port: "Z800FreyaPort",
|
|
292
287
|
serdes: int,
|
|
293
288
|
emphasis: enums.LinkTrainCoeffs
|
|
294
289
|
) -> enums.LinkTrainCmdResults:
|
|
@@ -296,7 +291,7 @@ async def lt_coeff_dec(
|
|
|
296
291
|
Ask the remote port to decrease coeff of the specified serdes.
|
|
297
292
|
|
|
298
293
|
:param port: the port object
|
|
299
|
-
:type port: :class:`~xoa_driver.ports.
|
|
294
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
300
295
|
:param serdes: the serdes index, starting from 0
|
|
301
296
|
:type serdes: int
|
|
302
297
|
:param emphasis: the emphasis to decrease
|
|
@@ -308,7 +303,7 @@ async def lt_coeff_dec(
|
|
|
308
303
|
|
|
309
304
|
|
|
310
305
|
async def lt_coeff_no_eq(
|
|
311
|
-
port:
|
|
306
|
+
port: "Z800FreyaPort",
|
|
312
307
|
serdes: int,
|
|
313
308
|
emphasis: enums.LinkTrainCoeffs
|
|
314
309
|
) -> enums.LinkTrainCmdResults:
|
|
@@ -317,7 +312,7 @@ async def lt_coeff_no_eq(
|
|
|
317
312
|
Ask the remote port to set the coeff to NO_EQ on the specified serdes.
|
|
318
313
|
|
|
319
314
|
:param port: the port object
|
|
320
|
-
:type port: :class:`~xoa_driver.ports.
|
|
315
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
321
316
|
:param serdes: the serdes index, starting from 0
|
|
322
317
|
:type serdes: int
|
|
323
318
|
:param emphasis: the emphasis to set to NO_EQ
|
|
@@ -329,7 +324,7 @@ async def lt_coeff_no_eq(
|
|
|
329
324
|
|
|
330
325
|
|
|
331
326
|
async def lt_preset(
|
|
332
|
-
port:
|
|
327
|
+
port: "Z800FreyaPort",
|
|
333
328
|
serdes: int,
|
|
334
329
|
preset: enums.LinkTrainPresets
|
|
335
330
|
) -> enums.LinkTrainCmdResults:
|
|
@@ -337,7 +332,7 @@ async def lt_preset(
|
|
|
337
332
|
Ask the remote port to use the preset of the specified serdes.
|
|
338
333
|
|
|
339
334
|
:param port: the port object
|
|
340
|
-
:type port: :class:`~xoa_driver.ports.
|
|
335
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
341
336
|
:param serdes: the serdes index, starting from 0
|
|
342
337
|
:type serdes: int
|
|
343
338
|
:param preset: preset index to select for the serdes, 0,1,2,3,4,
|
|
@@ -349,7 +344,7 @@ async def lt_preset(
|
|
|
349
344
|
|
|
350
345
|
|
|
351
346
|
async def lt_encoding(
|
|
352
|
-
port:
|
|
347
|
+
port: "Z800FreyaPort",
|
|
353
348
|
serdes: int,
|
|
354
349
|
encoding: enums.LinkTrainEncoding
|
|
355
350
|
) -> enums.LinkTrainCmdResults:
|
|
@@ -357,7 +352,7 @@ async def lt_encoding(
|
|
|
357
352
|
Ask the remote port to use the encoding of the specified serdes.
|
|
358
353
|
|
|
359
354
|
:param port: the port object
|
|
360
|
-
:type port: :class:`~xoa_driver.ports.
|
|
355
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
361
356
|
:param serdes: the serdes index, starting from 0
|
|
362
357
|
:type serdes: int
|
|
363
358
|
:param encoding: link training encoding
|
|
@@ -368,12 +363,12 @@ async def lt_encoding(
|
|
|
368
363
|
return await __lt_coeff(port, serdes, encoding, cmd=enums.LinkTrainCmd.CMD_ENCODING)
|
|
369
364
|
|
|
370
365
|
|
|
371
|
-
async def lt_trained(port:
|
|
366
|
+
async def lt_trained(port: "Z800FreyaPort", serdes: int) -> enums.LinkTrainCmdResults:
|
|
372
367
|
"""
|
|
373
368
|
Tell the remote port that the current serdes is trained.
|
|
374
369
|
|
|
375
370
|
:param port: the port object
|
|
376
|
-
:type port: :class:`~xoa_driver.ports.
|
|
371
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
377
372
|
:param serdes: the serdes index, starting from 0
|
|
378
373
|
:type serdes: int
|
|
379
374
|
:return:
|
|
@@ -387,14 +382,12 @@ async def lt_trained(port: GenericL23Port, serdes: int) -> enums.LinkTrainCmdRes
|
|
|
387
382
|
)
|
|
388
383
|
|
|
389
384
|
|
|
390
|
-
async def lt_status(port:
|
|
385
|
+
async def lt_status(port: "Z800FreyaPort", serdes: int) -> dict[str, Any]:
|
|
391
386
|
"""
|
|
392
|
-
.. versionchanged:: 2.5
|
|
393
|
-
|
|
394
387
|
Show the link training status.
|
|
395
388
|
|
|
396
389
|
:param port: the port object
|
|
397
|
-
:type port: :class:`~xoa_driver.ports.
|
|
390
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
398
391
|
:param serdes: the serdes index, starting from 0
|
|
399
392
|
:type serdes: int
|
|
400
393
|
:return: LT status of the serdes
|
|
@@ -419,12 +412,12 @@ async def lt_status(port: GenericL23Port, serdes: int) -> dict[str, t.Any]:
|
|
|
419
412
|
)
|
|
420
413
|
|
|
421
414
|
|
|
422
|
-
async def txtap_get(port:
|
|
415
|
+
async def txtap_get(port: "Z800FreyaPort", serdes: int) -> dict[str, int]:
|
|
423
416
|
"""
|
|
424
417
|
Get the tap value of the local TX tap.
|
|
425
418
|
|
|
426
419
|
:param port: the port object
|
|
427
|
-
:type port: :class:`~xoa_driver.ports.
|
|
420
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
428
421
|
:param serdes: the serdes index, starting from 0
|
|
429
422
|
:type serdes: int
|
|
430
423
|
:return: tap values of the serdes
|
|
@@ -436,19 +429,19 @@ async def txtap_get(port: GenericL23Port, serdes: int) -> dict[str, int]:
|
|
|
436
429
|
|
|
437
430
|
|
|
438
431
|
async def txtap_set(
|
|
439
|
-
port:
|
|
432
|
+
port: "Z800FreyaPort",
|
|
440
433
|
serdes: int,
|
|
441
434
|
pre3: int,
|
|
442
435
|
pre2: int,
|
|
443
436
|
pre: int,
|
|
444
437
|
main: int,
|
|
445
|
-
|
|
438
|
+
post: int,
|
|
446
439
|
) -> None:
|
|
447
440
|
"""
|
|
448
441
|
Set the tap value of the local TX tap.
|
|
449
442
|
|
|
450
443
|
:param port: the port object
|
|
451
|
-
:type port: :class:`~xoa_driver.ports.
|
|
444
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
452
445
|
:param serdes: the serdes index, starting from 0
|
|
453
446
|
:type serdes: int
|
|
454
447
|
:param pre3: pre3 value
|
|
@@ -459,29 +452,22 @@ async def txtap_set(
|
|
|
459
452
|
:type pre: int
|
|
460
453
|
:param main: main value
|
|
461
454
|
:type main: int
|
|
462
|
-
:param
|
|
463
|
-
:type
|
|
455
|
+
:param post: post value
|
|
456
|
+
:type post: int
|
|
464
457
|
:return:
|
|
465
458
|
:rtype: None
|
|
466
459
|
"""
|
|
467
460
|
conn, mid, pid = get_ctx(port)
|
|
468
461
|
cmd_ = commands.PP_PHYTXEQ(conn, mid, pid, serdes)
|
|
469
|
-
await cmd_.set(
|
|
470
|
-
pre=pre,
|
|
471
|
-
main=main,
|
|
472
|
-
post=post1,
|
|
473
|
-
pre2=pre2,
|
|
474
|
-
pre3_post2=pre3,
|
|
475
|
-
post3=0,
|
|
476
|
-
)
|
|
462
|
+
await cmd_.set(tap_values=[pre, main, post, pre2, pre3])
|
|
477
463
|
|
|
478
464
|
|
|
479
|
-
async def anlt_link_recovery(port:
|
|
465
|
+
async def anlt_link_recovery(port: "Z800FreyaPort", restart_link_down: bool, restart_lt_failure: bool) -> None:
|
|
480
466
|
"""
|
|
481
467
|
This command manages the auto-restart features.
|
|
482
468
|
|
|
483
469
|
:param port: the port object
|
|
484
|
-
:type port: :class:`~xoa_driver.ports.
|
|
470
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
485
471
|
:param restart_link_down: enable AN+LT auto-restart when a link down condition is detected. A "link down" state signifies the loss of a valid input signal, which can occur due to events such as cable unplugging and re-plugging, TX disable, or link flap on the link partner's end. The auto-restart process will continue until the link is re-established. Please note that this setting is only effective when AN and/or LT are enabled.
|
|
486
472
|
:type restart_link_down: bool
|
|
487
473
|
:param restart_lt_failure: if LT is enabled and experiences a failure on either side, the port will initiate the AN+LT restart process repeatedly until LT succeeds. This functionality is only applicable when LT is enabled.
|
|
@@ -501,14 +487,12 @@ async def anlt_link_recovery(port: GenericL23Port, restart_link_down: bool, rest
|
|
|
501
487
|
await cmd_.set(values=[param])
|
|
502
488
|
|
|
503
489
|
|
|
504
|
-
async def anlt_status(port:
|
|
490
|
+
async def anlt_status(port: "Z800FreyaPort") -> dict[str, Any]:
|
|
505
491
|
"""
|
|
506
|
-
.. versionchanged:: 2.5
|
|
507
|
-
|
|
508
492
|
Get the overview of ANLT status
|
|
509
493
|
|
|
510
494
|
:param port: the port object
|
|
511
|
-
:type port: :class:`~xoa_driver.ports.
|
|
495
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
512
496
|
:return: AN/LT status of the port
|
|
513
497
|
:rtype: typing.Dict[str, typing.Any]
|
|
514
498
|
"""
|
|
@@ -529,12 +513,12 @@ async def anlt_status(port: GenericL23Port) -> dict[str, t.Any]:
|
|
|
529
513
|
return dictionize_anlt_status(_link_recovery, _anlt_op, _linktrain_cfg, _capabilities, _allow_loopback)
|
|
530
514
|
|
|
531
515
|
|
|
532
|
-
async def anlt_log(port:
|
|
516
|
+
async def anlt_log(port: "Z800FreyaPort") -> str:
|
|
533
517
|
"""
|
|
534
518
|
Get the anlt log messages
|
|
535
519
|
|
|
536
520
|
:param port: the port object
|
|
537
|
-
:type port: :class:`~xoa_driver.ports.
|
|
521
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
538
522
|
:return: AN/LT protocol log traces of the port
|
|
539
523
|
:rtype: str
|
|
540
524
|
"""
|
|
@@ -543,14 +527,12 @@ async def anlt_log(port: GenericL23Port) -> str:
|
|
|
543
527
|
return log.log_string
|
|
544
528
|
|
|
545
529
|
|
|
546
|
-
async def anlt_stop(port:
|
|
530
|
+
async def anlt_stop(port: "Z800FreyaPort") -> None:
|
|
547
531
|
"""
|
|
548
|
-
.. versionchanged:: 2.5
|
|
549
|
-
|
|
550
532
|
Stop AN & LT
|
|
551
533
|
|
|
552
534
|
:param port: the port object
|
|
553
|
-
:type port: :class:`~xoa_driver.ports.
|
|
535
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
554
536
|
"""
|
|
555
537
|
conn, mid, pid = get_ctx(port)
|
|
556
538
|
|
|
@@ -560,12 +542,12 @@ async def anlt_stop(port: GenericL23Port) -> None:
|
|
|
560
542
|
)
|
|
561
543
|
|
|
562
544
|
|
|
563
|
-
async def txtap_autotune(port:
|
|
545
|
+
async def txtap_autotune(port: "Z800FreyaPort", serdes: int) -> None:
|
|
564
546
|
"""
|
|
565
547
|
Auto tune the tap value of the local TX tap.
|
|
566
548
|
|
|
567
549
|
:param port: the port object
|
|
568
|
-
:type port: :class:`~xoa_driver.ports.
|
|
550
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
569
551
|
:param serdes: the serdes index, starting from 0
|
|
570
552
|
:type serdes: int
|
|
571
553
|
:return:
|
|
@@ -577,12 +559,12 @@ async def txtap_autotune(port: GenericL23Port, serdes: int) -> None:
|
|
|
577
559
|
await phy_autotune.set(on_off=enums.OnOff.ON)
|
|
578
560
|
|
|
579
561
|
|
|
580
|
-
async def lt_im_status(port:
|
|
562
|
+
async def lt_im_status(port: "Z800FreyaPort") -> dict[str, Any]:
|
|
581
563
|
"""
|
|
582
564
|
Get LT initial modulation config
|
|
583
565
|
|
|
584
566
|
:param port: the port object
|
|
585
|
-
:type port: :class:`~xoa_driver.ports.
|
|
567
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
586
568
|
:return: LT initial modulation configuration of the port
|
|
587
569
|
:rtype: typing.Dict[str, typing.Any]
|
|
588
570
|
"""
|
|
@@ -599,12 +581,12 @@ async def lt_im_status(port: GenericL23Port) -> dict[str, t.Any]:
|
|
|
599
581
|
return dictionize_lt_im_status(capabilities, initial_mods)
|
|
600
582
|
|
|
601
583
|
|
|
602
|
-
async def lt_algorithm_status(port:
|
|
584
|
+
async def lt_algorithm_status(port: "Z800FreyaPort") -> dict[str, Any]:
|
|
603
585
|
"""
|
|
604
586
|
Get LT initial modulation config
|
|
605
587
|
|
|
606
588
|
:param port: the port object
|
|
607
|
-
:type port: :class:`~xoa_driver.ports.
|
|
589
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
608
590
|
:return: LT initial modulation configuration of the port
|
|
609
591
|
:rtype: typing.Dict[str, typing.Any]
|
|
610
592
|
"""
|
|
@@ -621,12 +603,12 @@ async def lt_algorithm_status(port: GenericL23Port) -> dict[str, t.Any]:
|
|
|
621
603
|
return dictionize_lt_algorithm_status(capabilities, algorithms)
|
|
622
604
|
|
|
623
605
|
|
|
624
|
-
async def anlt_strict(port:
|
|
606
|
+
async def anlt_strict(port: "Z800FreyaPort", enable: bool) -> None:
|
|
625
607
|
"""
|
|
626
608
|
Should ANLT strict mode be enabled
|
|
627
609
|
|
|
628
610
|
:param port: the port object
|
|
629
|
-
:type port: :class:`~xoa_driver.ports.
|
|
611
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
630
612
|
:param enable: should ANLT strict mode be enabled
|
|
631
613
|
:type enable: bool
|
|
632
614
|
:return:
|
|
@@ -645,14 +627,14 @@ async def anlt_strict(port: GenericL23Port, enable: bool) -> None:
|
|
|
645
627
|
).set(values=[param])
|
|
646
628
|
|
|
647
629
|
|
|
648
|
-
async def anlt_log_control(port:
|
|
630
|
+
async def anlt_log_control(port: "Z800FreyaPort", types: List[enums.AnLtLogControl]) -> None:
|
|
649
631
|
"""
|
|
650
632
|
Control what should be logged for ANLT by xenaserver
|
|
651
633
|
|
|
652
634
|
:param port: the port object
|
|
653
|
-
:type port: :class:`~xoa_driver.ports.
|
|
635
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
654
636
|
:param types: control what should be logged for ANLT by xenaserver
|
|
655
|
-
:type types:
|
|
637
|
+
:type types: List[enums.AnLtLogControl]
|
|
656
638
|
:return:
|
|
657
639
|
:rtype: None
|
|
658
640
|
"""
|
|
@@ -671,12 +653,12 @@ async def anlt_log_control(port: GenericL23Port, types: t.List[enums.AnLtLogCont
|
|
|
671
653
|
enums.Layer1ConfigType.ANLT_LOG_CONTROL
|
|
672
654
|
).set(values=[param])
|
|
673
655
|
|
|
674
|
-
async def anlt_log_control_get(port:
|
|
656
|
+
async def anlt_log_control_get(port: "Z800FreyaPort") -> dict[str, bool]:
|
|
675
657
|
"""
|
|
676
658
|
Get ANLT log control config
|
|
677
659
|
|
|
678
660
|
:param port: the port object
|
|
679
|
-
:type port: :class:`~xoa_driver.ports.
|
|
661
|
+
:type port: :class:`~xoa_driver.ports.Z800FreyaPort`
|
|
680
662
|
:return: dict of log control status
|
|
681
663
|
:rtype: dict[str, bool]
|
|
682
664
|
"""
|
|
@@ -6,16 +6,16 @@ from .port_config import (
|
|
|
6
6
|
load_port_config,
|
|
7
7
|
port_config_from_file,
|
|
8
8
|
)
|
|
9
|
-
from .
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
from .testbed_config import (
|
|
10
|
+
save_testbed_config,
|
|
11
|
+
load_testbed_config,
|
|
12
12
|
module_config_from_file,
|
|
13
13
|
)
|
|
14
14
|
__all__ = (
|
|
15
15
|
"save_port_config",
|
|
16
16
|
"load_port_config",
|
|
17
17
|
"port_config_from_file",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"save_testbed_config",
|
|
19
|
+
"load_testbed_config",
|
|
20
20
|
"module_config_from_file",
|
|
21
21
|
)
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
from xoa_driver import testers, ports
|
|
3
|
+
from typing import List, Tuple
|
|
3
4
|
from ._cli_manager import XOACLIManager
|
|
4
5
|
from ._config_block import *
|
|
5
6
|
|
|
6
7
|
async def save_port_config(tester: testers.L23Tester, port: ports.GenericL23Port, path: str, debug=False, halt_on_error=False) -> str:
|
|
7
|
-
"""Save
|
|
8
|
+
"""Save port config to the specified filepath
|
|
8
9
|
|
|
9
10
|
:param tester: Chassis object
|
|
10
11
|
:type tester: testers.L23Tester
|
|
@@ -52,8 +53,8 @@ async def save_port_config(tester: testers.L23Tester, port: ports.GenericL23Port
|
|
|
52
53
|
xpcfile.write(result)
|
|
53
54
|
return result
|
|
54
55
|
|
|
55
|
-
async def load_port_config(tester: testers.L23Tester, port: ports.GenericL23Port, path: str, debug=False, halt_on_error=False) ->
|
|
56
|
-
"""Load
|
|
56
|
+
async def load_port_config(tester: testers.L23Tester, port: ports.GenericL23Port, path: str, debug=False, halt_on_error=False) -> List[Tuple[str, str]]:
|
|
57
|
+
"""Load port config from the specified filepath
|
|
57
58
|
|
|
58
59
|
:param tester: Chassis object
|
|
59
60
|
:type tester: testers.L23Tester
|
|
@@ -61,6 +62,8 @@ async def load_port_config(tester: testers.L23Tester, port: ports.GenericL23Port
|
|
|
61
62
|
:type port: ports.GenericL23Port
|
|
62
63
|
:param load_path: File path to load the port configuration from
|
|
63
64
|
:type load_path: str
|
|
65
|
+
:return: List of tuples containing response and the corresponding command sent
|
|
66
|
+
:rtype: List[Tuple[str, str]]
|
|
64
67
|
"""
|
|
65
68
|
|
|
66
69
|
tester_ip = tester.info.host
|
|
@@ -77,8 +80,10 @@ async def load_port_config(tester: testers.L23Tester, port: ports.GenericL23Port
|
|
|
77
80
|
# Reserve the port before applying configuration
|
|
78
81
|
xm.reserve_port(port_index)
|
|
79
82
|
|
|
83
|
+
result: List[Tuple[str, str]] = []
|
|
84
|
+
|
|
80
85
|
# Read configuration from file
|
|
81
|
-
with open(path, 'r') as xpcfile:
|
|
86
|
+
with open(path, 'r', encoding='utf-8') as xpcfile:
|
|
82
87
|
config_data = xpcfile.read()
|
|
83
88
|
|
|
84
89
|
# Deserialize config block and send CLI commands
|
|
@@ -87,12 +92,14 @@ async def load_port_config(tester: testers.L23Tester, port: ports.GenericL23Port
|
|
|
87
92
|
cli_cmds = config_block.commands
|
|
88
93
|
for cmd in cli_cmds:
|
|
89
94
|
if cmd.strip(): # Ensure the command is not empty
|
|
90
|
-
xm.send(cmd=f"{port_index} {cmd}", sync_on=False)
|
|
95
|
+
resp = xm.send(cmd=f"{port_index} {cmd}", sync_on=False)
|
|
96
|
+
result.append((resp, f"{port_index} {cmd}"))
|
|
91
97
|
|
|
92
98
|
# Free the port after applying configuration
|
|
93
99
|
xm.free_port(port_index)
|
|
100
|
+
return result
|
|
94
101
|
|
|
95
|
-
async def port_config_from_file(tester: testers.L23Tester, port: ports.GenericL23Port, path: str, debug=False, halt_on_error=False) ->
|
|
102
|
+
async def port_config_from_file(tester: testers.L23Tester, port: ports.GenericL23Port, path: str, debug=False, halt_on_error=False) -> List[Tuple[str, str]]:
|
|
96
103
|
"""Load port configuration from the specifiied filepath. This function is a wrapper around load_port_config to provide backward compatibility.
|
|
97
104
|
|
|
98
105
|
:param tester: Chassis object
|
|
@@ -101,7 +108,9 @@ async def port_config_from_file(tester: testers.L23Tester, port: ports.GenericL2
|
|
|
101
108
|
:type port: ports.GenericL23Port
|
|
102
109
|
:param load_path: File path to load the port configuration from
|
|
103
110
|
:type load_path: str
|
|
111
|
+
:return: List of tuples containing response and command sent
|
|
112
|
+
:rtype: List[Tuple[str, str]]
|
|
104
113
|
"""
|
|
105
|
-
await load_port_config(tester, port, path, debug=debug, halt_on_error=halt_on_error)
|
|
114
|
+
return await load_port_config(tester, port, path, debug=debug, halt_on_error=halt_on_error)
|
|
106
115
|
|
|
107
116
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
from xoa_driver import testers, modules, ports
|
|
3
3
|
from ._cli_manager import XOACLIManager
|
|
4
|
-
from typing import List
|
|
4
|
+
from typing import List, Tuple
|
|
5
5
|
from ..mgmt import *
|
|
6
6
|
from ._config_block import *
|
|
7
7
|
|
|
8
|
-
async def
|
|
9
|
-
"""Save
|
|
8
|
+
async def save_testbed_config(tester: testers.L23Tester, ports: List[ports.GenericL23Port], path: str, testbed_name: str = "<testbed>", with_module_config: bool = True, debug=False, halt_on_error=False) -> str:
|
|
9
|
+
"""Save testbed configuration to the specifiied filepath
|
|
10
10
|
|
|
11
11
|
:param tester: Chassis object
|
|
12
12
|
:type tester: testers.L23Tester
|
|
@@ -95,8 +95,8 @@ async def save_test_case_config(tester: testers.L23Tester, ports: List[ports.Gen
|
|
|
95
95
|
|
|
96
96
|
return result
|
|
97
97
|
|
|
98
|
-
async def
|
|
99
|
-
"""Load
|
|
98
|
+
async def load_testbed_config(tester: testers.L23Tester, path: str, mode: str = "default", delay_after_module_config: int = 5, debug=False, halt_on_error=False) -> List[Tuple[str, str]]:
|
|
99
|
+
"""Load testbed configuration from the specifiied filepath
|
|
100
100
|
|
|
101
101
|
:param tester: Chassis object
|
|
102
102
|
:type tester: testers.L23Tester
|
|
@@ -106,6 +106,8 @@ async def load_test_case_config(tester: testers.L23Tester, path: str, mode: str
|
|
|
106
106
|
:type mode: str
|
|
107
107
|
:param delay_after_module_config: Delay in seconds after configuring each module to ensure proper configuration
|
|
108
108
|
:type delay_after_module_config: int
|
|
109
|
+
:return: List of tuples containing response and the corresponding command sent
|
|
110
|
+
:rtype: List[Tuple[str, str]]
|
|
109
111
|
"""
|
|
110
112
|
|
|
111
113
|
tester_ip = tester.info.host
|
|
@@ -118,50 +120,55 @@ async def load_test_case_config(tester: testers.L23Tester, path: str, mode: str
|
|
|
118
120
|
# Log on and set username
|
|
119
121
|
xm.logon_set_owner(tester_password)
|
|
120
122
|
|
|
123
|
+
result: List[Tuple[str, str]] = []
|
|
124
|
+
|
|
121
125
|
# Read configuration from file
|
|
122
126
|
with open(path, 'r') as xpcfile:
|
|
123
127
|
config_data = xpcfile.read()
|
|
124
128
|
|
|
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
|
-
|
|
129
|
+
# Parse the config data to configure modules and ports block by block
|
|
130
|
+
config_datas = config_data.split(f";\n")
|
|
131
|
+
for block in config_datas:
|
|
132
|
+
if config_block_type(config_block_str=block) == ConfigMetadataType.MODULE and mode in ["default", "module"]:
|
|
133
|
+
module_block = ConfigBlock()
|
|
134
|
+
module_block.config_block_str = block
|
|
135
|
+
module_index = module_block.module_id
|
|
136
|
+
|
|
137
|
+
# Free the module before applying configuration
|
|
138
|
+
module = tester.modules.obtain(int(module_index))
|
|
139
|
+
await release_modules([module], should_release_ports=True)
|
|
140
|
+
# Reserve the module before applying configuration
|
|
141
|
+
xm.reserve_module(module_index)
|
|
142
|
+
|
|
143
|
+
# Send each command to the tester
|
|
144
|
+
for cmd in module_block.commands:
|
|
145
|
+
if cmd.strip(): # Ensure the command is not empty
|
|
146
|
+
# print(f"Applying command: {module_index} {cmd}")
|
|
147
|
+
resp = xm.send(cmd=f"{module_index} {cmd}", sync_on=False)
|
|
148
|
+
result.append((resp, f"{module_index} {cmd}"))
|
|
149
|
+
# Free the module after applying configuration
|
|
150
|
+
xm.free_module(module_index)
|
|
151
|
+
await asyncio.sleep(delay_after_module_config) # Small delay to ensure proper module configuration
|
|
152
|
+
|
|
153
|
+
elif config_block_type(config_block_str=block) == ConfigMetadataType.PORT and mode in ["default", "port"]:
|
|
154
|
+
port_block = ConfigBlock()
|
|
155
|
+
port_block.config_block_str = block
|
|
156
|
+
port_index = port_block.port_id
|
|
157
|
+
|
|
158
|
+
# Reserve the port before applying configuration
|
|
159
|
+
xm.reserve_port(port_index)
|
|
160
|
+
|
|
161
|
+
# Send each command to the tester
|
|
162
|
+
for cmd in port_block.commands:
|
|
163
|
+
if cmd.strip(): # Ensure the command is not empty
|
|
164
|
+
# print(f"Applying command: {port_index} {cmd}")
|
|
165
|
+
resp = xm.send(cmd=f"{port_index} {cmd}", sync_on=False)
|
|
166
|
+
result.append((resp, f"{port_index} {cmd}"))
|
|
167
|
+
# Free the port after applying configuration
|
|
168
|
+
xm.free_port(port_index)
|
|
169
|
+
return result
|
|
170
|
+
|
|
171
|
+
async def module_config_from_file(tester: testers.L23Tester, path: str, debug=False, halt_on_error=False) -> List[Tuple[str, str]]:
|
|
165
172
|
"""Load module configuration from the specifiied filepath. This function is a wrapper around load_module_config to provide backward compatibility.
|
|
166
173
|
|
|
167
174
|
:param tester: Chassis object
|
|
@@ -169,4 +176,4 @@ async def module_config_from_file(tester: testers.L23Tester, path: str, debug=Fa
|
|
|
169
176
|
:param path: File path to load the module configuration from
|
|
170
177
|
:type path: str
|
|
171
178
|
"""
|
|
172
|
-
await
|
|
179
|
+
return await load_testbed_config(tester, path, mode="module", debug=debug, halt_on_error=halt_on_error)
|