tdl-xoa-driver 1.4.0__py3-none-any.whl → 1.5.0b1__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.
Files changed (46) hide show
  1. {tdl_xoa_driver-1.4.0.dist-info → tdl_xoa_driver-1.5.0b1.dist-info}/METADATA +2 -2
  2. {tdl_xoa_driver-1.4.0.dist-info → tdl_xoa_driver-1.5.0b1.dist-info}/RECORD +45 -33
  3. xoa_driver/__init__.py +2 -2
  4. xoa_driver/enums.py +2 -0
  5. xoa_driver/exceptions.py +2 -0
  6. xoa_driver/functions/anlt.py +2 -0
  7. xoa_driver/functions/anlt_ll_debug.py +2 -0
  8. xoa_driver/functions/cli/__init__.py +21 -0
  9. xoa_driver/functions/cli/_cli_manager.py +541 -0
  10. xoa_driver/functions/cli/_config_block.py +334 -0
  11. xoa_driver/functions/cli/_socket_driver.py +111 -0
  12. xoa_driver/functions/cli/port_config.py +107 -0
  13. xoa_driver/functions/cli/test_case_config.py +172 -0
  14. xoa_driver/functions/cmis/__init__.py +8 -0
  15. xoa_driver/functions/cmis/_constants.py +25 -0
  16. xoa_driver/functions/cmis/_replies.py +600 -0
  17. xoa_driver/functions/cmis/_utils.py +49 -0
  18. xoa_driver/functions/cmis/cdb.py +1266 -0
  19. xoa_driver/functions/exceptions.py +2 -0
  20. xoa_driver/functions/headers.py +2 -0
  21. xoa_driver/functions/mgmt.py +42 -19
  22. xoa_driver/functions/tools.py +9 -3
  23. xoa_driver/hlfuncs.py +6 -2
  24. xoa_driver/internals/commands/c_commands.py +6 -10
  25. xoa_driver/internals/commands/enums.py +25 -1
  26. xoa_driver/internals/commands/pr_commands.py +17 -16
  27. xoa_driver/internals/commands/px_commands.py +54 -54
  28. xoa_driver/internals/core/transporter/logger/__state_on_user.py +1 -1
  29. xoa_driver/internals/exceptions/modules.py +4 -3
  30. xoa_driver/internals/hli/modules/modules_l23/family_edun.py +82 -0
  31. xoa_driver/internals/hli/modules/modules_l23/family_g.py +1 -1
  32. xoa_driver/internals/hli/modules/modules_l23/family_l1.py +19 -0
  33. xoa_driver/internals/hli/ports/port_l23/family_edun.py +82 -0
  34. xoa_driver/internals/hli/ports/port_l23/family_l1.py +6 -0
  35. xoa_driver/internals/state_storage/modules_state.py +20 -0
  36. xoa_driver/internals/state_storage/testers_state.py +10 -0
  37. xoa_driver/lli.py +1 -0
  38. xoa_driver/misc.py +1 -0
  39. xoa_driver/modules.py +22 -0
  40. xoa_driver/ports.py +22 -0
  41. xoa_driver/testers.py +2 -0
  42. xoa_driver/utils.py +2 -0
  43. xoa_driver/functions/cli.py +0 -581
  44. {tdl_xoa_driver-1.4.0.dist-info → tdl_xoa_driver-1.5.0b1.dist-info}/WHEEL +0 -0
  45. {tdl_xoa_driver-1.4.0.dist-info → tdl_xoa_driver-1.5.0b1.dist-info}/licenses/LICENSE +0 -0
  46. {tdl_xoa_driver-1.4.0.dist-info → tdl_xoa_driver-1.5.0b1.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,5 @@
1
+ """The exception high-level function module."""
2
+
1
3
  from __future__ import annotations
2
4
 
3
5
  from xoa_driver.ports import GenericAnyPort
@@ -1,3 +1,5 @@
1
+ """The packet headers high-level function module."""
2
+
1
3
  from ipaddress import IPv4Address, IPv6Address
2
4
  from binascii import hexlify
3
5
  from xoa_driver.misc import Hex
@@ -1,13 +1,23 @@
1
+ """
2
+ The resource management high-level function module,
3
+ including testers, modules, ports, and streams.
4
+ """
5
+
1
6
  from __future__ import annotations
2
7
  import asyncio
3
- import typing as t
8
+ from typing import (
9
+ TYPE_CHECKING,
10
+ Any,
11
+ Union,
12
+ )
4
13
  from xoa_driver import enums, testers
5
14
  from xoa_driver.utils import apply
6
- from xoa_driver.internals.hli.ports.port_l23.family_l import FamilyL
7
- from xoa_driver.internals.hli.ports.port_l23.family_l1 import FamilyFreya
8
- from xoa_driver.ports import GenericAnyPort, GenericL23Port
9
- from xoa_driver.modules import GenericAnyModule, GenericL23Module, ModuleChimera, Z800FreyaModule
10
- from xoa_driver.testers import GenericAnyTester, L23Tester
15
+ if TYPE_CHECKING:
16
+ from xoa_driver.internals.hli.ports.port_l23.family_l import FamilyL
17
+ from xoa_driver.internals.hli.ports.port_l23.family_l1 import FamilyFreya
18
+ from xoa_driver.ports import GenericAnyPort, GenericL23Port
19
+ from xoa_driver.modules import GenericAnyModule, GenericL23Module, ModuleChimera, Z800FreyaModule, Z1600EdunModule
20
+ from xoa_driver.testers import GenericAnyTester, L23Tester
11
21
  from .exceptions import (
12
22
  NotSupportMedia,
13
23
  NotSupportPortSpeed,
@@ -18,10 +28,6 @@ from itertools import chain # type: ignore[Pylance false warning]
18
28
  from datetime import datetime
19
29
  import json
20
30
 
21
- PcsPmaSupported = (FamilyL, FamilyFreya)
22
- AutoNegSupported = (FamilyL, FamilyFreya)
23
- LinkTrainingSupported = FamilyL
24
-
25
31
 
26
32
  # region Testers
27
33
  async def reserve_tester(tester: GenericAnyTester, force: bool = True) -> None:
@@ -150,14 +156,14 @@ async def release_module(
150
156
 
151
157
  def get_module_supported_media(
152
158
  module: GenericL23Module | ModuleChimera,
153
- ) -> list[dict[str, t.Any]]:
159
+ ) -> list[dict[str, Any]]:
154
160
  """
155
161
  Get a list of supported media, port speed and count of the module.
156
162
 
157
163
  :param module: The module object
158
164
  :type module: GenericAnyModule
159
165
  :return: List of supported media, port speed and count
160
- :rtype: list[dict[str, t.Any]]
166
+ :rtype: list[dict[str, Any]]
161
167
  """
162
168
  supported_media_list = []
163
169
  item = {}
@@ -174,7 +180,7 @@ def get_module_supported_media(
174
180
 
175
181
 
176
182
  async def set_module_media_config(
177
- module: t.Union[GenericL23Module, ModuleChimera],
183
+ module: Union[GenericL23Module, ModuleChimera],
178
184
  media: enums.MediaConfigurationType,
179
185
  force: bool = True,
180
186
  ) -> None:
@@ -210,7 +216,7 @@ async def set_module_media_config(
210
216
 
211
217
 
212
218
  async def set_module_port_config(
213
- module: t.Union[GenericL23Module, ModuleChimera],
219
+ module: Union[GenericL23Module, ModuleChimera],
214
220
  port_count: int,
215
221
  port_speed: int,
216
222
  force: bool = True,
@@ -219,7 +225,7 @@ async def set_module_port_config(
219
225
  Set module's port-speed configuration
220
226
 
221
227
  :param module: The module object
222
- :type module: t.Union[GenericL23Module, ModuleChimera]
228
+ :type module: Union[GenericL23Module, ModuleChimera]
223
229
  :param port_count: The port count
224
230
  :type port_count: int
225
231
  :param port_speed: The port speed in Mbps, e.g. 40000 for 40G
@@ -258,7 +264,7 @@ async def set_module_port_config(
258
264
 
259
265
 
260
266
  async def set_module_config(
261
- module: t.Union[GenericL23Module, ModuleChimera],
267
+ module: Union[GenericL23Module, ModuleChimera],
262
268
  media: enums.MediaConfigurationType,
263
269
  port_count: int,
264
270
  port_speed: int,
@@ -267,7 +273,7 @@ async def set_module_config(
267
273
  """Change the module configuration to the target media, port count and port speed.
268
274
 
269
275
  :param module: the module object
270
- :type module: t.Union[GenericL23Module, ModuleChimera]
276
+ :type module: Union[GenericL23Module, ModuleChimera]
271
277
  :param media: the target media for the module
272
278
  :type media: enums.MediaConfigurationType
273
279
  :param port_count: the target port count
@@ -332,12 +338,13 @@ async def get_module_eol_days(module: GenericAnyModule) -> int:
332
338
  return timedelta.days
333
339
 
334
340
 
335
- async def get_module_cage_insertion_count(module: Z800FreyaModule, cage_index: int) -> int:
341
+ from xoa_driver.modules import GenericAnyModule, GenericL23Module, ModuleChimera, Z800FreyaModule, Z1600EdunModule
342
+ async def get_module_cage_insertion_count(module: Union[Z800FreyaModule, Z1600EdunModule], cage_index: int) -> int:
336
343
  """
337
344
  Get module cage insertion count
338
345
 
339
346
  :param module: The Z800 Freya module object
340
- :type module: Z800FreyaModule
347
+ :type module: Union[Z800FreyaModule, Z1600EdunModule]
341
348
  :param cage_index: The cage index
342
349
  :type module: int
343
350
  :return: Insertion count of the cage
@@ -355,6 +362,22 @@ async def get_module_cage_insertion_count(module: Z800FreyaModule, cage_index: i
355
362
  return result
356
363
 
357
364
 
365
+ async def get_module_cage_count(module: Union[Z800FreyaModule, Z1600EdunModule]) -> int:
366
+ """
367
+ Get module cage count
368
+
369
+ :param module: The Z800 Freya module object
370
+ :type module: Union[Z800FreyaModule, Z1600EdunModule]
371
+ :return: The number of cages in the module
372
+ :rtype: int
373
+ """
374
+ resp = await module.health.cage_insertion.get()
375
+ info_js = resp.info
376
+ info_dict = json.loads(info_js)
377
+ result = len(info_dict['1']['data'])
378
+ return result
379
+
380
+
358
381
  # endregion
359
382
 
360
383
 
@@ -1,14 +1,20 @@
1
1
  from __future__ import annotations
2
- from typing import Any
2
+ from typing import (
3
+ TYPE_CHECKING,
4
+ Any,
5
+ )
6
+
7
+ if TYPE_CHECKING:
8
+ from xoa_driver.ports import GenericAnyPort
3
9
 
4
- from xoa_driver.ports import GenericAnyPort
5
10
  from xoa_driver.internals.core import interfaces as itf
6
11
  from xoa_driver.lli import commands
7
12
  from xoa_driver import enums
8
13
 
9
14
 
10
15
  def get_ctx(port: GenericAnyPort) -> tuple["itf.IConnection", int, int]:
11
- return (port._conn, *port.kind)
16
+ module_id, port_id = port.kind # Explicitly unpack to two ints
17
+ return (port._conn, module_id, port_id)
12
18
 
13
19
 
14
20
  def dictionize_autoneg_status(
xoa_driver/hlfuncs.py CHANGED
@@ -1,11 +1,14 @@
1
1
  #: High-level functions
2
+ """High-level functions."""
3
+
2
4
  from xoa_driver.functions import (
3
5
  anlt,
4
- cli,
6
+ cli as config_io,
5
7
  mgmt,
6
8
  anlt_ll_debug,
7
9
  exceptions,
8
10
  headers,
11
+ cmis,
9
12
  )
10
13
 
11
14
  __all__ = (
@@ -13,6 +16,7 @@ __all__ = (
13
16
  "mgmt",
14
17
  "anlt_ll_debug",
15
18
  "exceptions",
16
- "cli",
19
+ "config_io",
17
20
  "headers",
21
+ "cmis",
18
22
  )
@@ -23,7 +23,8 @@ from xoa_driver.internals.core.transporter.protocol.payload import (
23
23
  XmpMacAddress,
24
24
  XmpSequence,
25
25
  XmpStr,
26
- Hex
26
+ Hex,
27
+ XmpJson,
27
28
  )
28
29
  from .enums import (
29
30
  ReservedStatus,
@@ -1239,7 +1240,7 @@ class C_WATCHDOG:
1239
1240
  @dataclass
1240
1241
  class C_DEBUGCMD:
1241
1242
  """
1242
- Chassis debug command
1243
+ Chassis debug command for internal use only.
1243
1244
  """
1244
1245
 
1245
1246
  code: typing.ClassVar[int] = 37
@@ -1249,16 +1250,11 @@ class C_DEBUGCMD:
1249
1250
  _cmd_xindex: int
1250
1251
 
1251
1252
  class GetDataAttr(ResponseBodyStruct):
1252
- data: typing.List[int] = field(XmpSequence(types_chunk=[XmpInt()]))
1253
-
1254
- class SetDataAttr(RequestBodyStruct):
1255
- data: typing.List[int] = field(XmpSequence(types_chunk=[XmpInt()]))
1253
+ data: dict = field(XmpJson(min_len=2))
1256
1254
 
1257
1255
  def get(self) -> Token[GetDataAttr]:
1258
1256
  return Token(self._connection, build_get_request(self, indices=[self._cmd_xindex]))
1259
1257
 
1260
- def set(self, data: typing.List[int]) -> Token[None]:
1261
- return Token(self._connection, build_set_request(self, indices=[self._cmd_xindex], data=data))
1262
1258
 
1263
1259
 
1264
1260
  @register_command
@@ -2028,8 +2024,8 @@ class C_MODEL_NUMBER:
2028
2024
  _connection: 'interfaces.IConnection'
2029
2025
 
2030
2026
  class GetDataAttr(ResponseBodyStruct):
2031
- number: ChassisModelNumber = field(XmpInt())
2032
- """ChassisModelNumber, the model of the Xena tester"""
2027
+ number: str = field(XmpStr())
2028
+ """str, the model of the Xena tester"""
2033
2029
 
2034
2030
  def get(self) -> Token[GetDataAttr]:
2035
2031
  """Get the Xena chassis model number.
@@ -1069,6 +1069,18 @@ class MediaConfigurationType(IntEnum):
1069
1069
  QSFP28_NRZ_ANLT = 123
1070
1070
  """QSFP28, 25G serdes, L1/ANLT"""
1071
1071
 
1072
+ SMPX_112 = 124
1073
+ """SMPX 112Gbps serdes"""
1074
+
1075
+ SMPX_224 = 125
1076
+ """SMPX 224Gbps serdes"""
1077
+
1078
+ OSFP_1600 = 126
1079
+ """OSFP 1.6T"""
1080
+
1081
+ OSFP_1600_ANLT = 127
1082
+ """OSFP 1.6T, L1/ANLT"""
1083
+
1072
1084
  UNKNOWN = 255
1073
1085
 
1074
1086
 
@@ -3165,7 +3177,13 @@ class ChassisModelName(IntEnum):
3165
3177
  Z_800_Q_A_C_FREYA = 16
3166
3178
  Z_800_O_A_C_FREYA = 17
3167
3179
  E_100_Q_C_CHIMERA = 18
3168
-
3180
+ Z_100_Q_X_C_LOKI = 19
3181
+ Z_400_Q_X_C_THOR = 20
3182
+ Z_800_Q_X_C_FREYA = 21
3183
+ Z_1604_S_C_EDUN = 22
3184
+ Z_1608_O_C_EDUN = 23
3185
+ B_6400 = 24
3186
+
3169
3187
  class ModuleModelName(IntEnum):
3170
3188
  NA = 0
3171
3189
  Z_01_T_ODIN = 1
@@ -3180,6 +3198,12 @@ class ModuleModelName(IntEnum):
3180
3198
  Z_800_Q_FREYA = 10
3181
3199
  Z_800_O_FREYA = 11
3182
3200
  E_100_Q_CHIMERA = 12
3201
+ Z_100_Q_X_LOKI = 13
3202
+ Z_400_Q_X_THOR = 14
3203
+ Z_800_Q_X_FREYA = 15
3204
+ Z_1604_S_EDUN = 16
3205
+ Z_1608_O_EDUN = 17
3206
+ Z_1616_O_EDUN = 18
3183
3207
 
3184
3208
  class ModuleConfigStatus(IntEnum):
3185
3209
  UNKNOWN = 0
@@ -284,21 +284,21 @@ class PR_TPLDERRORS:
284
284
  class GetDataAttr(ResponseBodyStruct):
285
285
  dummy: int = field(XmpLong())
286
286
  """long integer, not in use."""
287
- non_incre_seq_event_count: int = field(XmpLong())
288
- """long integer, number of non-incrementing-sequence-number events."""
289
- swapped_seq_misorder_event_count: int = field(XmpLong())
290
- """long integer, number of swapped-sequence-number misorder events."""
291
- non_incre_payload_packet_count: int = field(XmpLong())
292
- """long integer, number of packets with non-incrementing payload content."""
287
+ packet_loss_by_seq: int = field(XmpLong())
288
+ """long integer, Number of packet loss calculated by detecting gaps in received sequence numbers from test payload, where each missing number indicates a lost packet."""
289
+ misorder_by_seq: int = field(XmpLong())
290
+ """long integer, Number of misordered packets calculated by detecting packets that arrive with a sequence number lower than the highest seen so far, indicating out-of-order delivery."""
291
+ payload_err_packets: int = field(XmpLong())
292
+ """long integer, Number of packets with payload integrity errors."""
293
293
 
294
294
  def get(self) -> Token[GetDataAttr]:
295
295
  """Get statistics concerning errors in the packets with a particular test payload id received on a port.
296
296
 
297
297
  :return:
298
298
  dummy value not in use,
299
- number of non-incrementing-sequence-number events,
300
- number of swapped-sequence-number misorder events,
301
- number of packets with non-incrementing payload content
299
+ Number of packet loss by sequence number,
300
+ Number of misordered packets by sequence number,
301
+ Number of packets with payload integrity errors.
302
302
 
303
303
  :rtype: PR_TPLDERRORS.GetDataAttr
304
304
  """
@@ -532,12 +532,13 @@ class PR_TOTALEXT:
532
532
  packet_count_since_cleared: int = field(XmpLong())
533
533
  """long integer, number of packets received since statistics were cleared."""
534
534
  fcs_error_count: int = field(XmpLong())
535
-
535
+ """long integer, number of Rx packets with a bad FCS."""
536
536
  oversize_count: int = field(XmpLong())
537
-
537
+ """long integer, number of oversize packets (>1518 bytes) received since last clear (-1 if this counter is not supported by the tester)."""
538
538
  undersize_count: int = field(XmpLong())
539
-
539
+ """long integer, number of undersize packets (<64 bytes) received since last clear (-1 if this counter is not supported by the tester)."""
540
540
  jabber_count: int = field(XmpLong())
541
+ """long integer, number of jabber packets (oversized with a bad FCS) received since last clear (-1 if this counter is not supported by the tester)."""
541
542
 
542
543
  def get(self) -> Token[GetDataAttr]:
543
544
  """Get statistics concerning all the packets received on a port.
@@ -548,10 +549,10 @@ class PR_TOTALEXT:
548
549
  number of packets received in the last second,
549
550
  number of bytes received since statistics were cleared,
550
551
  number of packets received since statistics were cleared,
551
- number of packets received with fcs error frames,
552
- number of oversize packets received since last clear (-1 if this counter is not supported by the tester),
553
- number of undersize packets received since last clear (-1 if this counter is not supported by the tester),
554
- number of jabber packets received since last clear (-1 if this counter is not supported by the tester).
552
+ number of packets received with a bad FCS,
553
+ number of oversize packets (>1518 bytes) received since last clear (-1 if this counter is not supported by the tester),
554
+ number of undersize packets (<64 bytes) received since last clear (-1 if this counter is not supported by the tester),
555
+ number of jabber packets (oversized with a bad FCS) received since last clear (-1 if this counter is not supported by the tester).
555
556
 
556
557
  :rtype: PR_TOTALEXT.GetDataAttr
557
558
  """