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.
- tdl_xoa_driver-1.0.0b1.dist-info/LICENSE +202 -0
- tdl_xoa_driver-1.0.0b1.dist-info/METADATA +177 -0
- tdl_xoa_driver-1.0.0b1.dist-info/RECORD +325 -0
- tdl_xoa_driver-1.0.0b1.dist-info/WHEEL +5 -0
- tdl_xoa_driver-1.0.0b1.dist-info/top_level.txt +1 -0
- xoa_driver/__init__.py +2 -0
- xoa_driver/enums.py +399 -0
- xoa_driver/exceptions.py +77 -0
- xoa_driver/functions/__init__.py +0 -0
- xoa_driver/functions/anlt.py +744 -0
- xoa_driver/functions/anlt_ll_debug.py +429 -0
- xoa_driver/functions/cli.py +581 -0
- xoa_driver/functions/exceptions.py +72 -0
- xoa_driver/functions/headers.py +608 -0
- xoa_driver/functions/mgmt.py +515 -0
- xoa_driver/functions/tools.py +256 -0
- xoa_driver/hlfuncs.py +18 -0
- xoa_driver/internals/__init__.py +0 -0
- xoa_driver/internals/commands/__init__.py +31 -0
- xoa_driver/internals/commands/c_commands.py +2041 -0
- xoa_driver/internals/commands/enums.py +3289 -0
- xoa_driver/internals/commands/m4_commands.py +700 -0
- xoa_driver/internals/commands/m4e_commands.py +107 -0
- xoa_driver/internals/commands/m_commands.py +1875 -0
- xoa_driver/internals/commands/p4_commands.py +2221 -0
- xoa_driver/internals/commands/p4e_commands.py +160 -0
- xoa_driver/internals/commands/p4g_commands.py +7253 -0
- xoa_driver/internals/commands/p_commands.py +6000 -0
- xoa_driver/internals/commands/pc_commands.py +335 -0
- xoa_driver/internals/commands/pd_commands.py +355 -0
- xoa_driver/internals/commands/pe_commands.py +1018 -0
- xoa_driver/internals/commands/pec_commands.py +265 -0
- xoa_driver/internals/commands/ped_commands.py +1034 -0
- xoa_driver/internals/commands/pef_commands.py +2216 -0
- xoa_driver/internals/commands/pf_commands.py +379 -0
- xoa_driver/internals/commands/pl1_commands.py +1588 -0
- xoa_driver/internals/commands/pl_commands.py +178 -0
- xoa_driver/internals/commands/pm_commands.py +256 -0
- xoa_driver/internals/commands/pp_commands.py +2341 -0
- xoa_driver/internals/commands/pr_commands.py +812 -0
- xoa_driver/internals/commands/ps_commands.py +2311 -0
- xoa_driver/internals/commands/pt_commands.py +370 -0
- xoa_driver/internals/commands/px_commands.py +303 -0
- xoa_driver/internals/commands/subtypes.py +86 -0
- xoa_driver/internals/core/__init__.py +0 -0
- xoa_driver/internals/core/builders.py +39 -0
- xoa_driver/internals/core/exceptions.py +69 -0
- xoa_driver/internals/core/funcs.py +81 -0
- xoa_driver/internals/core/funcs.pyi +1072 -0
- xoa_driver/internals/core/interfaces.py +47 -0
- xoa_driver/internals/core/token.py +44 -0
- xoa_driver/internals/core/transporter/__init__.py +0 -0
- xoa_driver/internals/core/transporter/_processor.py +83 -0
- xoa_driver/internals/core/transporter/_publisher.py +101 -0
- xoa_driver/internals/core/transporter/_request_id_counter.py +28 -0
- xoa_driver/internals/core/transporter/_stream.py +99 -0
- xoa_driver/internals/core/transporter/_typings.py +43 -0
- xoa_driver/internals/core/transporter/exceptions.py +44 -0
- xoa_driver/internals/core/transporter/handler.py +127 -0
- xoa_driver/internals/core/transporter/logger/__init__.py +10 -0
- xoa_driver/internals/core/transporter/logger/__logger.py +94 -0
- xoa_driver/internals/core/transporter/logger/__state_off.py +32 -0
- xoa_driver/internals/core/transporter/logger/__state_on_default.py +70 -0
- xoa_driver/internals/core/transporter/logger/__state_on_loguru.py +51 -0
- xoa_driver/internals/core/transporter/logger/__state_on_user.py +48 -0
- xoa_driver/internals/core/transporter/protocol/__init__.py +0 -0
- xoa_driver/internals/core/transporter/protocol/_constants.py +77 -0
- xoa_driver/internals/core/transporter/protocol/_utils.py +59 -0
- xoa_driver/internals/core/transporter/protocol/exceptions.py +271 -0
- xoa_driver/internals/core/transporter/protocol/payload/__init__.py +70 -0
- xoa_driver/internals/core/transporter/protocol/payload/base_struct.py +283 -0
- xoa_driver/internals/core/transporter/protocol/payload/descriptor.py +119 -0
- xoa_driver/internals/core/transporter/protocol/payload/exceptions.py +20 -0
- xoa_driver/internals/core/transporter/protocol/payload/field.py +296 -0
- xoa_driver/internals/core/transporter/protocol/payload/types.py +173 -0
- xoa_driver/internals/core/transporter/protocol/payload/utils.py +53 -0
- xoa_driver/internals/core/transporter/protocol/struct_header.py +123 -0
- xoa_driver/internals/core/transporter/protocol/struct_request.py +65 -0
- xoa_driver/internals/core/transporter/protocol/struct_response.py +89 -0
- xoa_driver/internals/core/transporter/registry.py +43 -0
- xoa_driver/internals/exceptions/__init__.py +9 -0
- xoa_driver/internals/exceptions/modules.py +13 -0
- xoa_driver/internals/exceptions/testers.py +21 -0
- xoa_driver/internals/hli_v1/__init__.py +0 -0
- xoa_driver/internals/hli_v1/indices/__init__.py +0 -0
- xoa_driver/internals/hli_v1/indices/base_index.py +39 -0
- xoa_driver/internals/hli_v1/indices/connection_group/__init__.py +0 -0
- xoa_driver/internals/hli_v1/indices/connection_group/cg.py +186 -0
- xoa_driver/internals/hli_v1/indices/connection_group/histogram.py +78 -0
- xoa_driver/internals/hli_v1/indices/connection_group/l2.py +94 -0
- xoa_driver/internals/hli_v1/indices/connection_group/l3.py +130 -0
- xoa_driver/internals/hli_v1/indices/connection_group/raw.py +200 -0
- xoa_driver/internals/hli_v1/indices/connection_group/replay.py +109 -0
- xoa_driver/internals/hli_v1/indices/connection_group/tcp.py +314 -0
- xoa_driver/internals/hli_v1/indices/connection_group/tls.py +198 -0
- xoa_driver/internals/hli_v1/indices/connection_group/udp.py +133 -0
- xoa_driver/internals/hli_v1/indices/connection_group/user_state.py +28 -0
- xoa_driver/internals/hli_v1/indices/filter/__init__.py +0 -0
- xoa_driver/internals/hli_v1/indices/filter/base_filter.py +65 -0
- xoa_driver/internals/hli_v1/indices/filter/genuine_filter.py +20 -0
- xoa_driver/internals/hli_v1/indices/length_term.py +49 -0
- xoa_driver/internals/hli_v1/indices/macsecscs/__init__.py +0 -0
- xoa_driver/internals/hli_v1/indices/macsecscs/base_macsecsc.py +224 -0
- xoa_driver/internals/hli_v1/indices/macsecscs/genuine_macsecsc.py +72 -0
- xoa_driver/internals/hli_v1/indices/match_term.py +64 -0
- xoa_driver/internals/hli_v1/indices/port_dataset.py +72 -0
- xoa_driver/internals/hli_v1/indices/streams/__init__.py +0 -0
- xoa_driver/internals/hli_v1/indices/streams/base_stream.py +405 -0
- xoa_driver/internals/hli_v1/indices/streams/genuine_stream.py +64 -0
- xoa_driver/internals/hli_v1/modules/__init__.py +0 -0
- xoa_driver/internals/hli_v1/modules/__interfaces.py +21 -0
- xoa_driver/internals/hli_v1/modules/base_module.py +138 -0
- xoa_driver/internals/hli_v1/modules/module_chimera.py +366 -0
- xoa_driver/internals/hli_v1/modules/module_l23ve.py +73 -0
- xoa_driver/internals/hli_v1/modules/module_l47.py +397 -0
- xoa_driver/internals/hli_v1/modules/module_l47ve.py +9 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/__init__.py +0 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_combi.py +83 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_d.py +75 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_e.py +85 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_f.py +145 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_g.py +84 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_h.py +40 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_i.py +25 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_j.py +25 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_k.py +39 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_l.py +55 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_l1.py +800 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_m.py +25 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/family_n.py +40 -0
- xoa_driver/internals/hli_v1/modules/modules_l23/module_l23_base.py +383 -0
- xoa_driver/internals/hli_v1/ports/__init__.py +0 -0
- xoa_driver/internals/hli_v1/ports/base_port.py +125 -0
- xoa_driver/internals/hli_v1/ports/port_l23/__init__.py +0 -0
- xoa_driver/internals/hli_v1/ports/port_l23/bases/__init__.py +0 -0
- xoa_driver/internals/hli_v1/ports/port_l23/bases/port_capture.py +70 -0
- xoa_driver/internals/hli_v1/ports/port_l23/bases/port_l23.py +527 -0
- xoa_driver/internals/hli_v1/ports/port_l23/bases/port_l23_genuine.py +229 -0
- xoa_driver/internals/hli_v1/ports/port_l23/bases/port_reception_statistics.py +231 -0
- xoa_driver/internals/hli_v1/ports/port_l23/bases/port_transceiver.py +117 -0
- xoa_driver/internals/hli_v1/ports/port_l23/bases/port_transmission_statistics.py +131 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/__init__.py +0 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/__init__.py +0 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/_utils.py +15 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/general.py +396 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/shadow.py +104 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/filter_definition/working.py +36 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/pe_custom_distribution.py +125 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/pe_distribution.py +174 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/port_chimera.py +119 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/port_emulation.py +244 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/reception_statistics.py +24 -0
- xoa_driver/internals/hli_v1/ports/port_l23/chimera/transmission_statistics.py +24 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_combi.py +37 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_d.py +51 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_e.py +107 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_f.py +151 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_g.py +77 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_h.py +67 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_i.py +84 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_j.py +68 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_k.py +73 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_l.py +82 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_l1.py +166 -0
- xoa_driver/internals/hli_v1/ports/port_l23/family_m.py +29 -0
- xoa_driver/internals/hli_v1/ports/port_l23/fault_jkl.py +24 -0
- xoa_driver/internals/hli_v1/ports/port_l23/freya_l1.py +722 -0
- xoa_driver/internals/hli_v1/ports/port_l23/pcs_pma_ghijkl.py +369 -0
- xoa_driver/internals/hli_v1/ports/port_l23/pcs_pma_ijkl_chimera.py +60 -0
- xoa_driver/internals/hli_v1/ports/port_l23/pcs_pma_l.py +78 -0
- xoa_driver/internals/hli_v1/ports/port_l23/port_l23ve.py +101 -0
- xoa_driver/internals/hli_v1/ports/port_l47/__init__.py +0 -0
- xoa_driver/internals/hli_v1/ports/port_l47/counters.py +174 -0
- xoa_driver/internals/hli_v1/ports/port_l47/main.py +228 -0
- xoa_driver/internals/hli_v1/ports/port_l47/packet_engine.py +31 -0
- xoa_driver/internals/hli_v1/revisions.py +11 -0
- xoa_driver/internals/hli_v1/testers/__init__.py +0 -0
- xoa_driver/internals/hli_v1/testers/_base_tester.py +259 -0
- xoa_driver/internals/hli_v1/testers/genuine/__init__.py +0 -0
- xoa_driver/internals/hli_v1/testers/genuine/l_23/__init__.py +0 -0
- xoa_driver/internals/hli_v1/testers/genuine/l_23/health.py +16 -0
- xoa_driver/internals/hli_v1/testers/genuine/l_23/rest_api.py +38 -0
- xoa_driver/internals/hli_v1/testers/genuine/l_23/time_keeper.py +57 -0
- xoa_driver/internals/hli_v1/testers/genuine/l_23/upload_file.py +29 -0
- xoa_driver/internals/hli_v1/testers/genuine/management_interface.py +42 -0
- xoa_driver/internals/hli_v1/testers/l23_tester.py +196 -0
- xoa_driver/internals/hli_v1/testers/l23ve_tester.py +114 -0
- xoa_driver/internals/hli_v1/testers/l47_tester.py +106 -0
- xoa_driver/internals/hli_v1/testers/l47ve_tester.py +54 -0
- xoa_driver/internals/hli_v2/__init__.py +0 -0
- xoa_driver/internals/hli_v2/indices/__init__.py +0 -0
- xoa_driver/internals/hli_v2/indices/base_index.py +39 -0
- xoa_driver/internals/hli_v2/indices/connection_group/__init__.py +0 -0
- xoa_driver/internals/hli_v2/indices/connection_group/cg.py +115 -0
- xoa_driver/internals/hli_v2/indices/connection_group/histogram.py +59 -0
- xoa_driver/internals/hli_v2/indices/connection_group/l2.py +71 -0
- xoa_driver/internals/hli_v2/indices/connection_group/l3.py +96 -0
- xoa_driver/internals/hli_v2/indices/connection_group/raw.py +148 -0
- xoa_driver/internals/hli_v2/indices/connection_group/replay.py +89 -0
- xoa_driver/internals/hli_v2/indices/connection_group/tcp.py +261 -0
- xoa_driver/internals/hli_v2/indices/connection_group/tls.py +166 -0
- xoa_driver/internals/hli_v2/indices/connection_group/udp.py +112 -0
- xoa_driver/internals/hli_v2/indices/connection_group/user_state.py +25 -0
- xoa_driver/internals/hli_v2/indices/filter/__init__.py +0 -0
- xoa_driver/internals/hli_v2/indices/filter/base_filter.py +50 -0
- xoa_driver/internals/hli_v2/indices/filter/genuine_filter.py +17 -0
- xoa_driver/internals/hli_v2/indices/length_term.py +44 -0
- xoa_driver/internals/hli_v2/indices/match_term.py +49 -0
- xoa_driver/internals/hli_v2/indices/port_dataset.py +53 -0
- xoa_driver/internals/hli_v2/indices/streams/__init__.py +0 -0
- xoa_driver/internals/hli_v2/indices/streams/base_stream.py +234 -0
- xoa_driver/internals/hli_v2/indices/streams/genuine_stream.py +32 -0
- xoa_driver/internals/hli_v2/modules/__init__.py +0 -0
- xoa_driver/internals/hli_v2/modules/__interfaces.py +21 -0
- xoa_driver/internals/hli_v2/modules/base_module.py +125 -0
- xoa_driver/internals/hli_v2/modules/module_chimera.py +358 -0
- xoa_driver/internals/hli_v2/modules/module_l23ve.py +58 -0
- xoa_driver/internals/hli_v2/modules/module_l47.py +230 -0
- xoa_driver/internals/hli_v2/modules/module_l47ve.py +8 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/__init__.py +0 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_combi.py +73 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_d.py +75 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_e.py +85 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_f.py +144 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_g.py +84 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_h.py +40 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_i.py +25 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_j.py +25 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_k.py +39 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_l.py +55 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_l1.py +797 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_m.py +25 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/family_n.py +40 -0
- xoa_driver/internals/hli_v2/modules/modules_l23/module_l23_base.py +339 -0
- xoa_driver/internals/hli_v2/ports/__init__.py +0 -0
- xoa_driver/internals/hli_v2/ports/base_port.py +105 -0
- xoa_driver/internals/hli_v2/ports/port_l23/__init__.py +0 -0
- xoa_driver/internals/hli_v2/ports/port_l23/bases/__init__.py +0 -0
- xoa_driver/internals/hli_v2/ports/port_l23/bases/port_capture.py +64 -0
- xoa_driver/internals/hli_v2/ports/port_l23/bases/port_l23.py +441 -0
- xoa_driver/internals/hli_v2/ports/port_l23/bases/port_l23_genuine.py +172 -0
- xoa_driver/internals/hli_v2/ports/port_l23/bases/port_reception_statistics.py +156 -0
- xoa_driver/internals/hli_v2/ports/port_l23/bases/port_transceiver.py +117 -0
- xoa_driver/internals/hli_v2/ports/port_l23/bases/port_transmission_statistics.py +59 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/__init__.py +0 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/__init__.py +0 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/_utils.py +15 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/general.py +340 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/shadow.py +99 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/filter_definition/working.py +36 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_custom_distribution.py +116 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/pe_distribution.py +102 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/port_chimera.py +113 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/port_emulation.py +420 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/reception_statistics.py +22 -0
- xoa_driver/internals/hli_v2/ports/port_l23/chimera/transmission_statistics.py +22 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_combi.py +36 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_d.py +49 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_e.py +96 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_f.py +144 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_g.py +77 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_h.py +60 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_i.py +66 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_j.py +53 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_k.py +58 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_l.py +67 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_l1.py +149 -0
- xoa_driver/internals/hli_v2/ports/port_l23/family_m.py +28 -0
- xoa_driver/internals/hli_v2/ports/port_l23/fault_jkl.py +22 -0
- xoa_driver/internals/hli_v2/ports/port_l23/pcs_pma_ghijkl.py +342 -0
- xoa_driver/internals/hli_v2/ports/port_l23/pcs_pma_ijkl_chimera.py +50 -0
- xoa_driver/internals/hli_v2/ports/port_l23/pcs_pma_l.py +65 -0
- xoa_driver/internals/hli_v2/ports/port_l23/port_l23ve.py +81 -0
- xoa_driver/internals/hli_v2/ports/port_l47/__init__.py +0 -0
- xoa_driver/internals/hli_v2/ports/port_l47/counters.py +146 -0
- xoa_driver/internals/hli_v2/ports/port_l47/main.py +137 -0
- xoa_driver/internals/hli_v2/ports/port_l47/packet_engine.py +20 -0
- xoa_driver/internals/hli_v2/revisions.py +11 -0
- xoa_driver/internals/hli_v2/testers/__init__.py +0 -0
- xoa_driver/internals/hli_v2/testers/_base_tester.py +207 -0
- xoa_driver/internals/hli_v2/testers/genuine/__init__.py +0 -0
- xoa_driver/internals/hli_v2/testers/genuine/l_23/__init__.py +0 -0
- xoa_driver/internals/hli_v2/testers/genuine/l_23/health.py +16 -0
- xoa_driver/internals/hli_v2/testers/genuine/l_23/rest_api.py +34 -0
- xoa_driver/internals/hli_v2/testers/genuine/l_23/time_keeper.py +50 -0
- xoa_driver/internals/hli_v2/testers/genuine/l_23/upload_file.py +26 -0
- xoa_driver/internals/hli_v2/testers/genuine/management_interface.py +38 -0
- xoa_driver/internals/hli_v2/testers/l23_tester.py +159 -0
- xoa_driver/internals/hli_v2/testers/l23ve_tester.py +98 -0
- xoa_driver/internals/hli_v2/testers/l47_tester.py +95 -0
- xoa_driver/internals/hli_v2/testers/l47ve_tester.py +50 -0
- xoa_driver/internals/state_storage/__init__.py +0 -0
- xoa_driver/internals/state_storage/_speed_detector.py +121 -0
- xoa_driver/internals/state_storage/modules_state.py +128 -0
- xoa_driver/internals/state_storage/ports_state.py +154 -0
- xoa_driver/internals/state_storage/testers_state.py +104 -0
- xoa_driver/internals/utils/__init__.py +0 -0
- xoa_driver/internals/utils/attributes.py +33 -0
- xoa_driver/internals/utils/cap_id.py +63 -0
- xoa_driver/internals/utils/con_traffic_light.py +88 -0
- xoa_driver/internals/utils/indices/__init__.py +0 -0
- xoa_driver/internals/utils/indices/_interfaces.py +26 -0
- xoa_driver/internals/utils/indices/header_modifier_manager.py +56 -0
- xoa_driver/internals/utils/indices/index_manager.py +95 -0
- xoa_driver/internals/utils/indices/observer.py +17 -0
- xoa_driver/internals/utils/kind.py +19 -0
- xoa_driver/internals/utils/managers/__init__.py +0 -0
- xoa_driver/internals/utils/managers/abc.py +44 -0
- xoa_driver/internals/utils/managers/exceptions.py +22 -0
- xoa_driver/internals/utils/managers/modules_manager.py +118 -0
- xoa_driver/internals/utils/managers/ports_manager.py +116 -0
- xoa_driver/internals/utils/rev_tool.py +21 -0
- xoa_driver/internals/utils/session.py +117 -0
- xoa_driver/internals/warn.py +32 -0
- xoa_driver/lli.py +15 -0
- xoa_driver/misc.py +57 -0
- xoa_driver/modules.py +448 -0
- xoa_driver/ports.py +332 -0
- xoa_driver/testers.py +37 -0
- xoa_driver/utils.py +12 -0
- xoa_driver/v2/__init__.py +11 -0
- xoa_driver/v2/misc.py +77 -0
- xoa_driver/v2/modules.py +308 -0
- xoa_driver/v2/ports.py +232 -0
- xoa_driver/v2/testers.py +24 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import NoReturn, TypeVar
|
|
2
|
+
from xoa_driver.internals.commands.enums import FilterType
|
|
3
|
+
|
|
4
|
+
T = TypeVar("T")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def prevent_set(inst: T, filter_type: FilterType = FilterType.WORKING) -> T:
|
|
8
|
+
METHOD_NAME = "set"
|
|
9
|
+
|
|
10
|
+
def _set(*args, **kwargs) -> NoReturn:
|
|
11
|
+
raise Exception(f"Method {METHOD_NAME} is not allowed")
|
|
12
|
+
|
|
13
|
+
if filter_type is FilterType.WORKING and hasattr(inst, METHOD_NAME):
|
|
14
|
+
setattr(inst, METHOD_NAME, _set)
|
|
15
|
+
return inst
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
Dict,
|
|
3
|
+
Tuple,
|
|
4
|
+
Type,
|
|
5
|
+
TypeVar,
|
|
6
|
+
TYPE_CHECKING
|
|
7
|
+
)
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from xoa_driver.internals.core import interfaces as itf
|
|
10
|
+
from xoa_driver.internals.commands.enums import (
|
|
11
|
+
FilterType,
|
|
12
|
+
FilterVlanType,
|
|
13
|
+
ProtocolOption,
|
|
14
|
+
FilterMode,
|
|
15
|
+
)
|
|
16
|
+
from xoa_driver.internals.commands import (
|
|
17
|
+
PEF_ETHSETTINGS,
|
|
18
|
+
PEF_ETHSRCADDR,
|
|
19
|
+
PEF_ETHDESTADDR,
|
|
20
|
+
PEF_L2PUSE,
|
|
21
|
+
PEF_VLANSETTINGS,
|
|
22
|
+
PEF_VLANTAG,
|
|
23
|
+
PEF_VLANPCP,
|
|
24
|
+
PEF_MPLSSETTINGS,
|
|
25
|
+
PEF_MPLSLABEL,
|
|
26
|
+
PEF_MPLSTOC,
|
|
27
|
+
PEF_L3USE,
|
|
28
|
+
PEF_IPV4SETTINGS,
|
|
29
|
+
PEF_IPV4SRCADDR,
|
|
30
|
+
PEF_IPV4DESTADDR,
|
|
31
|
+
PEF_IPV4DSCP,
|
|
32
|
+
PEF_IPV6SETTINGS,
|
|
33
|
+
PEF_IPV6SRCADDR,
|
|
34
|
+
PEF_IPV6DESTADDR,
|
|
35
|
+
PEF_IPV6TC,
|
|
36
|
+
PEF_UDPSETTINGS,
|
|
37
|
+
PEF_UDPSRCPORT,
|
|
38
|
+
PEF_UDPDESTPORT,
|
|
39
|
+
PEF_TCPSETTINGS,
|
|
40
|
+
PEF_TCPSRCPORT,
|
|
41
|
+
PEF_TCPDESTPORT,
|
|
42
|
+
PEF_ANYSETTINGS,
|
|
43
|
+
PEF_ANYCONFIG,
|
|
44
|
+
PEF_TPLDSETTINGS,
|
|
45
|
+
PEF_TPLDCONFIG,
|
|
46
|
+
# PEF_ISSHADOWDIRTY, #TODO: need to implement
|
|
47
|
+
# PEF_CANCEL, #TODO: need to implement
|
|
48
|
+
PEF_VALUE,
|
|
49
|
+
PEF_MASK,
|
|
50
|
+
PEF_PROTOCOL,
|
|
51
|
+
PEF_MODE,
|
|
52
|
+
)
|
|
53
|
+
from ._utils import prevent_set
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class FEthernet:
|
|
57
|
+
"""Filter for Ethernet field."""
|
|
58
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
59
|
+
self.settings = prevent_set(PEF_ETHSETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
60
|
+
"""Filter action on Ethernet field.
|
|
61
|
+
|
|
62
|
+
:type: PEF_ETHSETTINGS
|
|
63
|
+
"""
|
|
64
|
+
self.src_address = prevent_set(PEF_ETHSRCADDR(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
65
|
+
"""Ethernet source address settings for the filter.
|
|
66
|
+
|
|
67
|
+
:type: PEF_ETHSRCADDR
|
|
68
|
+
"""
|
|
69
|
+
self.dest_address = prevent_set(PEF_ETHDESTADDR(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
70
|
+
"""Ethernet destination address settings for the filter.
|
|
71
|
+
|
|
72
|
+
:type: PEF_ETHDESTADDR
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class FPerVlanType:
|
|
77
|
+
"""Filter for VLAN tag."""
|
|
78
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType, vlan_type: FilterVlanType) -> None:
|
|
79
|
+
self.tag = prevent_set(PEF_VLANTAG(conn, module_id, port_id, flow_index, filter_type, vlan_type), filter_type)
|
|
80
|
+
"""VLAN tag setting for the filter.
|
|
81
|
+
|
|
82
|
+
:type: PEF_VLANTAG
|
|
83
|
+
"""
|
|
84
|
+
self.pcp = prevent_set(PEF_VLANPCP(conn, module_id, port_id, flow_index, filter_type, vlan_type), filter_type)
|
|
85
|
+
"""VLAN PCP setting for the filter.
|
|
86
|
+
|
|
87
|
+
:type: PEF_VLANPCP
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class FVlan:
|
|
92
|
+
"""Filter for VLAN field."""
|
|
93
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
94
|
+
self.settings = prevent_set(PEF_VLANSETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
95
|
+
"""Filter action on VLAN field.
|
|
96
|
+
|
|
97
|
+
:type: PEF_VLANSETTINGS
|
|
98
|
+
"""
|
|
99
|
+
|
|
100
|
+
self.inner = FPerVlanType(conn, module_id, port_id, flow_index, filter_type, FilterVlanType.INNER)
|
|
101
|
+
"""Filter for inner VLAN tag."""
|
|
102
|
+
|
|
103
|
+
self.outer = FPerVlanType(conn, module_id, port_id, flow_index, filter_type, FilterVlanType.OUTER)
|
|
104
|
+
"""Filter for outer VLAN tag."""
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class FUdp:
|
|
108
|
+
"""Filer for UDP field."""
|
|
109
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
110
|
+
self.settings = prevent_set(PEF_UDPSETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
111
|
+
"""Filter action on UDP field.
|
|
112
|
+
|
|
113
|
+
:type: PEF_UDPSETTINGS
|
|
114
|
+
"""
|
|
115
|
+
self.src_port = prevent_set(PEF_UDPSRCPORT(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
116
|
+
"""UDP source port settings for the filter.
|
|
117
|
+
|
|
118
|
+
:type: PEF_UDPSRCPORT
|
|
119
|
+
"""
|
|
120
|
+
self.dest_port = prevent_set(PEF_UDPDESTPORT(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
121
|
+
"""UDP destination port settings for the filter.
|
|
122
|
+
|
|
123
|
+
:type: PEF_UDPDESTPORT
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class FTcp:
|
|
128
|
+
"""Filter for TCP."""
|
|
129
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
130
|
+
self.settings = prevent_set(PEF_TCPSETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
131
|
+
"""Filter action on TCP field.
|
|
132
|
+
|
|
133
|
+
:type: PEF_TCPSETTINGS
|
|
134
|
+
"""
|
|
135
|
+
self.src_port = prevent_set(PEF_TCPSRCPORT(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
136
|
+
"""TCP source port settings for the filter.
|
|
137
|
+
|
|
138
|
+
:type: PEF_TCPSRCPORT
|
|
139
|
+
"""
|
|
140
|
+
self.dest_port = prevent_set(PEF_TCPDESTPORT(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
141
|
+
"""TCP destination port settings for the filter.
|
|
142
|
+
|
|
143
|
+
:type: PEF_TCPDESTPORT
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class FIPv4:
|
|
148
|
+
"""Filter for IPv4 field."""
|
|
149
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
150
|
+
self.settings = prevent_set(PEF_IPV4SETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
151
|
+
"""Filter action on IPv4 field.
|
|
152
|
+
|
|
153
|
+
:type: PEF_IPV4SETTINGS
|
|
154
|
+
"""
|
|
155
|
+
self.src_address = prevent_set(PEF_IPV4SRCADDR(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
156
|
+
"""IPv4 source address settings for the filter.
|
|
157
|
+
|
|
158
|
+
:type: PEF_IPV4SRCADDR
|
|
159
|
+
"""
|
|
160
|
+
self.dest_address = prevent_set(PEF_IPV4DESTADDR(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
161
|
+
"""IPv4 destination address settings for the filter.
|
|
162
|
+
|
|
163
|
+
:type: PEF_IPV4DESTADDR
|
|
164
|
+
"""
|
|
165
|
+
self.dscp = prevent_set(PEF_IPV4DSCP(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
166
|
+
"""IPv4 DSCP/TOS settings for the filter.
|
|
167
|
+
|
|
168
|
+
:type: PEF_IPV4DSCP
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class FIPv6:
|
|
173
|
+
"""Filter for IPv6 field."""
|
|
174
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
175
|
+
self.settings = prevent_set(PEF_IPV6SETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
176
|
+
"""Filter action on IPv6 field.
|
|
177
|
+
|
|
178
|
+
:type: PEF_IPV6SETTINGS
|
|
179
|
+
"""
|
|
180
|
+
self.src_address = prevent_set(PEF_IPV6SRCADDR(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
181
|
+
"""IPv6 source address settings for the filter.
|
|
182
|
+
|
|
183
|
+
:type: PEF_IPV6SRCADDR
|
|
184
|
+
"""
|
|
185
|
+
self.dest_address = prevent_set(PEF_IPV6DESTADDR(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
186
|
+
"""IPv6 destination address settings for the filter.
|
|
187
|
+
|
|
188
|
+
:type: PEF_IPV6DESTADDR
|
|
189
|
+
"""
|
|
190
|
+
self.traffic_class = prevent_set(PEF_IPV6TC(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
191
|
+
"""IPv6 traffic class settings for the filter.
|
|
192
|
+
|
|
193
|
+
:type: PEF_IPV6TC
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class FIp:
|
|
198
|
+
"""Filter for IP field."""
|
|
199
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
200
|
+
self.v4 = FIPv4(conn, module_id, port_id, flow_index, filter_type)
|
|
201
|
+
"""Filter for IPv4 field."""
|
|
202
|
+
|
|
203
|
+
self.v6 = FIPv6(conn, module_id, port_id, flow_index, filter_type)
|
|
204
|
+
"""Filter for IPv6 field."""
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class FMpls:
|
|
208
|
+
"""Filter for MPLS field."""
|
|
209
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
210
|
+
self.settings = prevent_set(PEF_MPLSSETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
211
|
+
"""Filter action on MPLS field.
|
|
212
|
+
|
|
213
|
+
:type: PEF_MPLSSETTINGS
|
|
214
|
+
"""
|
|
215
|
+
self.label = prevent_set(PEF_MPLSLABEL(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
216
|
+
"""MPLS label settings for the filter.
|
|
217
|
+
|
|
218
|
+
:type: PEF_MPLSLABEL
|
|
219
|
+
"""
|
|
220
|
+
self.toc = prevent_set(PEF_MPLSTOC(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
221
|
+
""""MPLS TOC settings for the filter.
|
|
222
|
+
|
|
223
|
+
:type: PEF_MPLSTOC
|
|
224
|
+
"""
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
class FTpld:
|
|
228
|
+
"""Filter for Xena TPLD field."""
|
|
229
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
230
|
+
self.settings = prevent_set(PEF_TPLDSETTINGS(conn, module_id, port_id, flow_index, filter_type))
|
|
231
|
+
"""Filter action on Xena TPLD field.
|
|
232
|
+
|
|
233
|
+
:type: PEF_TPLDSETTINGS
|
|
234
|
+
"""
|
|
235
|
+
|
|
236
|
+
self.test_payload_filters_config = tuple(
|
|
237
|
+
prevent_set(PEF_TPLDCONFIG(conn, module_id, port_id, flow_index, filter_type, test_payload_filter_index), filter_type)
|
|
238
|
+
for test_payload_filter_index in range(16) # range need to put to the constants place
|
|
239
|
+
)
|
|
240
|
+
"""TPLD filter configurations.
|
|
241
|
+
|
|
242
|
+
:type: PEF_TPLDCONFIG
|
|
243
|
+
"""
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class FAny:
|
|
247
|
+
"""Filter for any field."""
|
|
248
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
249
|
+
self.settings = prevent_set(PEF_ANYSETTINGS(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
250
|
+
"""Filter action on any field.
|
|
251
|
+
|
|
252
|
+
:type: PEF_ANYSETTINGS
|
|
253
|
+
"""
|
|
254
|
+
self.config = prevent_set(PEF_ANYCONFIG(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
255
|
+
"""Any field's filter configurations.
|
|
256
|
+
|
|
257
|
+
:type: PEF_ANYCONFIG
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class ModeBasic:
|
|
262
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
263
|
+
self.l2plus_use = prevent_set(PEF_L2PUSE(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
264
|
+
"""L2 protocol to use.
|
|
265
|
+
|
|
266
|
+
:type: PEF_L2PUSE
|
|
267
|
+
"""
|
|
268
|
+
self.l3_use = prevent_set(PEF_L3USE(conn, module_id, port_id, flow_index, filter_type), filter_type)
|
|
269
|
+
"""L3 protocol to use.
|
|
270
|
+
|
|
271
|
+
:type: PEF_L3USE
|
|
272
|
+
"""
|
|
273
|
+
self.any = FAny(conn, module_id, port_id, flow_index, filter_type)
|
|
274
|
+
"""Filter for any field.
|
|
275
|
+
|
|
276
|
+
:type: FAny
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
self.tpld = FTpld(conn, module_id, port_id, flow_index, filter_type)
|
|
280
|
+
"""Filter for Xena TPLD field.
|
|
281
|
+
|
|
282
|
+
:type: FTpld
|
|
283
|
+
"""
|
|
284
|
+
|
|
285
|
+
self.mpls = FMpls(conn, module_id, port_id, flow_index, filter_type)
|
|
286
|
+
"""Filter for MPLS field.
|
|
287
|
+
|
|
288
|
+
:type: FMpls
|
|
289
|
+
"""
|
|
290
|
+
|
|
291
|
+
self.ip = FIp(conn, module_id, port_id, flow_index, filter_type)
|
|
292
|
+
"""Filter for IP field.
|
|
293
|
+
|
|
294
|
+
:type: FIp
|
|
295
|
+
"""
|
|
296
|
+
|
|
297
|
+
self.tcp = FTcp(conn, module_id, port_id, flow_index, filter_type)
|
|
298
|
+
"""Filter for TCP field.
|
|
299
|
+
|
|
300
|
+
:type: FTcp
|
|
301
|
+
"""
|
|
302
|
+
|
|
303
|
+
self.udp = FUdp(conn, module_id, port_id, flow_index, filter_type)
|
|
304
|
+
"""Filter for UDP field.
|
|
305
|
+
|
|
306
|
+
:type: FUdp
|
|
307
|
+
"""
|
|
308
|
+
|
|
309
|
+
self.vlan = FVlan(conn, module_id, port_id, flow_index, filter_type)
|
|
310
|
+
"""Filter for VLAN field.
|
|
311
|
+
|
|
312
|
+
:type: FVlan
|
|
313
|
+
"""
|
|
314
|
+
|
|
315
|
+
self.ethernet = FEthernet(conn, module_id, port_id, flow_index, filter_type)
|
|
316
|
+
"""Filter for Ethernet field.
|
|
317
|
+
|
|
318
|
+
:type: FEthernet
|
|
319
|
+
"""
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class ProtocolSegment:
|
|
323
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType, protocol_segment_index: int, segment_type: ProtocolOption) -> None: # noqa: E501
|
|
324
|
+
self.segment_type = segment_type
|
|
325
|
+
|
|
326
|
+
self.value = prevent_set(PEF_VALUE(conn, module_id, port_id, flow_index, filter_type, protocol_segment_index), filter_type)
|
|
327
|
+
"""Value bytes match for the filter.
|
|
328
|
+
|
|
329
|
+
:type: PEF_VALUE
|
|
330
|
+
"""
|
|
331
|
+
self.mask = prevent_set(PEF_MASK(conn, module_id, port_id, flow_index, filter_type, protocol_segment_index), filter_type)
|
|
332
|
+
"""Mask byte value.
|
|
333
|
+
|
|
334
|
+
:type: PEF_MASK
|
|
335
|
+
"""
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
class ModeExtended:
|
|
339
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType) -> None:
|
|
340
|
+
self._conn = conn
|
|
341
|
+
self._module_id = module_id
|
|
342
|
+
self._port_id = port_id
|
|
343
|
+
self._flow_index = flow_index
|
|
344
|
+
self._filter_type = filter_type
|
|
345
|
+
|
|
346
|
+
# self.protocol = prevent_set(PEF_PROTOCOL(conn, module_id, port_id, flow_index, filter_type))
|
|
347
|
+
# """Protocol segments match for the filter.
|
|
348
|
+
#
|
|
349
|
+
# :type: PEF_PROTOCOL
|
|
350
|
+
# """
|
|
351
|
+
|
|
352
|
+
async def get_protocol_segments(self) -> Tuple[ProtocolSegment, ...]:
|
|
353
|
+
segments_raw = (
|
|
354
|
+
await PEF_PROTOCOL(
|
|
355
|
+
self._conn,
|
|
356
|
+
self._module_id,
|
|
357
|
+
self._port_id,
|
|
358
|
+
self._flow_index,
|
|
359
|
+
self._filter_type
|
|
360
|
+
).get()
|
|
361
|
+
).segment_list
|
|
362
|
+
return tuple(
|
|
363
|
+
ProtocolSegment(
|
|
364
|
+
self._conn,
|
|
365
|
+
self._module_id,
|
|
366
|
+
self._port_id,
|
|
367
|
+
self._flow_index,
|
|
368
|
+
self._filter_type,
|
|
369
|
+
idx + 1, # TODO: need to discuss with Leo
|
|
370
|
+
ProtocolOption(segment_type)
|
|
371
|
+
)
|
|
372
|
+
for idx, segment_type in enumerate(segments_raw)
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
T = TypeVar("T")
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
async def get_mode(conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int, filter_type: FilterType, mode_types: Dict[FilterMode, Type[T]]) -> T:
|
|
380
|
+
mode_raw = (
|
|
381
|
+
await PEF_MODE(
|
|
382
|
+
conn,
|
|
383
|
+
module_id,
|
|
384
|
+
port_id,
|
|
385
|
+
flow_index,
|
|
386
|
+
filter_type,
|
|
387
|
+
).get()
|
|
388
|
+
).mode
|
|
389
|
+
mode_type = mode_types[FilterMode(mode_raw)]
|
|
390
|
+
return mode_type(
|
|
391
|
+
conn,
|
|
392
|
+
module_id,
|
|
393
|
+
port_id,
|
|
394
|
+
flow_index,
|
|
395
|
+
filter_type,
|
|
396
|
+
)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
TYPE_CHECKING,
|
|
3
|
+
Dict,
|
|
4
|
+
Type,
|
|
5
|
+
Union
|
|
6
|
+
)
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from xoa_driver.internals.core import interfaces as itf
|
|
9
|
+
from xoa_driver.internals.commands.enums import (
|
|
10
|
+
FilterType,
|
|
11
|
+
ProtocolOption,
|
|
12
|
+
FilterMode,
|
|
13
|
+
)
|
|
14
|
+
from xoa_driver.internals.commands import (
|
|
15
|
+
PEF_INIT,
|
|
16
|
+
PEF_APPLY,
|
|
17
|
+
PEF_ENABLE,
|
|
18
|
+
PEF_PROTOCOL,
|
|
19
|
+
PEF_MODE,
|
|
20
|
+
PEF_CANCEL,
|
|
21
|
+
)
|
|
22
|
+
from . import general
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ModeExtendedS(general.ModeExtended):
|
|
26
|
+
async def use_segments(self, *segments: ProtocolOption) -> None:
|
|
27
|
+
segments_payload = [
|
|
28
|
+
ProtocolOption.ETHERNET,
|
|
29
|
+
*segments
|
|
30
|
+
]
|
|
31
|
+
await PEF_PROTOCOL(
|
|
32
|
+
self._conn,
|
|
33
|
+
self._module_id,
|
|
34
|
+
self._port_id,
|
|
35
|
+
self._flow_index,
|
|
36
|
+
self._filter_type
|
|
37
|
+
).set(segments_payload)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class FilterDefinitionShadow:
|
|
41
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int) -> None:
|
|
42
|
+
self._conn = conn
|
|
43
|
+
self._module_id = module_id
|
|
44
|
+
self._port_id = port_id
|
|
45
|
+
self._flow_index = flow_index
|
|
46
|
+
self._filter_type = FilterType.SHADOW
|
|
47
|
+
|
|
48
|
+
self.initiating = PEF_INIT(conn, module_id, port_id, flow_index)
|
|
49
|
+
"""Preparing filter definition.
|
|
50
|
+
|
|
51
|
+
:type: PEF_INIT
|
|
52
|
+
"""
|
|
53
|
+
self.apply = PEF_APPLY(conn, module_id, port_id, flow_index)
|
|
54
|
+
"""Apply filter definition.
|
|
55
|
+
|
|
56
|
+
:type: PEF_APPLY
|
|
57
|
+
"""
|
|
58
|
+
self.enable = PEF_ENABLE(conn, module_id, port_id, flow_index, self._filter_type)
|
|
59
|
+
"""Enabling the filter.
|
|
60
|
+
|
|
61
|
+
:type: PEF_ENABLE
|
|
62
|
+
"""
|
|
63
|
+
self.cancel = PEF_CANCEL(conn, module_id, port_id, flow_index)
|
|
64
|
+
"""Cancel changes made to Shadow and restores them to the ones in Working.
|
|
65
|
+
|
|
66
|
+
:type: PEF_CANCEL
|
|
67
|
+
"""
|
|
68
|
+
# self.mode = PEF_MODE(conn, module_id, port_id, flow_index, self._filter_type)
|
|
69
|
+
# """Filter mode.
|
|
70
|
+
#
|
|
71
|
+
# :type: PEF_MODE`
|
|
72
|
+
# """
|
|
73
|
+
|
|
74
|
+
async def get_mode(self) -> Union[general.ModeBasic, ModeExtendedS]:
|
|
75
|
+
mode_types: Dict[FilterMode, Type[Union[general.ModeBasic, ModeExtendedS]]] = {
|
|
76
|
+
FilterMode.BASIC: general.ModeBasic,
|
|
77
|
+
FilterMode.EXTENDED: ModeExtendedS,
|
|
78
|
+
}
|
|
79
|
+
return await general.get_mode(
|
|
80
|
+
self._conn,
|
|
81
|
+
self._module_id,
|
|
82
|
+
self._port_id,
|
|
83
|
+
self._flow_index,
|
|
84
|
+
self._filter_type,
|
|
85
|
+
mode_types
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
async def use_basic_mode(self) -> None:
|
|
89
|
+
await PEF_MODE(
|
|
90
|
+
self._conn,
|
|
91
|
+
self._module_id,
|
|
92
|
+
self._port_id,
|
|
93
|
+
self._flow_index,
|
|
94
|
+
self._filter_type,
|
|
95
|
+
).set_basic()
|
|
96
|
+
|
|
97
|
+
async def use_extended_mode(self) -> None:
|
|
98
|
+
await PEF_MODE(
|
|
99
|
+
self._conn,
|
|
100
|
+
self._module_id,
|
|
101
|
+
self._port_id,
|
|
102
|
+
self._flow_index,
|
|
103
|
+
self._filter_type,
|
|
104
|
+
).set_extended()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
Dict,
|
|
3
|
+
Type,
|
|
4
|
+
Union,
|
|
5
|
+
TYPE_CHECKING
|
|
6
|
+
)
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from xoa_driver.internals.core import interfaces as itf
|
|
9
|
+
from xoa_driver.internals.commands.enums import (
|
|
10
|
+
FilterType,
|
|
11
|
+
FilterMode,
|
|
12
|
+
)
|
|
13
|
+
from . import general
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class FilterDefinitionWorking:
|
|
17
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int, flow_index: int) -> None:
|
|
18
|
+
self._conn = conn
|
|
19
|
+
self._module_id = module_id
|
|
20
|
+
self._port_id = port_id
|
|
21
|
+
self._flow_index = flow_index
|
|
22
|
+
self._filter_type = FilterType.WORKING
|
|
23
|
+
|
|
24
|
+
async def get_mode(self) -> Union[general.ModeBasic, general.ModeExtended]:
|
|
25
|
+
mode_types: Dict[FilterMode, Type[Union[general.ModeBasic, general.ModeExtended]]] = {
|
|
26
|
+
FilterMode.BASIC: general.ModeBasic,
|
|
27
|
+
FilterMode.EXTENDED: general.ModeExtended,
|
|
28
|
+
}
|
|
29
|
+
return await general.get_mode(
|
|
30
|
+
self._conn,
|
|
31
|
+
self._module_id,
|
|
32
|
+
self._port_id,
|
|
33
|
+
self._flow_index,
|
|
34
|
+
self._filter_type,
|
|
35
|
+
mode_types
|
|
36
|
+
)
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
from typing import (
|
|
2
|
+
TYPE_CHECKING,
|
|
3
|
+
List,
|
|
4
|
+
)
|
|
5
|
+
if TYPE_CHECKING:
|
|
6
|
+
from xoa_driver.internals.core import interfaces as itf
|
|
7
|
+
from xoa_driver.internals.commands import (
|
|
8
|
+
PEC_INDICES,
|
|
9
|
+
PEC_VAL,
|
|
10
|
+
PEC_COMMENT,
|
|
11
|
+
PEC_DELETE,
|
|
12
|
+
PEC_DISTTYPE,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
from xoa_driver.internals.utils.indices import observer
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CustomDistribution:
|
|
19
|
+
"""Custom distribution"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, observer: "observer.IndicesObserver", conn: "itf.IConnection", module_id: int, port_id: int, custom_distribution_index: int) -> None:
|
|
22
|
+
self.__observer = observer
|
|
23
|
+
self.__conn = conn
|
|
24
|
+
self.__module_id = module_id
|
|
25
|
+
self.__port_id = port_id
|
|
26
|
+
self.__cdi = custom_distribution_index
|
|
27
|
+
self.definition = PEC_VAL(conn, module_id, port_id, custom_distribution_index)
|
|
28
|
+
"""Custom distribution definition.
|
|
29
|
+
|
|
30
|
+
:type: PEC_VAL
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
self.comment = PEC_COMMENT(conn, module_id, port_id, custom_distribution_index)
|
|
34
|
+
"""Custom distribution description.
|
|
35
|
+
|
|
36
|
+
:type: PEC_COMMENT
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
self.type = PEC_DISTTYPE(conn, module_id, port_id, custom_distribution_index)
|
|
40
|
+
"""Custom distribution type.
|
|
41
|
+
|
|
42
|
+
:type: PEC_DISTTYPE
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
async def delete(self) -> None:
|
|
46
|
+
"""
|
|
47
|
+
Deleting an existing Custom Distribution
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
await PEC_DELETE(
|
|
51
|
+
self.__conn,
|
|
52
|
+
self.__module_id,
|
|
53
|
+
self.__port_id,
|
|
54
|
+
self.__cdi
|
|
55
|
+
).set()
|
|
56
|
+
self.__observer.notify(observer.IndexEvents.DEL, self)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class CustomDistributions:
|
|
60
|
+
"""Custom distributions"""
|
|
61
|
+
|
|
62
|
+
def __init__(self, conn: "itf.IConnection", module_id: int, port_id: int) -> None:
|
|
63
|
+
self.__conn = conn
|
|
64
|
+
self.__module_id = module_id
|
|
65
|
+
self.__port_id = port_id
|
|
66
|
+
self.__items: List[CustomDistribution] = []
|
|
67
|
+
self.__observer = observer.IndicesObserver()
|
|
68
|
+
self.__observer.subscribe(
|
|
69
|
+
observer.IndexEvents.DEL,
|
|
70
|
+
self.__remove_from_slot
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
async def server_sync(self) -> None:
|
|
74
|
+
"""Sync the indices with xenaserver"""
|
|
75
|
+
|
|
76
|
+
_resp = await PEC_INDICES(self.__conn, self.__module_id, self.__port_id).get()
|
|
77
|
+
self.__items = [
|
|
78
|
+
CustomDistribution(
|
|
79
|
+
self.__observer,
|
|
80
|
+
self.__conn,
|
|
81
|
+
self.__module_id,
|
|
82
|
+
self.__port_id,
|
|
83
|
+
idx
|
|
84
|
+
)
|
|
85
|
+
for idx in _resp.indexations
|
|
86
|
+
]
|
|
87
|
+
|
|
88
|
+
def __len__(self) -> int:
|
|
89
|
+
"""Return the number of existing indices"""
|
|
90
|
+
return len(self.__items)
|
|
91
|
+
|
|
92
|
+
def __iter__(self):
|
|
93
|
+
self.__k = 0
|
|
94
|
+
return self
|
|
95
|
+
|
|
96
|
+
def __next__(self):
|
|
97
|
+
try:
|
|
98
|
+
v = self.__items[self.__k]
|
|
99
|
+
except IndexError:
|
|
100
|
+
raise StopIteration()
|
|
101
|
+
else:
|
|
102
|
+
self.__k += 1
|
|
103
|
+
return v
|
|
104
|
+
|
|
105
|
+
def __getitem__(self, key: int):
|
|
106
|
+
return self.__items[key]
|
|
107
|
+
|
|
108
|
+
def __remove_from_slot(self, index_inst: "CustomDistribution") -> None:
|
|
109
|
+
# throws ValueError if element is not exists in list of indices
|
|
110
|
+
self.__items.remove(index_inst)
|
|
111
|
+
|
|
112
|
+
async def assign(self, idx_cuantity: int = 0) -> None:
|
|
113
|
+
"""
|
|
114
|
+
Assign Custom distribution indices, all indices which is out of range will be removed.
|
|
115
|
+
``idx_cuantity`` permitted values is: 0 <= idx_cuantity <= 40
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
if not (0 <= idx_cuantity <= 40):
|
|
119
|
+
raise ValueError("idx_cuantity must be in range of: 0 <= idx_cuantity <= 40")
|
|
120
|
+
await PEC_INDICES(self.__conn, self.__module_id, self.__port_id).set([i for i in range(idx_cuantity)])
|
|
121
|
+
await self.server_sync()
|
|
122
|
+
|
|
123
|
+
async def remove(self, position_idx: int) -> None:
|
|
124
|
+
"""Remove a index from port"""
|
|
125
|
+
await self.__items[position_idx].delete()
|