tdl-xoa-driver 1.0.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 (325) hide show
  1. tdl_xoa_driver-1.0.0b1.dist-info/LICENSE +202 -0
  2. tdl_xoa_driver-1.0.0b1.dist-info/METADATA +177 -0
  3. tdl_xoa_driver-1.0.0b1.dist-info/RECORD +325 -0
  4. tdl_xoa_driver-1.0.0b1.dist-info/WHEEL +5 -0
  5. tdl_xoa_driver-1.0.0b1.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,608 @@
1
+ ################################################################
2
+ #
3
+ # HEADER BUILDER
4
+ #
5
+ # This script shows you how you can build your own header builder
6
+ # that converts human readable values into hex strings
7
+ #
8
+ ################################################################
9
+
10
+ from ipaddress import IPv4Address, IPv6Address
11
+ from binascii import hexlify
12
+ from xoa_driver.misc import Hex
13
+ from enum import Enum
14
+ from dataclasses import dataclass, field
15
+
16
+ class EtherType(Enum):
17
+ IPv4 = 0x0800
18
+ IPv6 = 0x86DD
19
+ VLAN = 0x8100
20
+ QINQ_LEGACY = 0x9100
21
+ QINQ = 0x88A8
22
+ ARP = 0x0806
23
+ MPLS = 0x8847
24
+ eCPRI = 0xAEFE
25
+ MACControl = 0x8808
26
+ NONE = 0xFFFF
27
+
28
+ class IPProtocol(Enum):
29
+ UDP = 17
30
+ TCP = 6
31
+ NONE = 255
32
+
33
+ class ARPOpcode(Enum):
34
+ Request = 1
35
+ Reply = 2
36
+
37
+ class ARPHardwareType(Enum):
38
+ Ethernet = 1
39
+
40
+ class DHCPOpcode(Enum):
41
+ BootRequest = 1
42
+ BootReply = 2
43
+
44
+ class DHCPMessageType(Enum):
45
+ Discover = 1
46
+ Offer = 2
47
+ Request = 3
48
+ Decline = 4
49
+ Ack = 5
50
+ Nack = 6
51
+ Release = 7
52
+ Inform = 8
53
+
54
+ class DHCPOptionCode(Enum):
55
+ Pad = 0
56
+ End = 255
57
+ SubnetMask = 1
58
+ TimeOffset = 2
59
+ RouterOption = 3
60
+ TimeServerOption = 4
61
+ NameServerOption = 5
62
+ DomainNameServerOption = 6
63
+ LogServerOption = 7
64
+ CookieServerOption = 8
65
+ LPRServerOption = 9
66
+ ImpressServerOption = 10
67
+ ResourceLocationServerOption = 11
68
+ HostNameOption = 12
69
+ BootFileSizeOption = 13
70
+ MeritDumpFile = 14
71
+ DomainName = 15
72
+ SwapServer = 16
73
+ RootPath = 17
74
+ ExtensionsPath = 18
75
+ IPForwardingEnableDisableOption = 19
76
+ NonLocalSourceRoutingEnableDisableOption = 20
77
+ PolicyFilterOption = 21
78
+ MaximumDatagramReassemblySize = 22
79
+ DefaultIPTimeToLive = 23
80
+ PathMTUAgingTimeoutOption = 24
81
+ PathMTUPlateauTableOption = 25
82
+ InterfaceMTUOption = 26
83
+ AllSubnetsAreLocalOption = 27
84
+ BroadcastAddressOption = 28
85
+ PerformMaskDiscoveryOption = 29
86
+ MaskSupplierOption = 30
87
+ PerformRouterDiscoveryOption = 31
88
+ RouterSolicitationAddressOption = 32
89
+ StaticRouteOption = 33
90
+ TrailerEncapsulationOption = 34
91
+ ARPCacheTimeoutOption = 35
92
+ EthernetEncapsulationOption = 36
93
+ TCPDefaultTTLOption = 37
94
+ TCPKeepAliveIntervalOption = 38
95
+ TCPKeepAliveGarbageOption = 39
96
+ NetworkInformationServiceDomainOption = 40
97
+ NetworkInformationServersOption = 41
98
+ NetworkTimeProtocolServersOption = 42
99
+ VendorSpecificInformation = 43
100
+ NetBIOSOverTCPIPNameServerOption = 44
101
+ NetBIOSOverTCPIPDatagramDistributionServerOption = 45
102
+ NetBIOSOverTCPIPNodeTypeOption = 46
103
+ NetBIOSOverTCPIPScopeOption = 47
104
+ XWindowSystemFontServerOption = 48
105
+ XWindowSystemDisplayManagerOption = 49
106
+ NetworkInformationServicePlusDomainOption = 64
107
+ NetworkInformationServiceServersOption = 65
108
+ MobileIPHomeAgentOption = 68
109
+ SMTPServerOption = 69
110
+ POP3ServerOption = 70
111
+ NNTPServerOption = 71
112
+ WWWServerOption = 72
113
+ DefaultFingerServerOption = 73
114
+ DefaultIRCServerOption = 74
115
+ StreetTalkServerOption = 75
116
+ STDAServerOption = 76
117
+ RequestedIPAddress = 50
118
+ IPAddressLeaseTime = 51
119
+ OptionOverload = 52
120
+ TFTPServerName = 66
121
+ BootfileName = 67
122
+ DHCPMessageType = 53
123
+ ServerIdentifier = 54
124
+ ParameterRequestList = 55
125
+ Message = 56
126
+ MaximumDHCPMessageSize = 57
127
+ RenewalTimeValue = 58
128
+ RebindingTimeValue = 59
129
+ VendorClassIdentifier = 60
130
+ ClientIdentifier = 61
131
+
132
+
133
+ ####################################
134
+ # Ethernet #
135
+ ####################################
136
+ @dataclass
137
+ class Ethernet:
138
+ dst_mac: str = "0000.0000.0000"
139
+ src_mac: str = "0000.0000.0000"
140
+ ethertype: EtherType = EtherType.NONE
141
+
142
+ def __str__(self):
143
+ _dst_mac: str = self.dst_mac.replace(".", "")
144
+ _src_mac: str = self.src_mac.replace(".", "")
145
+ _ethertype: str = '{:04X}'.format(self.ethertype.value)
146
+ return f"{_dst_mac}{_src_mac}{_ethertype}".upper()
147
+
148
+ ####################################
149
+ # VLAN #
150
+ ####################################
151
+
152
+ @dataclass
153
+ class VLAN:
154
+ pri: int = 0
155
+ dei: int = 0
156
+ id: int = 0
157
+ type: EtherType = EtherType.NONE
158
+
159
+ def __str__(self):
160
+ _pri_dei: str = '{:01X}'.format((self.pri<<1)+self.dei)
161
+ _id: str = '{:03X}'.format(self.id)
162
+ _type: str = '{:04X}'.format(self.type.value)
163
+ return f"{_pri_dei}{_id}{_type}".upper()
164
+
165
+
166
+ ####################################
167
+ # ARP #
168
+ ####################################
169
+ @dataclass
170
+ class ARP:
171
+ hardware_type: ARPHardwareType = ARPHardwareType.Ethernet
172
+ protocol_type: EtherType = EtherType.IPv4
173
+ hardware_size: int = 6
174
+ protocol_size: int = 4
175
+ opcode: ARPOpcode = ARPOpcode.Request
176
+ sender_mac: str = "0000.0000.0000"
177
+ sender_ip: str = "0.0.0.0"
178
+ target_mac: str = "0000.0000.0000"
179
+ target_ip: str = "0.0.0.0"
180
+
181
+ def __str__(self):
182
+ _hardware_type: str = '{:04X}'.format(self.hardware_type.value)
183
+ _protocol_type: str = '{:04X}'.format(self.protocol_type.value)
184
+ _hardware_size: str = '{:02X}'.format(self.hardware_size)
185
+ _protocol_size: str = '{:02X}'.format(self.protocol_size)
186
+ _opcode: str = '{:04X}'.format(self.opcode.value)
187
+ _sender_mac: str = self.sender_mac.replace(".", "")
188
+ _sender_ip: str = hexlify(IPv4Address(self.sender_ip).packed).decode()
189
+ _target_mac: str = self.target_mac.replace(".", "")
190
+ _target_ip: str = hexlify(IPv4Address(self.target_ip).packed).decode()
191
+ return f"{_hardware_type}{_protocol_type}{_hardware_size}{_protocol_size}{_opcode}{_sender_mac}{_sender_ip}{_target_mac}{_target_ip}".upper()
192
+
193
+ ####################################
194
+ # IPv4 #
195
+ ####################################
196
+ @dataclass
197
+ class IPV4:
198
+ version: int = 4
199
+ header_length: int = 5
200
+ dscp: int = 0
201
+ ecn: int = 0
202
+ total_length: int = 0
203
+ identification: str = "0000"
204
+ flags: int = 0
205
+ offset: int = 0
206
+ ttl: int = 255
207
+ proto: IPProtocol = IPProtocol.NONE
208
+ checksum: str = "0000"
209
+ src: str = "0.0.0.0"
210
+ dst: str = "0.0.0.0"
211
+
212
+ def __str__(self):
213
+ _ver: str = '{:01X}'.format(self.version)
214
+ _header_length: str = '{:01X}'.format(self.header_length)
215
+ _dscp_ecn: str = '{:02X}'.format((self.dscp<<2)+self.ecn)
216
+ _total_len: str = '{:04X}'.format(self.total_length)
217
+ _ident: str = self.identification
218
+ _flag_offset: str = '{:04X}'.format((self.flags<<13)+self.offset)
219
+ _ttl: str = '{:02X}'.format(self.ttl)
220
+ _proto: str = '{:02X}'.format(self.proto.value)
221
+ _check: str = self.checksum
222
+ _src: str = hexlify(IPv4Address(self.src).packed).decode()
223
+ _dst: str = hexlify(IPv4Address(self.dst).packed).decode()
224
+ return f"{_ver}{_header_length}{_dscp_ecn}{_total_len}{_ident}{_flag_offset}{_ttl}{_proto}{_check}{_src}{_dst}".upper()
225
+
226
+ ####################################
227
+ # IPv6 #
228
+ ####################################
229
+ @dataclass
230
+ class IPV6:
231
+ version: int = 6
232
+ traff_class: int = 8
233
+ flow_label: int = 0
234
+ payload_length: int = 0
235
+ next_header: IPProtocol = IPProtocol.NONE
236
+ hop_limit: int = 1
237
+ src: str = "2000::2"
238
+ dst: str = "2000::100"
239
+
240
+ def __str__(self):
241
+ _ver: str = '{:01X}'.format(self.version)
242
+ _traff_class: str = '{:01X}'.format(self.traff_class)
243
+ _flow_label: str = '{:06X}'.format(self.flow_label)
244
+ _payload_len: str = '{:04X}'.format(self.payload_length)
245
+ _next_header: str = '{:02X}'.format(self.next_header.value)
246
+ _hop_limit: str = '{:02X}'.format(self.hop_limit)
247
+ _src: str = hexlify(IPv6Address(self.src).packed).decode()
248
+ _dst: str = hexlify(IPv6Address(self.dst).packed).decode()
249
+ return f"{_ver}{_traff_class}{_flow_label}{_payload_len}{_next_header}{_hop_limit}{_src}{_dst}".upper()
250
+
251
+ ####################################
252
+ # UDP #
253
+ ####################################
254
+ @dataclass
255
+ class UDP:
256
+ src_port: int = 0
257
+ dst_port: int = 0
258
+ length: int = 8
259
+ checksum = "0000"
260
+
261
+ def __str__(self):
262
+ _src_port: str = '{:04X}'.format(self.src_port)
263
+ _dst_port: str = '{:04X}'.format(self.dst_port)
264
+ _length: str = '{:04X}'.format(self.length)
265
+ _checksum: str = self.checksum
266
+ return f"{_src_port}{_dst_port}{_length}{_checksum}".upper()
267
+
268
+ ####################################
269
+ # TCP #
270
+ ####################################
271
+ @dataclass
272
+ class TCP:
273
+ src_port: int = 0
274
+ dst_port: int = 0
275
+ seq_num: int = 0
276
+ ack_num: int = 0
277
+ header_length: int = 20
278
+ """Aka. Data Offset (bytes)"""
279
+ rsrvd: int = 0
280
+ """Reserved 000"""
281
+ ae: int = 0
282
+ """Accurate ECN"""
283
+ cwr: int = 0
284
+ """Congestion Window Reduced"""
285
+ ece: int = 0
286
+ """ECN-Echo"""
287
+ urg: int = 0
288
+ """Urgent"""
289
+ ack: int = 0
290
+ """Acknowledgment"""
291
+ psh: int = 0
292
+ """Push"""
293
+ rst: int = 0
294
+ """Rest"""
295
+ syn: int = 0
296
+ """Sync"""
297
+ fin: int = 0
298
+ """Fin"""
299
+ window: int = 0
300
+ checksum: str = "0000"
301
+ urgent_pointer: int = 0
302
+
303
+ def __str__(self):
304
+ _src_port: str = '{:04X}'.format(self.src_port)
305
+ _dst_port: str = '{:04X}'.format(self.dst_port)
306
+ _seq_num: str = '{:08X}'.format(self.seq_num)
307
+ _ack_num: str = '{:08X}'.format(self.ack_num)
308
+ if self.header_length % 4 != 0:
309
+ raise Exception("Header Length field (bytes) must be multiple of 4")
310
+ _header_length: str = '{:01X}'.format(int(self.header_length/4))
311
+ _flags: int = 0
312
+ _flags += (self.rsrvd<<9)
313
+ _flags += (self.ae<<8)
314
+ _flags += (self.cwr<<7)
315
+ _flags += (self.ece<<6)
316
+ _flags += (self.urg<<5)
317
+ _flags += (self.ack<<4)
318
+ _flags += (self.psh<<3)
319
+ _flags += (self.rst<<2)
320
+ _flags += (self.syn<<1)
321
+ _flags += (self.fin<<0)
322
+ _flags_str: str = '{:03X}'.format(_flags)
323
+ _window: str = '{:04X}'.format(self.window)
324
+ _checksum: str = self.checksum
325
+ _urgent_pointer: str = '{:04X}'.format(self.urgent_pointer)
326
+
327
+ return f"{_src_port}{_dst_port}{_seq_num}{_ack_num}{_header_length}{_flags_str}{_window}{_checksum}{_urgent_pointer}".upper()
328
+
329
+ ####################################
330
+ # PTP #
331
+ ####################################
332
+ @dataclass
333
+ class PTP:
334
+ version_ptp: int = 1
335
+ version_network: int = 1
336
+ subdomain: str = "5f44464c540000000000000000000000"
337
+ message_type: int = 1
338
+ source_comm_tech: int = 1
339
+ source_uuid: str = "0030051d1e27"
340
+ source_port_id: int = 1
341
+ seq_id: int = 94
342
+ control_field: int = 0
343
+ flags: str = "0008"
344
+ original_timestamp_sec: int = 1163594296
345
+ original_timestamp_nsec: int = 247015000
346
+ epoch_num: int = 0
347
+ current_utc_offset: int = 0
348
+ gm_comm_tech: int = 1
349
+ gm_clock_uuid: str = "0030051d1e27"
350
+ gm_port_id: int = 0
351
+ gm_seq_id: int = 94
352
+ gm_clock_stratum: int = 4
353
+ gm_clock_id: str = "44464c54"
354
+ gm_clock_variance: int = -4000
355
+ gm_preferred: int = 0
356
+ gm_is_boundary_clock: int = 0
357
+ sync_interval: int = 1
358
+ local_clock_variance: int = -4000
359
+ local_step_removed: int = 0
360
+ local_clock_stratum: int = 4
361
+ local_clock_id: str = "44464c54"
362
+ parent_comm_tech: int = 1
363
+ parent_clock_uuid: str = "0030051D1E27"
364
+ parent_port_id: int = 0
365
+ est_master_variance: int = 0
366
+ est_master_drift: int = 0
367
+ utc_reasonable: int = 1
368
+
369
+ def __str__(self):
370
+ _version_ptp: str = '{:04X}'.format(self.version_ptp)
371
+ _version_network: str = '{:04X}'.format(self.version_network)
372
+ _subdomain: str = self.subdomain
373
+ _message_type: str = '{:02X}'.format(self.message_type)
374
+ _source_comm_tech: str = '{:02X}'.format(self.source_comm_tech)
375
+ _source_uuid: str = self.source_uuid
376
+ _source_port_id: str = '{:04X}'.format(self.source_port_id)
377
+ _sequence_id: str = '{:04X}'.format(self.seq_id)
378
+ _control_field: str = '{:02X}'.format(self.control_field)
379
+ _flags: str = self.flags
380
+ _original_timestamp_sec: str = '{:016X}'.format(self.original_timestamp_sec)
381
+ _original_timestamp_nsec: str = '{:016X}'.format(self.original_timestamp_nsec)
382
+ _epoch_num: str = '{:04X}'.format(self.epoch_num)
383
+ _current_utc_offset: str = '{:04X}'.format(self.current_utc_offset)
384
+ _gm_comm_tech: str = '{:02X}'.format(self.gm_comm_tech)
385
+ _gm_clock_uuid: str = self.gm_clock_uuid
386
+ _gm_port_id: str = '{:04X}'.format(self.gm_port_id)
387
+ _gm_seq_id: str = '{:04X}'.format(self.gm_seq_id)
388
+ _gm_clock_stratum: str = '{:02X}'.format(self.gm_clock_stratum)
389
+ _gm_clock_id: str = self.gm_clock_id
390
+ _gm_clock_variance: str = '{:04X}'.format(self.gm_clock_variance & ((1 << 16)-1))
391
+ _gm_preferred: str = '{:02X}'.format(self.gm_preferred)
392
+ _gm_is_boundary_clock: str = '{:02X}'.format(self.gm_is_boundary_clock)
393
+ _sync_interval: str = '{:02X}'.format(self.sync_interval)
394
+ _local_clock_variance: str = '{:04X}'.format(self.local_clock_variance & ((1 << 16)-1))
395
+ _local_step_removed: str = '{:04X}'.format(self.local_step_removed & ((1 << 16)-1))
396
+ _local_clock_stratum: str = '{:02X}'.format(self.local_clock_stratum)
397
+ _local_clock_id: str = self.local_clock_id
398
+ _parent_comm_tech: str = '{:02X}'.format(self.parent_comm_tech)
399
+ _parent_clock_uuid: str = self.parent_clock_uuid
400
+ _parent_port_id: str = '{:04X}'.format(self.parent_port_id)
401
+ _est_master_variance: str = '{:04X}'.format(self.est_master_variance & ((1 << 16)-1))
402
+ _est_master_drift: str = '{:08X}'.format(self.est_master_drift & ((1 << 16)-1))
403
+ _utc_reasonable: str = '{:02X}'.format(self.utc_reasonable)
404
+
405
+ return f"{_version_ptp}{_version_network}{_subdomain}{_message_type}{_source_comm_tech}{_source_uuid}{_source_port_id}{_sequence_id}{_control_field}00{_flags}00000000{_original_timestamp_sec}{_original_timestamp_nsec}{_epoch_num}{_current_utc_offset}00{_gm_comm_tech}{_gm_clock_uuid}{_gm_port_id}{_gm_seq_id}000000{_gm_clock_stratum}{_gm_clock_id}0000{_gm_clock_variance}00{_gm_preferred}00{_gm_is_boundary_clock}000000{_sync_interval}0000{_local_clock_variance}0000{_local_step_removed}000000{_local_clock_stratum}{_local_clock_id}00{_parent_comm_tech}{_parent_clock_uuid}0000{_parent_port_id}0000{_est_master_variance}{_est_master_drift}000000{_utc_reasonable}".upper()
406
+
407
+ ####################################
408
+ # eCPRI GeneralDataTransfer #
409
+ ####################################
410
+ @dataclass
411
+ class eCPRIGeneralDataTransfer:
412
+ protocol_rev: int = 1
413
+ c_bit: int = 0
414
+ message_type: str = "03"
415
+ payload_size = 24
416
+ pc_id: str= "12345678"
417
+ seq_id: str = "87654321"
418
+ user_data: str = "0f0e0d0c0b0a09080706050403020100"
419
+
420
+ def __str__(self):
421
+ _tmp: str = '{:02X}'.format((self.protocol_rev<<4)+self.c_bit)
422
+ _message_type: str = self.message_type
423
+ _payload_size: str = '{:04X}'.format(self.payload_size)
424
+ _pc_id: str = self.pc_id
425
+ _seq_id: str = self.seq_id
426
+ _user_data: str = self.user_data
427
+ return f"{_tmp}{_message_type}{_payload_size}{_pc_id}{_seq_id}{_user_data}".upper()
428
+
429
+ ####################################
430
+ # DHCPv4 #
431
+ ####################################
432
+ @dataclass
433
+ class DHCPV4:
434
+ op: DHCPOpcode = DHCPOpcode.BootRequest
435
+ """Message op code / message type"""
436
+
437
+ htype: int = 1
438
+ """Hardware address type"""
439
+
440
+ hlen: int = 6
441
+ """Hardware address length"""
442
+
443
+ hops: int = 0
444
+ """Client sets to zero, optionally used by relay agents when booting via a relay agent"""
445
+
446
+ xid: str = "00000000"
447
+ """Transaction ID, a random number chosen by the
448
+ client, used by the client and server to associate
449
+ messages and responses between a client and a
450
+ server.
451
+ """
452
+
453
+ secs: int = 0
454
+ """Filled in by client, seconds elapsed since client
455
+ began address acquisition or renewal process.
456
+ """
457
+
458
+ broadcast_flag: int = 0
459
+ """Broadcast flag"""
460
+
461
+ reserved_flags: int = 0
462
+ """Reserved flags, must be zero"""
463
+
464
+ ciaddr: str = "0.0.0.0"
465
+ """Client IP address; only filled in if client is in
466
+ BOUND, RENEW or REBINDING state and can respond
467
+ to ARP requests.
468
+ """
469
+
470
+ yiaddr: str = "0.0.0.0"
471
+ """'Your' (client) IP address.
472
+ """
473
+
474
+ siaddr: str = "0.0.0.0"
475
+ """IP address of next server to use in bootstrap;
476
+ returned in DHCPOFFER, DHCPACK by server.
477
+ """
478
+
479
+ giaddr: str = "0.0.0.0"
480
+ """Relay agent IP address, used in booting via a relay agent.
481
+ """
482
+
483
+ chaddr: str = "0000.0000.0000"
484
+ """Client hardware address (16 bytes). If less than 16 bytes are provided, padding will be used."""
485
+
486
+ sname: str = ""
487
+ """Optional server host name, null terminated string (64 bytes). If less than 64 bytes are provided, padding will be used."""
488
+
489
+ file: str = ""
490
+ """Boot file name, null terminated string (128 bytes). If less than 128 bytes are provided, padding will be used."""
491
+
492
+ magic_cookie: str = "63825363"
493
+
494
+ def __str__(self):
495
+ _op: str = '{:02X}'.format(self.op.value)
496
+ _htype: str = '{:02X}'.format(self.htype)
497
+ _hlen: str = '{:02X}'.format(self.hlen)
498
+ _hops: str = '{:02X}'.format(self.hops)
499
+ _xid: str = self.xid
500
+ _xid = "00"*(4-int(len(_xid)/2)) + _xid
501
+ _secs: str = '{:04X}'.format(self.secs)
502
+ _flag: str = '{:04X}'.format((self.broadcast_flag<<15)+self.reserved_flags)
503
+ _ciaddr: str = hexlify(IPv4Address(self.ciaddr).packed).decode()
504
+ _yiaddr: str = hexlify(IPv4Address(self.yiaddr).packed).decode()
505
+ _siaddr: str = hexlify(IPv4Address(self.siaddr).packed).decode()
506
+ _giaddr: str = hexlify(IPv4Address(self.giaddr).packed).decode()
507
+ _chaddr: str = self.chaddr.replace(".", "")
508
+ _chaddr = _chaddr + "00"*(16-int(len(_chaddr)/2))
509
+ _sname: str = self.sname + "00"*(64-int(len(self.sname)/2))
510
+ _file: str = self.file + "00"*(128-int(len(self.file)/2))
511
+ _magic_cookie: str = self.magic_cookie
512
+
513
+ return f"{_op}{_htype}{_hlen}{_hops}{_xid}{_secs}{_flag}{_ciaddr}{_yiaddr}{_siaddr}{_giaddr}{_chaddr}{_sname}{_file}{_magic_cookie}".upper()
514
+
515
+
516
+ ####################################
517
+ # DHCPv4 Options #
518
+ ####################################
519
+ @dataclass
520
+ class DHCPOptionMessageType:
521
+ type: DHCPMessageType = DHCPMessageType.Discover
522
+
523
+ def __str__(self):
524
+ _code: str = '{:02X}'.format(DHCPOptionCode.DHCPMessageType.value)
525
+ _len: str = '{:02X}'.format(1)
526
+ _type: str = '{:02X}'.format(self.type.value)
527
+ return f"{_code}{_len}{_type}".upper()
528
+
529
+ @dataclass
530
+ class DHCPOptionClientIdentifier:
531
+ len: int = 7
532
+ htype: int = 1
533
+ client_mac: str = "0000.0000.0000"
534
+
535
+ def __str__(self):
536
+ _code: str = '{:02X}'.format(DHCPOptionCode.ClientIdentifier.value)
537
+ _len: str = '{:02X}'.format(self.len)
538
+ _htype: str = '{:02X}'.format(self.htype)
539
+ _client_mac: str = self.client_mac.replace(".", "")
540
+ return f"{_code}{_len}{_htype}{_client_mac}".upper()
541
+
542
+ @dataclass
543
+ class DHCPOptionRequestedIP:
544
+ ip_addr: str = "0.0.0.0"
545
+
546
+ def __str__(self):
547
+ _code: str = '{:02X}'.format(DHCPOptionCode.RequestedIPAddress.value)
548
+ _len: str = '{:02X}'.format(4)
549
+ _ip_addr: str = hexlify(IPv4Address(self.ip_addr).packed).decode()
550
+ return f"{_code}{_len}{_ip_addr}".upper()
551
+
552
+ @dataclass
553
+ class DHCPOptionParamRequestList:
554
+ req_list: list = field(default_factory=list)
555
+
556
+ def __str__(self):
557
+ _code: str = '{:02X}'.format(DHCPOptionCode.ParameterRequestList.value)
558
+ _len: str = '{:02X}'.format(len(self.req_list))
559
+ _req_list: str = ""
560
+ for x in self.req_list:
561
+ _req_list += '{:02X}'.format(x)
562
+ return f"{_code}{_len}{_req_list}".upper()
563
+
564
+ @dataclass
565
+ class DHCPOptionPad:
566
+ def __str__(self):
567
+ _code: str = '{:02X}'.format(DHCPOptionCode.Pad.value)
568
+ return f"{_code}".upper()
569
+
570
+ @dataclass
571
+ class DHCPOptionEnd:
572
+ def __str__(self):
573
+ _code: str = '{:02X}'.format(DHCPOptionCode.End.value)
574
+ return f"{_code}".upper()
575
+
576
+
577
+ ####################################
578
+ # MAC Control PFC #
579
+ ####################################
580
+ @dataclass
581
+ class MACControlPFC:
582
+ opcode: str = "0101"
583
+ class_enable_list: list = field(default_factory=list)
584
+ class_quanta_list: list = field(default_factory=list)
585
+
586
+ def __str__(self):
587
+ self.class_enable_list = [False] * 8
588
+ self.class_quanta_list = [65535] * 8
589
+ _opcode: str = self.opcode
590
+ _class_enable_vector_str: str = ''.join([str(int(x)) for x in self.class_enable_list])
591
+ _class_enable_vector_int: int = int(_class_enable_vector_str, 2)
592
+ _class_enable_vector = '{:02X}'.format(_class_enable_vector_int)
593
+ _reserved: str = "00"
594
+ _class_quanta_list: str = ''.join([f"{x:04x}" for x in self.class_quanta_list])
595
+ return f"{_opcode}{_reserved}{_class_enable_vector}{_class_quanta_list}".upper()
596
+
597
+ ####################################
598
+ # MAC Control PAUSE #
599
+ ####################################
600
+ @dataclass
601
+ class MACControlPause:
602
+ opcode: str = "0001"
603
+ value: int = 65535
604
+
605
+ def __str__(self):
606
+ _opcode: str = self.opcode
607
+ _value = '{:04X}'.format(self.value)
608
+ return f"{_opcode}{_value}".upper()