tdl-xoa-driver 1.0.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.
Files changed (325) hide show
  1. tdl_xoa_driver-1.0.0.dist-info/LICENSE +202 -0
  2. tdl_xoa_driver-1.0.0.dist-info/METADATA +177 -0
  3. tdl_xoa_driver-1.0.0.dist-info/RECORD +325 -0
  4. tdl_xoa_driver-1.0.0.dist-info/WHEEL +5 -0
  5. tdl_xoa_driver-1.0.0.dist-info/top_level.txt +1 -0
  6. xoa_driver/__init__.py +2 -0
  7. xoa_driver/enums.py +399 -0
  8. xoa_driver/exceptions.py +77 -0
  9. xoa_driver/functions/__init__.py +0 -0
  10. xoa_driver/functions/anlt.py +744 -0
  11. xoa_driver/functions/anlt_ll_debug.py +429 -0
  12. xoa_driver/functions/cli.py +581 -0
  13. xoa_driver/functions/exceptions.py +72 -0
  14. xoa_driver/functions/headers.py +608 -0
  15. xoa_driver/functions/mgmt.py +515 -0
  16. xoa_driver/functions/tools.py +256 -0
  17. xoa_driver/hlfuncs.py +18 -0
  18. xoa_driver/internals/__init__.py +0 -0
  19. xoa_driver/internals/commands/__init__.py +31 -0
  20. xoa_driver/internals/commands/c_commands.py +2041 -0
  21. xoa_driver/internals/commands/enums.py +3289 -0
  22. xoa_driver/internals/commands/m4_commands.py +700 -0
  23. xoa_driver/internals/commands/m4e_commands.py +107 -0
  24. xoa_driver/internals/commands/m_commands.py +1875 -0
  25. xoa_driver/internals/commands/p4_commands.py +2221 -0
  26. xoa_driver/internals/commands/p4e_commands.py +160 -0
  27. xoa_driver/internals/commands/p4g_commands.py +7253 -0
  28. xoa_driver/internals/commands/p_commands.py +6000 -0
  29. xoa_driver/internals/commands/pc_commands.py +335 -0
  30. xoa_driver/internals/commands/pd_commands.py +355 -0
  31. xoa_driver/internals/commands/pe_commands.py +1018 -0
  32. xoa_driver/internals/commands/pec_commands.py +265 -0
  33. xoa_driver/internals/commands/ped_commands.py +1034 -0
  34. xoa_driver/internals/commands/pef_commands.py +2216 -0
  35. xoa_driver/internals/commands/pf_commands.py +379 -0
  36. xoa_driver/internals/commands/pl1_commands.py +1588 -0
  37. xoa_driver/internals/commands/pl_commands.py +178 -0
  38. xoa_driver/internals/commands/pm_commands.py +256 -0
  39. xoa_driver/internals/commands/pp_commands.py +2341 -0
  40. xoa_driver/internals/commands/pr_commands.py +812 -0
  41. xoa_driver/internals/commands/ps_commands.py +2311 -0
  42. xoa_driver/internals/commands/pt_commands.py +370 -0
  43. xoa_driver/internals/commands/px_commands.py +303 -0
  44. xoa_driver/internals/commands/subtypes.py +86 -0
  45. xoa_driver/internals/core/__init__.py +0 -0
  46. xoa_driver/internals/core/builders.py +39 -0
  47. xoa_driver/internals/core/exceptions.py +69 -0
  48. xoa_driver/internals/core/funcs.py +81 -0
  49. xoa_driver/internals/core/funcs.pyi +1072 -0
  50. xoa_driver/internals/core/interfaces.py +47 -0
  51. xoa_driver/internals/core/token.py +44 -0
  52. xoa_driver/internals/core/transporter/__init__.py +0 -0
  53. xoa_driver/internals/core/transporter/_processor.py +83 -0
  54. xoa_driver/internals/core/transporter/_publisher.py +101 -0
  55. xoa_driver/internals/core/transporter/_request_id_counter.py +28 -0
  56. xoa_driver/internals/core/transporter/_stream.py +99 -0
  57. xoa_driver/internals/core/transporter/_typings.py +43 -0
  58. xoa_driver/internals/core/transporter/exceptions.py +44 -0
  59. xoa_driver/internals/core/transporter/handler.py +127 -0
  60. xoa_driver/internals/core/transporter/logger/__init__.py +10 -0
  61. xoa_driver/internals/core/transporter/logger/__logger.py +94 -0
  62. xoa_driver/internals/core/transporter/logger/__state_off.py +32 -0
  63. xoa_driver/internals/core/transporter/logger/__state_on_default.py +70 -0
  64. xoa_driver/internals/core/transporter/logger/__state_on_loguru.py +51 -0
  65. xoa_driver/internals/core/transporter/logger/__state_on_user.py +48 -0
  66. xoa_driver/internals/core/transporter/protocol/__init__.py +0 -0
  67. xoa_driver/internals/core/transporter/protocol/_constants.py +77 -0
  68. xoa_driver/internals/core/transporter/protocol/_utils.py +59 -0
  69. xoa_driver/internals/core/transporter/protocol/exceptions.py +271 -0
  70. xoa_driver/internals/core/transporter/protocol/payload/__init__.py +70 -0
  71. xoa_driver/internals/core/transporter/protocol/payload/base_struct.py +283 -0
  72. xoa_driver/internals/core/transporter/protocol/payload/descriptor.py +119 -0
  73. xoa_driver/internals/core/transporter/protocol/payload/exceptions.py +20 -0
  74. xoa_driver/internals/core/transporter/protocol/payload/field.py +296 -0
  75. xoa_driver/internals/core/transporter/protocol/payload/types.py +173 -0
  76. xoa_driver/internals/core/transporter/protocol/payload/utils.py +53 -0
  77. xoa_driver/internals/core/transporter/protocol/struct_header.py +123 -0
  78. xoa_driver/internals/core/transporter/protocol/struct_request.py +65 -0
  79. xoa_driver/internals/core/transporter/protocol/struct_response.py +89 -0
  80. xoa_driver/internals/core/transporter/registry.py +43 -0
  81. xoa_driver/internals/exceptions/__init__.py +9 -0
  82. xoa_driver/internals/exceptions/modules.py +13 -0
  83. xoa_driver/internals/exceptions/testers.py +21 -0
  84. xoa_driver/internals/hli_v1/__init__.py +0 -0
  85. xoa_driver/internals/hli_v1/indices/__init__.py +0 -0
  86. xoa_driver/internals/hli_v1/indices/base_index.py +39 -0
  87. xoa_driver/internals/hli_v1/indices/connection_group/__init__.py +0 -0
  88. xoa_driver/internals/hli_v1/indices/connection_group/cg.py +186 -0
  89. xoa_driver/internals/hli_v1/indices/connection_group/histogram.py +78 -0
  90. xoa_driver/internals/hli_v1/indices/connection_group/l2.py +94 -0
  91. xoa_driver/internals/hli_v1/indices/connection_group/l3.py +130 -0
  92. xoa_driver/internals/hli_v1/indices/connection_group/raw.py +200 -0
  93. xoa_driver/internals/hli_v1/indices/connection_group/replay.py +109 -0
  94. xoa_driver/internals/hli_v1/indices/connection_group/tcp.py +314 -0
  95. xoa_driver/internals/hli_v1/indices/connection_group/tls.py +198 -0
  96. xoa_driver/internals/hli_v1/indices/connection_group/udp.py +133 -0
  97. xoa_driver/internals/hli_v1/indices/connection_group/user_state.py +28 -0
  98. xoa_driver/internals/hli_v1/indices/filter/__init__.py +0 -0
  99. xoa_driver/internals/hli_v1/indices/filter/base_filter.py +65 -0
  100. xoa_driver/internals/hli_v1/indices/filter/genuine_filter.py +20 -0
  101. xoa_driver/internals/hli_v1/indices/length_term.py +49 -0
  102. xoa_driver/internals/hli_v1/indices/macsecscs/__init__.py +0 -0
  103. xoa_driver/internals/hli_v1/indices/macsecscs/base_macsecsc.py +224 -0
  104. xoa_driver/internals/hli_v1/indices/macsecscs/genuine_macsecsc.py +72 -0
  105. xoa_driver/internals/hli_v1/indices/match_term.py +64 -0
  106. xoa_driver/internals/hli_v1/indices/port_dataset.py +72 -0
  107. xoa_driver/internals/hli_v1/indices/streams/__init__.py +0 -0
  108. xoa_driver/internals/hli_v1/indices/streams/base_stream.py +405 -0
  109. xoa_driver/internals/hli_v1/indices/streams/genuine_stream.py +64 -0
  110. xoa_driver/internals/hli_v1/modules/__init__.py +0 -0
  111. xoa_driver/internals/hli_v1/modules/__interfaces.py +21 -0
  112. xoa_driver/internals/hli_v1/modules/base_module.py +138 -0
  113. xoa_driver/internals/hli_v1/modules/module_chimera.py +366 -0
  114. xoa_driver/internals/hli_v1/modules/module_l23ve.py +73 -0
  115. xoa_driver/internals/hli_v1/modules/module_l47.py +397 -0
  116. xoa_driver/internals/hli_v1/modules/module_l47ve.py +9 -0
  117. xoa_driver/internals/hli_v1/modules/modules_l23/__init__.py +0 -0
  118. xoa_driver/internals/hli_v1/modules/modules_l23/family_combi.py +83 -0
  119. xoa_driver/internals/hli_v1/modules/modules_l23/family_d.py +75 -0
  120. xoa_driver/internals/hli_v1/modules/modules_l23/family_e.py +85 -0
  121. xoa_driver/internals/hli_v1/modules/modules_l23/family_f.py +145 -0
  122. xoa_driver/internals/hli_v1/modules/modules_l23/family_g.py +84 -0
  123. xoa_driver/internals/hli_v1/modules/modules_l23/family_h.py +40 -0
  124. xoa_driver/internals/hli_v1/modules/modules_l23/family_i.py +25 -0
  125. xoa_driver/internals/hli_v1/modules/modules_l23/family_j.py +25 -0
  126. xoa_driver/internals/hli_v1/modules/modules_l23/family_k.py +39 -0
  127. xoa_driver/internals/hli_v1/modules/modules_l23/family_l.py +55 -0
  128. xoa_driver/internals/hli_v1/modules/modules_l23/family_l1.py +800 -0
  129. xoa_driver/internals/hli_v1/modules/modules_l23/family_m.py +25 -0
  130. xoa_driver/internals/hli_v1/modules/modules_l23/family_n.py +40 -0
  131. xoa_driver/internals/hli_v1/modules/modules_l23/module_l23_base.py +383 -0
  132. xoa_driver/internals/hli_v1/ports/__init__.py +0 -0
  133. xoa_driver/internals/hli_v1/ports/base_port.py +125 -0
  134. xoa_driver/internals/hli_v1/ports/port_l23/__init__.py +0 -0
  135. xoa_driver/internals/hli_v1/ports/port_l23/bases/__init__.py +0 -0
  136. xoa_driver/internals/hli_v1/ports/port_l23/bases/port_capture.py +70 -0
  137. xoa_driver/internals/hli_v1/ports/port_l23/bases/port_l23.py +527 -0
  138. xoa_driver/internals/hli_v1/ports/port_l23/bases/port_l23_genuine.py +229 -0
  139. xoa_driver/internals/hli_v1/ports/port_l23/bases/port_reception_statistics.py +231 -0
  140. xoa_driver/internals/hli_v1/ports/port_l23/bases/port_transceiver.py +117 -0
  141. xoa_driver/internals/hli_v1/ports/port_l23/bases/port_transmission_statistics.py +131 -0
  142. xoa_driver/internals/hli_v1/ports/port_l23/chimera/__init__.py +0 -0
  143. xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/__init__.py +0 -0
  144. xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/_utils.py +15 -0
  145. xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/general.py +396 -0
  146. xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/shadow.py +104 -0
  147. xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/working.py +36 -0
  148. xoa_driver/internals/hli_v1/ports/port_l23/chimera/pe_custom_distribution.py +125 -0
  149. xoa_driver/internals/hli_v1/ports/port_l23/chimera/pe_distribution.py +174 -0
  150. xoa_driver/internals/hli_v1/ports/port_l23/chimera/port_chimera.py +119 -0
  151. xoa_driver/internals/hli_v1/ports/port_l23/chimera/port_emulation.py +244 -0
  152. xoa_driver/internals/hli_v1/ports/port_l23/chimera/reception_statistics.py +24 -0
  153. xoa_driver/internals/hli_v1/ports/port_l23/chimera/transmission_statistics.py +24 -0
  154. xoa_driver/internals/hli_v1/ports/port_l23/family_combi.py +37 -0
  155. xoa_driver/internals/hli_v1/ports/port_l23/family_d.py +51 -0
  156. xoa_driver/internals/hli_v1/ports/port_l23/family_e.py +107 -0
  157. xoa_driver/internals/hli_v1/ports/port_l23/family_f.py +151 -0
  158. xoa_driver/internals/hli_v1/ports/port_l23/family_g.py +77 -0
  159. xoa_driver/internals/hli_v1/ports/port_l23/family_h.py +67 -0
  160. xoa_driver/internals/hli_v1/ports/port_l23/family_i.py +84 -0
  161. xoa_driver/internals/hli_v1/ports/port_l23/family_j.py +68 -0
  162. xoa_driver/internals/hli_v1/ports/port_l23/family_k.py +73 -0
  163. xoa_driver/internals/hli_v1/ports/port_l23/family_l.py +82 -0
  164. xoa_driver/internals/hli_v1/ports/port_l23/family_l1.py +166 -0
  165. xoa_driver/internals/hli_v1/ports/port_l23/family_m.py +29 -0
  166. xoa_driver/internals/hli_v1/ports/port_l23/fault_jkl.py +24 -0
  167. xoa_driver/internals/hli_v1/ports/port_l23/freya_l1.py +722 -0
  168. xoa_driver/internals/hli_v1/ports/port_l23/pcs_pma_ghijkl.py +369 -0
  169. xoa_driver/internals/hli_v1/ports/port_l23/pcs_pma_ijkl_chimera.py +60 -0
  170. xoa_driver/internals/hli_v1/ports/port_l23/pcs_pma_l.py +78 -0
  171. xoa_driver/internals/hli_v1/ports/port_l23/port_l23ve.py +101 -0
  172. xoa_driver/internals/hli_v1/ports/port_l47/__init__.py +0 -0
  173. xoa_driver/internals/hli_v1/ports/port_l47/counters.py +174 -0
  174. xoa_driver/internals/hli_v1/ports/port_l47/main.py +228 -0
  175. xoa_driver/internals/hli_v1/ports/port_l47/packet_engine.py +31 -0
  176. xoa_driver/internals/hli_v1/revisions.py +11 -0
  177. xoa_driver/internals/hli_v1/testers/__init__.py +0 -0
  178. xoa_driver/internals/hli_v1/testers/_base_tester.py +259 -0
  179. xoa_driver/internals/hli_v1/testers/genuine/__init__.py +0 -0
  180. xoa_driver/internals/hli_v1/testers/genuine/l_23/__init__.py +0 -0
  181. xoa_driver/internals/hli_v1/testers/genuine/l_23/health.py +16 -0
  182. xoa_driver/internals/hli_v1/testers/genuine/l_23/rest_api.py +38 -0
  183. xoa_driver/internals/hli_v1/testers/genuine/l_23/time_keeper.py +57 -0
  184. xoa_driver/internals/hli_v1/testers/genuine/l_23/upload_file.py +29 -0
  185. xoa_driver/internals/hli_v1/testers/genuine/management_interface.py +42 -0
  186. xoa_driver/internals/hli_v1/testers/l23_tester.py +196 -0
  187. xoa_driver/internals/hli_v1/testers/l23ve_tester.py +114 -0
  188. xoa_driver/internals/hli_v1/testers/l47_tester.py +106 -0
  189. xoa_driver/internals/hli_v1/testers/l47ve_tester.py +54 -0
  190. xoa_driver/internals/hli_v2/__init__.py +0 -0
  191. xoa_driver/internals/hli_v2/indices/__init__.py +0 -0
  192. xoa_driver/internals/hli_v2/indices/base_index.py +39 -0
  193. xoa_driver/internals/hli_v2/indices/connection_group/__init__.py +0 -0
  194. xoa_driver/internals/hli_v2/indices/connection_group/cg.py +115 -0
  195. xoa_driver/internals/hli_v2/indices/connection_group/histogram.py +59 -0
  196. xoa_driver/internals/hli_v2/indices/connection_group/l2.py +71 -0
  197. xoa_driver/internals/hli_v2/indices/connection_group/l3.py +96 -0
  198. xoa_driver/internals/hli_v2/indices/connection_group/raw.py +148 -0
  199. xoa_driver/internals/hli_v2/indices/connection_group/replay.py +89 -0
  200. xoa_driver/internals/hli_v2/indices/connection_group/tcp.py +261 -0
  201. xoa_driver/internals/hli_v2/indices/connection_group/tls.py +166 -0
  202. xoa_driver/internals/hli_v2/indices/connection_group/udp.py +112 -0
  203. xoa_driver/internals/hli_v2/indices/connection_group/user_state.py +25 -0
  204. xoa_driver/internals/hli_v2/indices/filter/__init__.py +0 -0
  205. xoa_driver/internals/hli_v2/indices/filter/base_filter.py +50 -0
  206. xoa_driver/internals/hli_v2/indices/filter/genuine_filter.py +17 -0
  207. xoa_driver/internals/hli_v2/indices/length_term.py +44 -0
  208. xoa_driver/internals/hli_v2/indices/match_term.py +49 -0
  209. xoa_driver/internals/hli_v2/indices/port_dataset.py +53 -0
  210. xoa_driver/internals/hli_v2/indices/streams/__init__.py +0 -0
  211. xoa_driver/internals/hli_v2/indices/streams/base_stream.py +234 -0
  212. xoa_driver/internals/hli_v2/indices/streams/genuine_stream.py +32 -0
  213. xoa_driver/internals/hli_v2/modules/__init__.py +0 -0
  214. xoa_driver/internals/hli_v2/modules/__interfaces.py +21 -0
  215. xoa_driver/internals/hli_v2/modules/base_module.py +125 -0
  216. xoa_driver/internals/hli_v2/modules/module_chimera.py +358 -0
  217. xoa_driver/internals/hli_v2/modules/module_l23ve.py +58 -0
  218. xoa_driver/internals/hli_v2/modules/module_l47.py +230 -0
  219. xoa_driver/internals/hli_v2/modules/module_l47ve.py +8 -0
  220. xoa_driver/internals/hli_v2/modules/modules_l23/__init__.py +0 -0
  221. xoa_driver/internals/hli_v2/modules/modules_l23/family_combi.py +73 -0
  222. xoa_driver/internals/hli_v2/modules/modules_l23/family_d.py +75 -0
  223. xoa_driver/internals/hli_v2/modules/modules_l23/family_e.py +85 -0
  224. xoa_driver/internals/hli_v2/modules/modules_l23/family_f.py +144 -0
  225. xoa_driver/internals/hli_v2/modules/modules_l23/family_g.py +84 -0
  226. xoa_driver/internals/hli_v2/modules/modules_l23/family_h.py +40 -0
  227. xoa_driver/internals/hli_v2/modules/modules_l23/family_i.py +25 -0
  228. xoa_driver/internals/hli_v2/modules/modules_l23/family_j.py +25 -0
  229. xoa_driver/internals/hli_v2/modules/modules_l23/family_k.py +39 -0
  230. xoa_driver/internals/hli_v2/modules/modules_l23/family_l.py +55 -0
  231. xoa_driver/internals/hli_v2/modules/modules_l23/family_l1.py +797 -0
  232. xoa_driver/internals/hli_v2/modules/modules_l23/family_m.py +25 -0
  233. xoa_driver/internals/hli_v2/modules/modules_l23/family_n.py +40 -0
  234. xoa_driver/internals/hli_v2/modules/modules_l23/module_l23_base.py +339 -0
  235. xoa_driver/internals/hli_v2/ports/__init__.py +0 -0
  236. xoa_driver/internals/hli_v2/ports/base_port.py +105 -0
  237. xoa_driver/internals/hli_v2/ports/port_l23/__init__.py +0 -0
  238. xoa_driver/internals/hli_v2/ports/port_l23/bases/__init__.py +0 -0
  239. xoa_driver/internals/hli_v2/ports/port_l23/bases/port_capture.py +64 -0
  240. xoa_driver/internals/hli_v2/ports/port_l23/bases/port_l23.py +441 -0
  241. xoa_driver/internals/hli_v2/ports/port_l23/bases/port_l23_genuine.py +172 -0
  242. xoa_driver/internals/hli_v2/ports/port_l23/bases/port_reception_statistics.py +156 -0
  243. xoa_driver/internals/hli_v2/ports/port_l23/bases/port_transceiver.py +117 -0
  244. xoa_driver/internals/hli_v2/ports/port_l23/bases/port_transmission_statistics.py +59 -0
  245. xoa_driver/internals/hli_v2/ports/port_l23/chimera/__init__.py +0 -0
  246. xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/__init__.py +0 -0
  247. xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/_utils.py +15 -0
  248. xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/general.py +340 -0
  249. xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/shadow.py +99 -0
  250. xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/working.py +36 -0
  251. xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_custom_distribution.py +116 -0
  252. xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_distribution.py +102 -0
  253. xoa_driver/internals/hli_v2/ports/port_l23/chimera/port_chimera.py +113 -0
  254. xoa_driver/internals/hli_v2/ports/port_l23/chimera/port_emulation.py +420 -0
  255. xoa_driver/internals/hli_v2/ports/port_l23/chimera/reception_statistics.py +22 -0
  256. xoa_driver/internals/hli_v2/ports/port_l23/chimera/transmission_statistics.py +22 -0
  257. xoa_driver/internals/hli_v2/ports/port_l23/family_combi.py +36 -0
  258. xoa_driver/internals/hli_v2/ports/port_l23/family_d.py +49 -0
  259. xoa_driver/internals/hli_v2/ports/port_l23/family_e.py +96 -0
  260. xoa_driver/internals/hli_v2/ports/port_l23/family_f.py +144 -0
  261. xoa_driver/internals/hli_v2/ports/port_l23/family_g.py +77 -0
  262. xoa_driver/internals/hli_v2/ports/port_l23/family_h.py +60 -0
  263. xoa_driver/internals/hli_v2/ports/port_l23/family_i.py +66 -0
  264. xoa_driver/internals/hli_v2/ports/port_l23/family_j.py +53 -0
  265. xoa_driver/internals/hli_v2/ports/port_l23/family_k.py +58 -0
  266. xoa_driver/internals/hli_v2/ports/port_l23/family_l.py +67 -0
  267. xoa_driver/internals/hli_v2/ports/port_l23/family_l1.py +149 -0
  268. xoa_driver/internals/hli_v2/ports/port_l23/family_m.py +28 -0
  269. xoa_driver/internals/hli_v2/ports/port_l23/fault_jkl.py +22 -0
  270. xoa_driver/internals/hli_v2/ports/port_l23/pcs_pma_ghijkl.py +342 -0
  271. xoa_driver/internals/hli_v2/ports/port_l23/pcs_pma_ijkl_chimera.py +50 -0
  272. xoa_driver/internals/hli_v2/ports/port_l23/pcs_pma_l.py +65 -0
  273. xoa_driver/internals/hli_v2/ports/port_l23/port_l23ve.py +81 -0
  274. xoa_driver/internals/hli_v2/ports/port_l47/__init__.py +0 -0
  275. xoa_driver/internals/hli_v2/ports/port_l47/counters.py +146 -0
  276. xoa_driver/internals/hli_v2/ports/port_l47/main.py +137 -0
  277. xoa_driver/internals/hli_v2/ports/port_l47/packet_engine.py +20 -0
  278. xoa_driver/internals/hli_v2/revisions.py +11 -0
  279. xoa_driver/internals/hli_v2/testers/__init__.py +0 -0
  280. xoa_driver/internals/hli_v2/testers/_base_tester.py +207 -0
  281. xoa_driver/internals/hli_v2/testers/genuine/__init__.py +0 -0
  282. xoa_driver/internals/hli_v2/testers/genuine/l_23/__init__.py +0 -0
  283. xoa_driver/internals/hli_v2/testers/genuine/l_23/health.py +16 -0
  284. xoa_driver/internals/hli_v2/testers/genuine/l_23/rest_api.py +34 -0
  285. xoa_driver/internals/hli_v2/testers/genuine/l_23/time_keeper.py +50 -0
  286. xoa_driver/internals/hli_v2/testers/genuine/l_23/upload_file.py +26 -0
  287. xoa_driver/internals/hli_v2/testers/genuine/management_interface.py +38 -0
  288. xoa_driver/internals/hli_v2/testers/l23_tester.py +159 -0
  289. xoa_driver/internals/hli_v2/testers/l23ve_tester.py +98 -0
  290. xoa_driver/internals/hli_v2/testers/l47_tester.py +95 -0
  291. xoa_driver/internals/hli_v2/testers/l47ve_tester.py +50 -0
  292. xoa_driver/internals/state_storage/__init__.py +0 -0
  293. xoa_driver/internals/state_storage/_speed_detector.py +121 -0
  294. xoa_driver/internals/state_storage/modules_state.py +128 -0
  295. xoa_driver/internals/state_storage/ports_state.py +154 -0
  296. xoa_driver/internals/state_storage/testers_state.py +104 -0
  297. xoa_driver/internals/utils/__init__.py +0 -0
  298. xoa_driver/internals/utils/attributes.py +33 -0
  299. xoa_driver/internals/utils/cap_id.py +63 -0
  300. xoa_driver/internals/utils/con_traffic_light.py +88 -0
  301. xoa_driver/internals/utils/indices/__init__.py +0 -0
  302. xoa_driver/internals/utils/indices/_interfaces.py +26 -0
  303. xoa_driver/internals/utils/indices/header_modifier_manager.py +56 -0
  304. xoa_driver/internals/utils/indices/index_manager.py +95 -0
  305. xoa_driver/internals/utils/indices/observer.py +17 -0
  306. xoa_driver/internals/utils/kind.py +19 -0
  307. xoa_driver/internals/utils/managers/__init__.py +0 -0
  308. xoa_driver/internals/utils/managers/abc.py +44 -0
  309. xoa_driver/internals/utils/managers/exceptions.py +22 -0
  310. xoa_driver/internals/utils/managers/modules_manager.py +118 -0
  311. xoa_driver/internals/utils/managers/ports_manager.py +116 -0
  312. xoa_driver/internals/utils/rev_tool.py +21 -0
  313. xoa_driver/internals/utils/session.py +117 -0
  314. xoa_driver/internals/warn.py +32 -0
  315. xoa_driver/lli.py +15 -0
  316. xoa_driver/misc.py +57 -0
  317. xoa_driver/modules.py +448 -0
  318. xoa_driver/ports.py +332 -0
  319. xoa_driver/testers.py +37 -0
  320. xoa_driver/utils.py +12 -0
  321. xoa_driver/v2/__init__.py +11 -0
  322. xoa_driver/v2/misc.py +77 -0
  323. xoa_driver/v2/modules.py +308 -0
  324. xoa_driver/v2/ports.py +232 -0
  325. xoa_driver/v2/testers.py +24 -0
@@ -0,0 +1,38 @@
1
+ from xoa_driver.internals.core import interfaces as itf
2
+ from xoa_driver.internals.commands import (
3
+ C_IPADDRESS,
4
+ C_DHCP,
5
+ C_MACADDRESS,
6
+ C_HOSTNAME,
7
+ )
8
+
9
+
10
+ class ManagementInterface:
11
+ """
12
+ Tester management interface address configuration.
13
+ """
14
+
15
+ def __init__(self, conn: "itf.IConnection") -> None:
16
+ self.ip_address = C_IPADDRESS(conn)
17
+ """
18
+ Chassis management port IP address configuration.
19
+ Representation of C_IPADDRESS
20
+ """
21
+
22
+ self.dhcp = C_DHCP(conn)
23
+ """
24
+ Chassis management port IP address configuration with DHCP.
25
+ Representation of C_DHCP
26
+ """
27
+
28
+ self.macaddress = C_MACADDRESS(conn)
29
+ """
30
+ Chassis management port MAC address.
31
+ Representation of C_MACADDRESS
32
+ """
33
+
34
+ self.hostname = C_HOSTNAME(conn)
35
+ """
36
+ Chassis management hostname.
37
+ Representation of C_HOSTNAME
38
+ """
@@ -0,0 +1,159 @@
1
+ from __future__ import annotations
2
+ from typing import (
3
+ Union,
4
+ TYPE_CHECKING,
5
+ Type,
6
+ )
7
+ from xoa_driver.internals.commands import (
8
+ C_PORTCOUNTS,
9
+ C_MULTIUSER,
10
+ C_TRAFFIC,
11
+ C_TRAFFICSYNC,
12
+ C_VERSIONNO_MINOR,
13
+ C_BUILDSTRING,
14
+ C_VERSIONSTR,
15
+ )
16
+ from xoa_driver.internals.core.transporter.logger import CustomLogger
17
+ from xoa_driver.internals.utils.managers.modules_manager import ModulesManager
18
+ from ._base_tester import BaseTester
19
+ from .genuine import management_interface as mi
20
+ from .genuine.l_23 import (
21
+ upload_file,
22
+ time_keeper,
23
+ rest_api,
24
+ health,
25
+ )
26
+ if TYPE_CHECKING:
27
+ from xoa_driver.v2 import modules
28
+
29
+ from xoa_driver.internals.state_storage import testers_state
30
+ from xoa_driver.internals.hli_v2 import revisions
31
+ from xoa_driver.internals import exceptions
32
+
33
+
34
+ TypeL23Manager = ModulesManager[
35
+ Union[
36
+ "modules.GenericL23Module",
37
+ "modules.ModuleChimera",
38
+ ]
39
+ ]
40
+
41
+
42
+ def get_module_type(revision: str) -> Type:
43
+ module_type = dict(
44
+ **revisions.VALKYRIE_MODULES,
45
+ **revisions.CHIMERA_MODULES,
46
+ ).get(revision)
47
+ if not module_type:
48
+ raise exceptions.WrongModuleError(
49
+ revision,
50
+ set.union(
51
+ set(revisions.VALKYRIE_MODULES.keys()),
52
+ set(revisions.CHIMERA_MODULES.keys()),
53
+ )
54
+ )
55
+ return module_type
56
+
57
+
58
+ class L23Tester(BaseTester["testers_state.GenuineTesterLocalState"]):
59
+ """
60
+ This is a conceptual class of Xena Valkyrie Tester.
61
+ It is essentially an extended :class:`BaseTester`.
62
+
63
+
64
+ :param host: tester's address/hostname
65
+ :type host: str
66
+ :param username: username of the user
67
+ :type username: str
68
+ :param password: login password of the tester, defaults to "xena"
69
+ :type password: str, optional
70
+ :param port: the port number for connection establishment, default to 22606
71
+ :type port: int, optional
72
+ :param enable_logging: `True` if debug log output from the tester is needed, and `False` otherwise
73
+ :type enable_logging: bool
74
+ :param custom_logger: `None` allow to specify logger with custom configurations
75
+ :type enable_logging: CustomLogger | None
76
+ :param session_timeout: `130` Session timeout in seconds
77
+ :type session_timeout: int
78
+ """
79
+
80
+ def __init__(self, host: str, username: str, password: str = "xena", port: int = 22606, *, enable_logging: bool = False, custom_logger: CustomLogger | None = None, session_timeout: int = 130) -> None:
81
+ super().__init__(
82
+ host=host,
83
+ username=username,
84
+ password=password,
85
+ port=port,
86
+ enable_logging=enable_logging,
87
+ custom_logger=custom_logger,
88
+ session_timeout=session_timeout
89
+ )
90
+
91
+ self._local_states = testers_state.GenuineTesterLocalState(host, port)
92
+
93
+ self.management_interface = mi.ManagementInterface(self._conn)
94
+ """Tester management interface that includes IP address, DHCP, MAC address and hostname.
95
+ """
96
+
97
+ self.upload_file = upload_file.UploadFile(self._conn)
98
+ """File upload functions of the tester.
99
+ """
100
+
101
+ self.rest_api_server = rest_api.RestApiServer(self._conn)
102
+ """REST API server of the tester.
103
+ """
104
+
105
+ self.time_keeper = time_keeper.TimeKeeper(self._conn)
106
+ """TimeKeeper of the tester.
107
+ """
108
+
109
+ self.multiuser = C_MULTIUSER(self._conn)
110
+ """
111
+ Representation of C_MULTIUSER
112
+ """
113
+
114
+ self.traffic = C_TRAFFIC(self._conn)
115
+ """
116
+ Representation of C_TRAFFIC
117
+ """
118
+ self.traffic_sync = C_TRAFFICSYNC(self._conn)
119
+ """
120
+ Representation of C_TRAFFICSYNC
121
+ """
122
+ self.version_no_minor = C_VERSIONNO_MINOR(self._conn)
123
+ """
124
+ Representation of C_VERSIONNO_MINOR
125
+ """
126
+ self.version_str = C_VERSIONSTR(self._conn)
127
+ """
128
+ Returns xenaserver version number in the new format.
129
+
130
+ :type: C_VERSIONSTR
131
+ """
132
+ self.build_string = C_BUILDSTRING(self._conn)
133
+ """
134
+ Representation of C_BUILDSTRING
135
+ """
136
+ self.health = health.Health(self._conn)
137
+ """
138
+ Chassis system health information.
139
+
140
+ :type: C_HEALTH
141
+ """
142
+ self.modules: TypeL23Manager = ModulesManager(self._conn, get_module_type)
143
+ """
144
+ Module index manager of the L23 tester.
145
+ """
146
+
147
+ @property
148
+ def info(self) -> testers_state.GenuineTesterLocalState:
149
+ return self._local_states
150
+
151
+ async def _setup(self):
152
+ await super()._setup()
153
+ await self._local_states.initiate(self)
154
+ self._local_states.register_subscriptions(self)
155
+
156
+ ft_pc = await C_PORTCOUNTS(self._conn).get()
157
+ port_counts = ft_pc.port_counts
158
+ await self.modules.fill_l23(port_counts)
159
+ return self
@@ -0,0 +1,98 @@
1
+ from __future__ import annotations
2
+ from typing import Type
3
+ from xoa_driver.internals.commands import (
4
+ C_PORTCOUNTS,
5
+ C_MULTIUSER,
6
+ C_TRAFFIC,
7
+ C_TRAFFICSYNC,
8
+ C_VERSIONNO_MINOR,
9
+ )
10
+ from xoa_driver.internals.core.transporter.logger import CustomLogger
11
+ from xoa_driver.internals.utils.managers.modules_manager import ModulesManager
12
+ from ._base_tester import BaseTester
13
+
14
+
15
+ from xoa_driver.v2 import modules
16
+ from xoa_driver.internals.state_storage import testers_state
17
+
18
+
19
+ TypeL23Manager = ModulesManager["modules.ModuleL23VE"]
20
+
21
+
22
+ def get_module_type(revision: str) -> Type:
23
+ return modules.ModuleL23VE
24
+
25
+
26
+ class L23VeTester(BaseTester["testers_state.TesterLocalState"]):
27
+ """
28
+ This is a conceptual class of Xena ValkyrieVE Tester.
29
+ It is essentially an extended :class:`BaseTester`.
30
+
31
+
32
+ :param host: tester's address/hostname
33
+ :type host: str
34
+ :param username: username of the user
35
+ :type username: str
36
+ :param password: login password of the tester, defaults to "xena"
37
+ :type password: str, optional
38
+ :param port: the port number for connection establishment, default to 22606
39
+ :type port: int, optional
40
+ :param enable_logging: `True` if debug log output from the tester is needed, and `False` otherwise
41
+ :type enable_logging: bool
42
+ :param custom_logger: `None` allow to specify logger with custom configurations
43
+ :type enable_logging: CustomLogger | None
44
+ :param session_timeout: `130` Session timeout in seconds
45
+ :type session_timeout: int
46
+ """
47
+
48
+ def __init__(self, host: str, username: str, password: str = "xena", port: int = 22606, *, enable_logging: bool = False, custom_logger: CustomLogger | None = None, session_timeout: int = 130) -> None:
49
+ super().__init__(
50
+ host=host,
51
+ username=username,
52
+ password=password,
53
+ port=port,
54
+ enable_logging=enable_logging,
55
+ custom_logger=custom_logger,
56
+ session_timeout=session_timeout
57
+ )
58
+
59
+ self._local_states = testers_state.TesterLocalState(host, port)
60
+
61
+ self.multiuser = C_MULTIUSER(self._conn)
62
+ """
63
+ Representation of C_MULTIUSER
64
+ """
65
+
66
+ self.traffic = C_TRAFFIC(self._conn)
67
+ """
68
+ Representation of C_TRAFFIC
69
+ """
70
+
71
+ self.traffic_sync = C_TRAFFICSYNC(self._conn)
72
+ """
73
+ Representation of C_TRAFFICSYNC
74
+ """
75
+
76
+ self.version_no_minor = C_VERSIONNO_MINOR(self._conn)
77
+ """
78
+ Representation of C_VERSIONNO_MINOR
79
+ """
80
+
81
+ self.modules: TypeL23Manager = ModulesManager(self._conn, get_module_type)
82
+ """
83
+ Module index manager of the L23 tester.
84
+ """
85
+
86
+ @property
87
+ def info(self) -> testers_state.TesterLocalState:
88
+ return self._local_states
89
+
90
+ async def _setup(self):
91
+ await super()._setup()
92
+ await self._local_states.initiate(self)
93
+ self._local_states.register_subscriptions(self)
94
+
95
+ ft_pc = await C_PORTCOUNTS(self._conn).get()
96
+ port_counts = ft_pc.port_counts
97
+ await self.modules.fill_l23(port_counts)
98
+ return self
@@ -0,0 +1,95 @@
1
+ from __future__ import annotations
2
+ from typing import (
3
+ TYPE_CHECKING,
4
+ Type
5
+ )
6
+ from typing_extensions import Self
7
+ from xoa_driver.internals.commands import (
8
+ C_REMOTEPORTCOUNTS,
9
+ C_BUILDSTRING,
10
+ )
11
+ from xoa_driver.internals.core.transporter.logger import CustomLogger
12
+ from xoa_driver.internals.utils.managers.modules_manager import ModulesManager
13
+ from xoa_driver.internals.hli_v2 import revisions
14
+ from xoa_driver.internals import exceptions
15
+ if TYPE_CHECKING:
16
+ from xoa_driver.internals.hli_v2.modules import module_l47 as ml47
17
+
18
+ from xoa_driver.internals.state_storage import testers_state
19
+ from ._base_tester import BaseTester
20
+ from .genuine import management_interface as mi
21
+
22
+
23
+ def get_module_type(revision: str) -> "Type":
24
+ module_type = revisions.VULCAN_MODULES.get(revision)
25
+ if not module_type:
26
+ raise exceptions.WrongModuleError(
27
+ revision,
28
+ set(revisions.VULCAN_MODULES.keys()),
29
+ )
30
+ return module_type
31
+
32
+
33
+ class L47Tester(BaseTester["testers_state.GenuineTesterLocalState"]):
34
+ """
35
+ This is a conceptual class of Xena Vulcan Tester.
36
+ It is essentially an extended :class:`BaseTester`.
37
+
38
+
39
+ :param host: tester's address/hostname
40
+ :type host: str
41
+ :param username: username of the user
42
+ :type username: str
43
+ :param password: login password of the tester, defaults to "xena"
44
+ :type password: str, optional
45
+ :param port: the port number for connection establishment, default to 22606
46
+ :type port: int, optional
47
+ :param enable_logging: `True` if debug log output from the tester is needed, and `False` otherwise
48
+ :type enable_logging: bool
49
+ :param custom_logger: `None` allow to specify logger with custom configurations
50
+ :type enable_logging: CustomLogger | None
51
+ :param session_timeout: `130` Session timeout in seconds
52
+ :type session_timeout: int
53
+ """
54
+
55
+ def __init__(self, host: str, username: str, password: str = "xena", port: int = 22606, *, enable_logging: bool = False, custom_logger: CustomLogger | None = None, session_timeout: int = 130) -> None:
56
+ super().__init__(
57
+ host=host,
58
+ username=username,
59
+ password=password,
60
+ port=port,
61
+ enable_logging=enable_logging,
62
+ custom_logger=custom_logger,
63
+ session_timeout=session_timeout
64
+ )
65
+
66
+ self._local_states = testers_state.GenuineTesterLocalState(host, port)
67
+
68
+ self.build_string = C_BUILDSTRING(self._conn)
69
+ """
70
+ Representation of C_BUILDSTRING
71
+ """
72
+
73
+ self.management_interface = mi.ManagementInterface(self._conn)
74
+ """
75
+ Tester management interface that includes IP address, DHCP, MAC address and hostname.
76
+ """
77
+
78
+ self.modules: ModulesManager["ml47.ModuleL47"] = ModulesManager(self._conn, get_module_type)
79
+ """
80
+ Module index manager of the tester.
81
+ """
82
+
83
+ @property
84
+ def info(self) -> testers_state.GenuineTesterLocalState:
85
+ return self._local_states
86
+
87
+ async def _setup(self) -> Self:
88
+ await super()._setup()
89
+ await self._local_states.initiate(self)
90
+ self._local_states.register_subscriptions(self)
91
+
92
+ ft_pc = await C_REMOTEPORTCOUNTS(self._conn).get()
93
+ port_counts = ft_pc.port_counts
94
+ await self.modules.fill_l47(port_counts)
95
+ return self
@@ -0,0 +1,50 @@
1
+ from __future__ import annotations
2
+ from xoa_driver.internals.commands import (
3
+ C_BUILDSTRING,
4
+ C_VERSIONNO_MINOR
5
+ )
6
+ from xoa_driver.internals.core.transporter.logger import CustomLogger
7
+ from .l47_tester import L47Tester
8
+
9
+
10
+ class L47VeTester(L47Tester):
11
+ """
12
+ This is a conceptual class of Xena VulcanVE Tester.
13
+ It is essentially an extended :class:`BaseTester`.
14
+
15
+
16
+ :param host: tester's address/hostname
17
+ :type host: str
18
+ :param username: username of the user
19
+ :type username: str
20
+ :param password: login password of the tester, defaults to "xena"
21
+ :type password: str, optional
22
+ :param port: the port number for connection establishment, default to 22606
23
+ :type port: int, optional
24
+ :param enable_logging: `True` if debug log output from the tester is needed, and `False` otherwise
25
+ :type enable_logging: bool
26
+ :param custom_logger: `None` allow to specify logger with custom configurations
27
+ :type enable_logging: CustomLogger | None
28
+ :param session_timeout: `130` Session timeout in seconds
29
+ :type session_timeout: int
30
+ """
31
+
32
+ def __init__(self, host: str, username: str, password: str = "xena", port: int = 22606, *, enable_logging: bool = False, custom_logger: CustomLogger | None = None, session_timeout: int = 130) -> None:
33
+ super().__init__(
34
+ host=host,
35
+ username=username,
36
+ password=password,
37
+ port=port,
38
+ enable_logging=enable_logging,
39
+ custom_logger=custom_logger,
40
+ session_timeout=session_timeout
41
+ )
42
+ self.version_no_minor = C_VERSIONNO_MINOR(self._conn)
43
+ """
44
+ Representation of C_VERSIONNO_MINOR
45
+ """
46
+
47
+ self.build_string = C_BUILDSTRING(self._conn)
48
+ """
49
+ Representation of C_BUILDSTRING
50
+ """
File without changes
@@ -0,0 +1,121 @@
1
+ from __future__ import annotations
2
+ from typing import TYPE_CHECKING
3
+
4
+ from enum import (
5
+ Enum,
6
+ auto
7
+ )
8
+ from xoa_driver.internals.commands import enums
9
+ if TYPE_CHECKING:
10
+ from xoa_driver.internals.commands import P_CAPABILITIES
11
+
12
+
13
+ class EPortInterfaceSubtype(Enum):
14
+ Unspecified = auto()
15
+ Single = auto()
16
+ Dual = auto()
17
+ Triple = auto()
18
+ Quint = auto()
19
+
20
+
21
+ class SpeedDetector:
22
+ """
23
+ Work around of ports speed detection. Only for Genuine L23 ports.
24
+ Keep it as a class for not couple all logic under one function.
25
+ """
26
+ __slots__ = ("capabilities", "interface")
27
+
28
+ def __init__(self, capabilities: "P_CAPABILITIES.GetDataAttr", interface: str) -> None:
29
+ self.capabilities = capabilities
30
+ self.interface = interface
31
+
32
+ @property
33
+ def __determinate_interface_subtype(self) -> EPortInterfaceSubtype:
34
+ if "[Triple]" in self.interface:
35
+ return EPortInterfaceSubtype.Triple
36
+ elif "[Quint]" in self.interface:
37
+ return EPortInterfaceSubtype.Quint
38
+ elif "[Dual]" in self.interface:
39
+ return EPortInterfaceSubtype.Dual
40
+ elif "[Single]" in self.interface:
41
+ return EPortInterfaceSubtype.Single
42
+ return EPortInterfaceSubtype.Unspecified
43
+
44
+ @property
45
+ def can_set_port_speed(self) -> bool:
46
+ return self.__determinate_interface_subtype in {
47
+ EPortInterfaceSubtype.Triple,
48
+ EPortInterfaceSubtype.Quint,
49
+ EPortInterfaceSubtype.Dual,
50
+ EPortInterfaceSubtype.Single
51
+ }
52
+
53
+ def __define_single(self) -> list[enums.PortSpeedMode]:
54
+ if "T1S" not in self.interface:
55
+ return []
56
+ return [
57
+ enums.PortSpeedMode.AUTO,
58
+ enums.PortSpeedMode.F100M,
59
+ enums.PortSpeedMode.F1G,
60
+ ]
61
+
62
+ def __define_dual(self) -> list[enums.PortSpeedMode]:
63
+ if "T1" in self.interface:
64
+ return [enums.PortSpeedMode.F10MHDX, ]
65
+ return []
66
+
67
+ def __define_triple(self) -> list[enums.PortSpeedMode]:
68
+ if self.interface.startswith("SFP"):
69
+ if self.capabilities.max_speed == 1_000:
70
+ return [
71
+ enums.PortSpeedMode.AUTO,
72
+ enums.PortSpeedMode.F10M,
73
+ enums.PortSpeedMode.F100M,
74
+ enums.PortSpeedMode.F1G,
75
+ enums.PortSpeedMode.F10M100M,
76
+ enums.PortSpeedMode.F100M1G,
77
+ enums.PortSpeedMode.F10MHDX,
78
+ enums.PortSpeedMode.F100MHDX,
79
+ ]
80
+ elif self.capabilities.max_speed == 10_000:
81
+ return [
82
+ enums.PortSpeedMode.AUTO,
83
+ enums.PortSpeedMode.F100M,
84
+ enums.PortSpeedMode.F1G,
85
+ enums.PortSpeedMode.F10G,
86
+ enums.PortSpeedMode.F100M1G,
87
+ ]
88
+ elif self.interface.startswith("10GBASE-T"):
89
+ return [
90
+ enums.PortSpeedMode.AUTO,
91
+ enums.PortSpeedMode.F100M,
92
+ enums.PortSpeedMode.F1G,
93
+ enums.PortSpeedMode.F10G,
94
+ enums.PortSpeedMode.F100M1G,
95
+ ]
96
+ return []
97
+
98
+ def __define_quint(self) -> list[enums.PortSpeedMode]:
99
+ speeds = [
100
+ enums.PortSpeedMode.AUTO,
101
+ enums.PortSpeedMode.F100M,
102
+ enums.PortSpeedMode.F1G,
103
+ enums.PortSpeedMode.F2500M,
104
+ enums.PortSpeedMode.F5G,
105
+ enums.PortSpeedMode.F100M1G,
106
+ enums.PortSpeedMode.F100M1G2500M,
107
+ ]
108
+ if self.interface.startswith("10GBASE-T"):
109
+ speeds.append(enums.PortSpeedMode.F10G)
110
+ return speeds
111
+
112
+ def find_port_possible_speed(self) -> list[enums.PortSpeedMode]:
113
+ if not self.can_set_port_speed:
114
+ return []
115
+ define_func = {
116
+ EPortInterfaceSubtype.Single: self.__define_single,
117
+ EPortInterfaceSubtype.Dual: self.__define_dual,
118
+ EPortInterfaceSubtype.Triple: self.__define_triple,
119
+ EPortInterfaceSubtype.Quint: self.__define_quint
120
+ }.get(self.__determinate_interface_subtype, lambda: [])
121
+ return define_func()
@@ -0,0 +1,128 @@
1
+ import asyncio
2
+ from typing import List
3
+ from dataclasses import (
4
+ dataclass,
5
+ field,
6
+ )
7
+ from xoa_driver.internals.core import funcs
8
+ from xoa_driver.internals.commands import enums
9
+ from xoa_driver.internals.commands import (
10
+ M_MODEL,
11
+ M_RESERVATION,
12
+ M_RESERVEDBY,
13
+ M_MEDIASUPPORT,
14
+ )
15
+
16
+ from xoa_driver.internals.utils import attributes as utils
17
+
18
+
19
+ class ModuleLocalState:
20
+ """Module local state.
21
+ """
22
+ __slots__ = (
23
+ "reservation",
24
+ "reserved_by",
25
+ "model",
26
+ )
27
+
28
+ def __init__(self) -> None:
29
+ self.reservation: enums.ReservedStatus = enums.ReservedStatus.RELEASED
30
+ self.reserved_by: str = ""
31
+ self.model: str = ""
32
+
33
+ async def initiate(self, module) -> None:
34
+ (
35
+ reservation_r,
36
+ reserved_by_r,
37
+ model_r,
38
+ ) = await funcs.apply(
39
+ module.reservation.get(),
40
+ module.reserved_by.get(),
41
+ module.model.get(),
42
+ )
43
+ self.reservation = enums.ReservedStatus(reservation_r.operation)
44
+ self.reserved_by = reserved_by_r.username
45
+ self.model = model_r.model
46
+
47
+ def register_subscriptions(self, module) -> None:
48
+ module._conn.subscribe(M_RESERVEDBY, utils.Update(self, "reserved_by", "username", module._check_identity))
49
+ module._conn.subscribe(M_RESERVATION, utils.Update(self, "reservation", "operation", module._check_identity))
50
+ module._conn.subscribe(M_MODEL, utils.Update(self, "model", "model", module._check_identity))
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class ModuleSpeed:
55
+ """Module's port-speed information.
56
+ """
57
+ port_count: int
58
+ """Port count
59
+
60
+ :return: number of ports that have the same speed
61
+ :rtype: int
62
+ """
63
+
64
+ port_speed: int
65
+ """Port speed
66
+
67
+ :return: speed of the ports
68
+ :rtype: int
69
+ """
70
+
71
+
72
+ @dataclass(frozen=True)
73
+ class MediaInfo:
74
+ """Module media information
75
+ """
76
+ cage_type: "enums.MediaConfigurationType"
77
+ """Module Media Configuration
78
+
79
+ :return: module media configuration
80
+ :rtype: MediaConfigurationType
81
+ """
82
+
83
+ available_speeds: List["ModuleSpeed"] = field(default_factory=list)
84
+ """List of module's port-speed information
85
+
86
+ :return: list of module's port-speed information
87
+ :rtype: List[ModuleSpeed]
88
+ """
89
+
90
+
91
+ class ModuleL23LocalState(ModuleLocalState):
92
+ """L23 Module local state
93
+ """
94
+ __slots__ = ("__media_info_list",)
95
+
96
+ def __init__(self) -> None:
97
+ self.__media_info_list: List["MediaInfo"] = []
98
+
99
+ @property
100
+ def media_info_list(self) -> List["MediaInfo"]:
101
+ return self.__media_info_list
102
+
103
+ @media_info_list.setter
104
+ def media_info_list(self, value: List[int]) -> None:
105
+ self.__media_info_list.clear()
106
+ _vs = value[:]
107
+ while _vs:
108
+ cage_type = enums.MediaConfigurationType(_vs.pop(0))
109
+ available_speeds_count = _vs.pop(0)
110
+ mi = MediaInfo(
111
+ cage_type,
112
+ [
113
+ ModuleSpeed(_vs.pop(0), _vs.pop(0))
114
+ for _ in range(available_speeds_count)
115
+ ]
116
+ )
117
+ self.__media_info_list.append(mi)
118
+
119
+ async def initiate(self, module) -> None:
120
+ m_support_resp, *_ = await asyncio.gather(
121
+ M_MEDIASUPPORT(module._conn, module.module_id).get(),
122
+ super().initiate(module)
123
+ )
124
+ self.media_info_list = m_support_resp.media_info_list
125
+
126
+ def register_subscriptions(self, module) -> None:
127
+ super().register_subscriptions(module)
128
+ module._conn.subscribe(M_MEDIASUPPORT, utils.Update(self, "media_info_list", "media_info_list", module._check_identity))