[wip] decoding basic OMCI structure
This commit is contained in:
162
.gitignore
vendored
Normal file
162
.gitignore
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
# ---> Python
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
9
LICENSE
Normal file
9
LICENSE
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 brenozd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
10
README.md
Normal file
10
README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# omci_decoder
|
||||
|
||||
A WIP OMCI message decoder following G.988-2022-11 guideline
|
||||
|
||||
# Usage:
|
||||
```bash
|
||||
./main.py my_omci_file.txt
|
||||
```
|
||||
|
||||
Each line that have a hex OMCI coded message must begin with `capture:` followed by the message
|
||||
31
main.py
Executable file
31
main.py
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from src import message
|
||||
|
||||
|
||||
def parse_msgs(file_path: Path) -> list[str]:
|
||||
lines: list[str]
|
||||
with open(file_path) as file:
|
||||
lines = [line.rstrip() for line in file]
|
||||
|
||||
msgs: list[str] = []
|
||||
for line in lines:
|
||||
if "capture:" in line:
|
||||
start_index = line.index("capture:") + len("capture:")
|
||||
msgs.append(line[start_index:].strip())
|
||||
|
||||
return msgs
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
term_size: os.terminal_size = os.get_terminal_size()
|
||||
for arg in sys.argv[1:]:
|
||||
msgs = parse_msgs(Path(arg))
|
||||
for msg in msgs:
|
||||
msg_omci = message.OMCIMessage(msg)
|
||||
|
||||
print("-" * term_size.columns)
|
||||
print(msg_omci)
|
||||
print("-" * term_size.columns)
|
||||
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
336
src/managed_entity.py
Normal file
336
src/managed_entity.py
Normal file
@@ -0,0 +1,336 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ManagedEntity(Enum):
|
||||
UNKNOWN = 0
|
||||
ONT_B_PON = 1
|
||||
ONU_DATA = 2
|
||||
PON_IF_LINE_CARDHOLDER = 3
|
||||
PON_IF_LINE_CARD = 4
|
||||
CARDHOLDER = 5
|
||||
CIRCUIT_PACK = 6
|
||||
SOFTWARE_IMAGE = 7
|
||||
ONI_B_PON = 8
|
||||
TC_ADAPTER_PON = 9
|
||||
PHYSICAL_PATH_TERMINATION_POINT_ATM_UNI = 10
|
||||
PHYSICAL_PATH_TERMINATION_POINT_ETHERNET_UNI = 11
|
||||
PHYSICAL_PATH_TERMINATION_POINT_CES_UNI = 12
|
||||
LOGICAL_NX64_KBIT_SUB_PORT_CONNECTION_TERMINATION_POINT = 13
|
||||
INTERWORKING_VCC_TERMINATION_POINT = 14
|
||||
AAL1_PROFILES_PON = 15
|
||||
AAL5_PROFILE = 16
|
||||
AAL1_PROTOCOL_MONITORING_HISTORY_DATA_PON = 17
|
||||
AAL5_PERFORMANCE_MONITORING_HISTORY_DATA = 18
|
||||
AAL2_PROFILE = 19
|
||||
INTENTIONALLY_LEFT_BLANK_20 = 20
|
||||
CES_SERVICE_PROFILE = 21
|
||||
RESERVED_22 = 22
|
||||
CES_PHYSICAL_INTERFACE_PERFORMANCE_MONITORING_HISTORY_DATA = 23
|
||||
ETHERNET_PERFORMANCE_MONITORING_HISTORY_DATA = 24
|
||||
VP_NETWORK_CTP_PON = 25
|
||||
ATM_VP_CROSS_CONNECTION = 26
|
||||
PRIORITY_QUEUE_PON = 27
|
||||
DBR_CBR_TRAFFIC_DESCRIPTOR = 28
|
||||
UBR_TRAFFIC_DESCRIPTOR = 29
|
||||
SBR1_VBR1_TRAFFIC_DESCRIPTOR = 30
|
||||
SBR2_VBR2_TRAFFIC_DESCRIPTOR = 31
|
||||
SBR3_VBR3_TRAFFIC_DESCRIPTOR = 32
|
||||
ABR_TRAFFIC_DESCRIPTOR = 33
|
||||
GFR_TRAFFIC_DESCRIPTOR = 34
|
||||
ABT_DT_IT_TRAFFIC_DESCRIPTOR = 35
|
||||
UPC_DISAGREEMENT_MONITORING_HISTORY_DATA_PON = 36
|
||||
INTENTIONALLY_LEFT_BLANK_37 = 37
|
||||
ANI_B_PON = 38
|
||||
PON_TC_ADAPTER = 39
|
||||
PON_PHYSICAL_PATH_TERMINATION_POINT = 40
|
||||
TC_ADAPTER_PROTOCOL_MONITORING_HISTORY_DATA = 41
|
||||
THRESHOLD_DATA_PON = 42
|
||||
OPERATOR_SPECIFIC = 43
|
||||
VENDOR_SPECIFIC = 44
|
||||
MAC_BRIDGE_SERVICE_PROFILE = 45
|
||||
MAC_BRIDGE_CONFIGURATION_DATA = 46
|
||||
MAC_BRIDGE_PORT_CONFIGURATION_DATA = 47
|
||||
MAC_BRIDGE_PORT_DESIGNATION_DATA = 48
|
||||
MAC_BRIDGE_PORT_FILTER_TABLE_DATA = 49
|
||||
MAC_BRIDGE_PORT_BRIDGE_TABLE_DATA = 50
|
||||
MAC_BRIDGE_PERFORMANCE_MONITORING_HISTORY_DATA = 51
|
||||
MAC_BRIDGE_PORT_PERFORMANCE_MONITORING_HISTORY_DATA = 52
|
||||
PHYSICAL_PATH_TERMINATION_POINT_POTS_UNI = 53
|
||||
VOICE_CTP = 54
|
||||
VOICE_PM_HISTORY_DATA = 55
|
||||
AAL2_PVC_PROFILE_PON = 56
|
||||
AAL2_CPS_PROTOCOL_MONITORING_HISTORY_DATA_PON = 57
|
||||
VOICE_SERVICE_PROFILE = 58
|
||||
LES_SERVICE_PROFILE = 59
|
||||
AAL2_SSCS_PARAMETER_PROFILE1 = 60
|
||||
AAL2_SSCS_PARAMETER_PROFILE2 = 61
|
||||
VP_PERFORMANCE_MONITORING_HISTORY_DATA = 62
|
||||
TRAFFIC_SCHEDULERS_PON = 63
|
||||
T_CONT_BUFFER = 64
|
||||
UBR_PLUS_TRAFFIC_DESCRIPTOR = 65
|
||||
AAL2_SSCS_PROTOCOL_MONITORING_HISTORY_DATA_PON = 66
|
||||
IP_PORT_CONFIGURATION_DATA = 67
|
||||
IP_ROUTER_SERVICE_PROFILE = 68
|
||||
IP_ROUTER_CONFIGURATION_DATA = 69
|
||||
IP_ROUTER_PERFORMANCE_MONITORING_HISTORY_DATA_1 = 70
|
||||
IP_ROUTER_PERFORMANCE_MONITORING_HISTORY_DATA_2 = 71
|
||||
ICMP_PERFORMANCE_MONITORING_HISTORY_DATA_1 = 72
|
||||
ICMP_PERFORMANCE_MONITORING_HISTORY_DATA_2 = 73
|
||||
IP_ROUTE_TABLE = 74
|
||||
IP_STATIC_ROUTES = 75
|
||||
ARP_SERVICE_PROFILE = 76
|
||||
ARP_CONFIGURATION_DATA = 77
|
||||
VLAN_TAGGING_OPERATION_CONFIGURATION_DATA = 78
|
||||
MAC_BRIDGE_PORT_FILTER_PRE_ASSIGN_TABLE = 79
|
||||
PHYSICAL_PATH_TERMINATION_POINT_ISDN_UNI = 80
|
||||
PHYSICAL_PATH_TERMINATION_POINT_VIDEO_UNI = 82
|
||||
PHYSICAL_PATH_TERMINATION_POINT_LCT_UNI = 83
|
||||
VLAN_TAGGING_FILTER_DATA = 84
|
||||
ONU_REMOTE = 85
|
||||
ATM_VC_CROSS_CONNECTION = 86
|
||||
VC_NETWORK_CTP_PON = 87
|
||||
VC_PM_HISTORY_DATA = 88
|
||||
ETHERNET_PERFORMANCE_MONITORING_HISTORY_DATA_2 = 89
|
||||
PHYSICAL_PATH_TERMINATION_POINT_VIDEO_ANI = 90
|
||||
PHYSICAL_PATH_TERMINATION_POINT_IEEE_802_11_UNI = 91
|
||||
IEEE_802_11_STATION_MANAGEMENT_DATA_1 = 92
|
||||
IEEE_802_11_STATION_MANAGEMENT_DATA_2 = 93
|
||||
IEEE_802_11_GENERAL_PURPOSE_OBJECT = 94
|
||||
IEEE_802_11_MAC_AND_PHY_OPERATION_AND_ANTENNA_DATA = 95
|
||||
IEEE_802_11_PERFORMANCE_MONITORING_HISTORY_DATA = 96
|
||||
IEEE_802_11_PHY_FHSS_DSSS_IR_TABLES = 97
|
||||
PHYSICAL_PATH_TERMINATION_POINT_XDSL_UNI_PART_1 = 98
|
||||
PHYSICAL_PATH_TERMINATION_POINT_XDSL_UNI_PART_2 = 99
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_1 = 100
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_2 = 101
|
||||
XDSL_CHANNEL_DOWNSTREAM_STATUS_DATA = 102
|
||||
XDSL_CHANNEL_UPSTREAM_STATUS_DATA = 103
|
||||
XDSL_LINE_CONFIGURATION_PROFILE_PART_1 = 104
|
||||
XDSL_LINE_CONFIGURATION_PROFILE_PART_2 = 105
|
||||
XDSL_LINE_CONFIGURATION_PROFILE_PART_3 = 106
|
||||
XDSL_CHANNEL_CONFIGURATION_PROFILE = 107
|
||||
XDSL_SUBCARRIER_MASKING_DOWNSTREAM_PROFILE = 108
|
||||
XDSL_SUBCARRIER_MASKING_UPSTREAM_PROFILE = 109
|
||||
XDSL_PSD_MASK_PROFILE = 110
|
||||
XDSL_DOWNSTREAM_RFI_BANDS_PROFILE = 111
|
||||
XDSL_XTU_C_PERFORMANCE_MONITORING_HISTORY_DATA_PART_1 = 112
|
||||
XDSL_XTU_R_PERFORMANCE_MONITORING_HISTORY_DATA = 113
|
||||
XDSL_XTU_C_CHANNEL_PERFORMANCE_MONITORING_HISTORY_DATA = 114
|
||||
XDSL_XTU_R_CHANNEL_PERFORMANCE_MONITORING_HISTORY_DATA = 115
|
||||
TC_ADAPTOR_PERFORMANCE_MONITORING_HISTORY_DATA_XDSL = 116
|
||||
PHYSICAL_PATH_TERMINATION_POINT_VDSL_UNI_FTU_O_VDSL1 = 117
|
||||
VDSL_VTU_O_PHYSICAL_DATA = 118
|
||||
VDSL_VTU_R_PHYSICAL_DATA = 119
|
||||
VDSL_CHANNEL_DATA = 120
|
||||
VDSL_LINE_CONFIGURATION_PROFILE = 121
|
||||
VDSL_CHANNEL_CONFIGURATION_PROFILE = 122
|
||||
VDSL_BAND_PLAN_CONFIGURATION_PROFILE = 123
|
||||
VDSL_VTU_O_PHYSICAL_INTERFACE_MONITORING_HISTORY_DATA = 124
|
||||
VDSL_VTU_R_PHYSICAL_INTERFACE_MONITORING_HISTORY_DATA = 125
|
||||
VDSL_VTU_O_CHANNEL_PERFORMANCE_MONITORING_HISTORY_DATA = 126
|
||||
VDSL_VTU_R_CHANNEL_PERFORMANCE_MONITORING_HISTORY_DATA = 127
|
||||
VIDEO_RETURN_PATH_SERVICE_PROFILE = 128
|
||||
VIDEO_RETURN_PATH_PERFORMANCE_MONITORING_HISTORY_DATA = 129
|
||||
IEEE_802_1P_MAPPER_SERVICE_PROFILE = 130
|
||||
OLT_G = 131
|
||||
MULTICAST_INTERWORKING_VCC_TERMINATION_POINT = 132
|
||||
ONU_POWER_SHEDDING = 133
|
||||
IP_HOST_CONFIG_DATA = 134
|
||||
IP_HOST_PERFORMANCE_MONITORING_HISTORY_DATA = 135
|
||||
TCP_UDP_CONFIG_DATA = 136
|
||||
NETWORK_ADDRESS = 137
|
||||
VOIP_CONFIG_DATA = 138
|
||||
VOIP_VOICE_CTP = 139
|
||||
CALL_CONTROL_PERFORMANCE_MONITORING_HISTORY_DATA = 140
|
||||
VOIP_LINE_STATUS = 141
|
||||
VOIP_MEDIA_PROFILE = 142
|
||||
RTP_PROFILE_DATA = 143
|
||||
RTP_PERFORMANCE_MONITORING_HISTORY_DATA = 144
|
||||
NETWORK_DIAL_PLAN_TABLE = 145
|
||||
VOIP_APPLICATION_SERVICE_PROFILE = 146
|
||||
VOIP_FEATURE_ACCESS_CODES = 147
|
||||
AUTHENTICATION_SECURITY_METHOD = 148
|
||||
SIP_CONFIG_PORTAL = 149
|
||||
SIP_AGENT_CONFIG_DATA = 150
|
||||
SIP_AGENT_PERFORMANCE_MONITORING_HISTORY_DATA = 151
|
||||
SIP_CALL_INITIATION_PERFORMANCE_MONITORING_HISTORY_DATA = 152
|
||||
SIP_USER_DATA = 153
|
||||
MGC_CONFIG_PORTAL = 154
|
||||
MGC_CONFIG_DATA = 155
|
||||
MGC_PERFORMANCE_MONITORING_HISTORY_DATA = 156
|
||||
LARGE_STRING = 157
|
||||
ONU_REMOTE_DEBUG = 158
|
||||
EQUIPMENT_PROTECTION_PROFILE = 159
|
||||
EQUIPMENT_EXTENSION_PACKAGE = 160
|
||||
PORT_MAPPING_PACKAGE_PON = 161
|
||||
PHYSICAL_PATH_TERMINATION_POINT_MOCA_UNI = 162
|
||||
MOCA_ETHERNET_PERFORMANCE_MONITORING_HISTORY_DATA = 163
|
||||
MOCA_INTERFACE_PERFORMANCE_MONITORING_HISTORY_DATA = 164
|
||||
VDSL2_LINE_CONFIGURATION_EXTENSIONS = 165
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_3 = 166
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_4 = 167
|
||||
VDSL2_LINE_INVENTORY_AND_STATUS_DATA_PART_1 = 168
|
||||
VDSL2_LINE_INVENTORY_AND_STATUS_DATA_PART_2 = 169
|
||||
VDSL2_LINE_INVENTORY_AND_STATUS_DATA_PART_3 = 170
|
||||
EXTENDED_VLAN_TAGGING_OPERATION_CONFIGURATION_DATA = 171
|
||||
ONU_G = 256
|
||||
ONU2_G = 257
|
||||
ONU_G_DEPRECATED = 258
|
||||
ONU2_G_DEPRECATED = 259
|
||||
PON_IF_LINE_CARD_G = 260
|
||||
PON_TC_ADAPTER_G = 261
|
||||
T_CONT = 262
|
||||
ANI_G = 263
|
||||
UNI_G = 264
|
||||
ATM_INTERWORKING_VCC_TERMINATION_POINT = 265
|
||||
GEM_INTERWORKING_TERMINATION_POINT = 266
|
||||
GEM_PORT_PERFORMANCE_MONITORING_HISTORY_DATA_OBSOLETE = 267
|
||||
GEM_PORT_NETWORK_CTP = 268
|
||||
VP_NETWORK_CTP = 269
|
||||
VC_NETWORK_CTP_G = 270
|
||||
GAL_TDM_PROFILE_DEPRECATED = 271
|
||||
GAL_ETHERNET_PROFILE = 272
|
||||
THRESHOLD_DATA_1 = 273
|
||||
THRESHOLD_DATA_2 = 274
|
||||
GAL_TDM_PERFORMANCE_MONITORING_HISTORY_DATA_DEPRECATED = 275
|
||||
GAL_ETHERNET_PERFORMANCE_MONITORING_HISTORY_DATA = 276
|
||||
PRIORITY_QUEUE = 277
|
||||
TRAFFIC_SCHEDULER = 278
|
||||
PROTECTION_DATA = 279
|
||||
TRAFFIC_DESCRIPTOR = 280
|
||||
MULTICAST_GEM_INTERWORKING_TERMINATION_POINT = 281
|
||||
PSEUDOWIRE_TERMINATION_POINT = 282
|
||||
RTP_PSEUDOWIRE_PARAMETERS = 283
|
||||
PSEUDOWIRE_MAINTENANCE_PROFILE = 284
|
||||
PSEUDOWIRE_PERFORMANCE_MONITORING_HISTORY_DATA = 285
|
||||
ETHERNET_FLOW_TERMINATION_POINT = 286
|
||||
OMCI = 287
|
||||
MANAGED_ENTITY = 288
|
||||
ATTRIBUTE = 289
|
||||
DOT1X_PORT_EXTENSION_PACKAGE = 290
|
||||
DOT1X_CONFIGURATION_PROFILE = 291
|
||||
DOT1X_PERFORMANCE_MONITORING_HISTORY_DATA = 292
|
||||
RADIUS_PERFORMANCE_MONITORING_HISTORY_DATA = 293
|
||||
TU_CTP = 294
|
||||
TU_PERFORMANCE_MONITORING_HISTORY_DATA = 295
|
||||
ETHERNET_PERFORMANCE_MONITORING_HISTORY_DATA_3 = 296
|
||||
PORT_MAPPING_PACKAGE = 297
|
||||
DOT1_RATE_LIMITER = 298
|
||||
DOT1AG_MAINTENANCE_DOMAIN = 299
|
||||
DOT1AG_MAINTENANCE_ASSOCIATION = 300
|
||||
DOT1AG_DEFAULT_MD_LEVEL = 301
|
||||
DOT1AG_MEP = 302
|
||||
DOT1AG_MEP_STATUS = 303
|
||||
DOT1AG_MEP_CCM_DATABASE = 304
|
||||
DOT1AG_CFM_STACK = 305
|
||||
DOT1AG_CHASSIS_MANAGEMENT_INFO = 306
|
||||
OCTET_STRING = 307
|
||||
GENERAL_PURPOSE_BUFFER = 308
|
||||
MULTICAST_OPERATIONS_PROFILE = 309
|
||||
MULTICAST_SUBSCRIBER_CONFIG_INFO = 310
|
||||
MULTICAST_SUBSCRIBER_MONITOR = 311
|
||||
FEC_PERFORMANCE_MONITORING_HISTORY_DATA = 312
|
||||
RE_ANI_G = 313
|
||||
PHYSICAL_PATH_TERMINATION_POINT_RE_UNI = 314
|
||||
RE_UPSTREAM_AMPLIFIER = 315
|
||||
RE_DOWNSTREAM_AMPLIFIER = 316
|
||||
RE_CONFIG_PORTAL = 317
|
||||
FILE_TRANSFER_CONTROLLER = 318
|
||||
CES_PHYSICAL_INTERFACE_PM_HISTORY_DATA_2 = 319
|
||||
CES_PHYSICAL_INTERFACE_PM_HISTORY_DATA_3 = 320
|
||||
ETHERNET_FRAME_PM_HISTORY_DATA_DOWNSTREAM = 321
|
||||
ETHERNET_FRAME_PM_HISTORY_DATA_UPSTREAM = 322
|
||||
VDSL2_LINE_CONFIGURATION_EXTENSIONS_2 = 323
|
||||
XDSL_IMPULSE_NOISE_MONITOR_PM_HISTORY_DATA = 324
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_5 = 325
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_6 = 326
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_7 = 327
|
||||
RE_COMMON_AMPLIFIER_PARAMETERS = 328
|
||||
VIRTUAL_ETHERNET_INTERFACE_POINT = 329
|
||||
GENERIC_STATUS_PORTAL = 330
|
||||
ONU_E = 331
|
||||
ENHANCED_SECURITY_CONTROL = 332
|
||||
MPLS_PSEUDOWIRE_TERMINATION_POINT = 333
|
||||
ETHERNET_FRAME_EXTENDED_PM = 334
|
||||
SNMP_CONFIGURATION_DATA = 335
|
||||
ONU_DYNAMIC_POWER_MANAGEMENT_CONTROL = 336
|
||||
PW_ATM_CONFIGURATION_DATA = 337
|
||||
PW_ATM_PM_HISTORY_DATA = 338
|
||||
PW_ETHERNET_CONFIGURATION_DATA = 339
|
||||
BBF_TR_069_MANAGEMENT_SERVER = 340
|
||||
GEM_PORT_NETWORK_CTP_PM_HISTORY_DATA = 341
|
||||
TCP_UDP_PM_HISTORY_DATA = 342
|
||||
ENERGY_CONSUMPTION_PM_HISTORY_DATA = 343
|
||||
XG_PON_TC_PM_HISTORY_DATA = 344
|
||||
XG_PON_DOWNSTREAM_MANAGEMENT_PM_HISTORY_DATA = 345
|
||||
XG_PON_UPSTREAM_MANAGEMENT_PM_HISTORY_DATA = 346
|
||||
IPV6_HOST_CONFIG_DATA = 347
|
||||
MAC_BRIDGE_PORT_ICMPV6_PROCESS_PRE_ASSIGN_TABLE = 348
|
||||
POE_CONTROL = 349
|
||||
ETHERNET_PSEUDOWIRE_PARAMETERS = 400
|
||||
PHYSICAL_PATH_TERMINATION_POINT_RS232_RS485_UNI = 401
|
||||
RS232_RS485_PORT_OPERATION_CONFIGURATION_DATA = 402
|
||||
RS232_RS485_PERFORMANCE_MONITORING_HISTORY_DATA = 403
|
||||
L2_MULTICAST_GEM_INTERWORKING_TERMINATION_POINT = 404
|
||||
ANI_E = 405
|
||||
EPON_DOWNSTREAM_PM_CONFIGURATION = 406
|
||||
SIP_AGENT_CONFIG_DATA_2 = 407
|
||||
XDSL_XTU_C_PM_HISTORY_DATA_PART_2 = 408
|
||||
PTM_PM_HISTORY_DATA_XDSL = 409
|
||||
VDSL2_LINE_CONFIGURATION_EXTENSIONS_3 = 410
|
||||
VECTORING_LINE_CONFIGURATION_EXTENSIONS = 411
|
||||
XDSL_CHANNEL_CONFIGURATION_PROFILE_PART_2 = 412
|
||||
XTU_DATA_GATHERING_CONFIGURATION = 413
|
||||
XDSL_LINE_INVENTORY_AND_STATUS_DATA_PART_8 = 414
|
||||
VDSL2_LINE_INVENTORY_AND_STATUS_DATA_PART_4 = 415
|
||||
VECTORING_LINE_INVENTORY_AND_STATUS_DATA = 416
|
||||
DATA_GATHERING_LINE_TEST_DIAGNOSTIC_AND_STATUS = 417
|
||||
EFM_BONDING_GROUP = 418
|
||||
EFM_BONDING_LINK = 419
|
||||
EFM_BONDING_GROUP_PM_HISTORY_DATA = 420
|
||||
EFM_BONDING_GROUP_PM_HISTORY_DATA_PART_2 = 421
|
||||
EFM_BONDING_LINK_PM_HISTORY_DATA = 422
|
||||
EFM_BONDING_PORT_PM_HISTORY_DATA = 423
|
||||
EFM_BONDING_PORT_PM_HISTORY_DATA_PART_2 = 424
|
||||
ETHERNET_FRAME_EXTENDED_PM_64_BIT = 425
|
||||
THRESHOLD_DATA_64_BIT = 426
|
||||
PHYSICAL_PATH_TERMINATION_POINT_UNI_PART_3_FAST = 427
|
||||
FAST_LINE_CONFIGURATION_PROFILE_PART_1 = 428
|
||||
FAST_LINE_CONFIGURATION_PROFILE_PART_2 = 429
|
||||
FAST_LINE_CONFIGURATION_PROFILE_PART_3 = 430
|
||||
FAST_LINE_CONFIGURATION_PROFILE_PART_4 = 431
|
||||
FAST_CHANNEL_CONFIGURATION_PROFILE_PART_1 = 432
|
||||
FAST_DATA_PATH_CONFIGURATION_PROFILE = 433
|
||||
FAST_VECTORING_LINE_CONFIGURATION_EXTENSIONS = 434
|
||||
FAST_LINE_INVENTORY_AND_STATUS_DATA = 435
|
||||
FAST_LINE_INVENTORY_AND_STATUS_DATA_PART_2 = 436
|
||||
FAST_XTU_C_PM_HISTORY_DATA = 437
|
||||
FAST_XTU_R_PM_HISTORY_DATA = 438
|
||||
OPENFLOW_CONFIG_DATA = 439
|
||||
TIME_STATUS_MESSAGE = 440
|
||||
ONU3_G = 441
|
||||
TWDM_SYSTEM_PROFILE = 442
|
||||
TWDM_CHANNEL = 443
|
||||
TWDM_CHANNEL_PHY_LODS_PM_HISTORY_DATA = 444
|
||||
TWDM_CHANNEL_XGEM_PM_HISTORY_DATA = 445
|
||||
TWDM_CHANNEL_PLOAM_PM_HISTORY_DATA_PART_1 = 446
|
||||
TWDM_CHANNEL_PLOAM_PM_HISTORY_DATA_PART_2 = 447
|
||||
TWDM_CHANNEL_PLOAM_PM_HISTORY_DATA_PART_3 = 448
|
||||
TWDM_CHANNEL_TUNING_PM_HISTORY_DATA_PART_1 = 449
|
||||
TWDM_CHANNEL_TUNING_PM_HISTORY_DATA_PART_2 = 450
|
||||
TWDM_CHANNEL_TUNING_PM_HISTORY_DATA_PART_3 = 451
|
||||
TWDM_CHANNEL_OMCI_PM_HISTORY_DATA = 452
|
||||
ENHANCED_FEC_PM_HISTORY_DATA = 453
|
||||
ENHANCED_TC_PM_HISTORY_DATA = 454
|
||||
LINK_AGGREGATION_SERVICE_PROFILE = 455
|
||||
ONU_MANUFACTURING_DATA = 456
|
||||
ONU_TIME_CONFIGURATION = 457
|
||||
IP_HOST_PM_HISTORY_DATA_PART_2 = 458
|
||||
ONU_OPERATIONAL_PM_HISTORY_DATA = 459
|
||||
ONU4_G = 460
|
||||
BBF_TR_369_USP_AGENT = 461
|
||||
FAST_CHANNEL_CONFIGURATION_PROFILE_PART_2 = 462
|
||||
FAST_LINE_FAILURES_PM_DATA = 463
|
||||
SYNCHRONOUS_ETHERNET_OPERATION = 464
|
||||
PRECISION_TIME_PROTOCOL = 465
|
||||
PRECISION_TIME_PROTOCOL_STATUS = 466
|
||||
65
src/message.py
Normal file
65
src/message.py
Normal file
@@ -0,0 +1,65 @@
|
||||
from dataclasses import dataclass, field
|
||||
from src.message_type import MessageType
|
||||
from src.managed_entity import ManagedEntity
|
||||
|
||||
from enum import Enum
|
||||
|
||||
|
||||
@dataclass
|
||||
class OMCIMessage:
|
||||
msg_bytes: bytes
|
||||
is_extended: bool
|
||||
transaction_correlation_identifier: bytes = field(default=b"")
|
||||
message_type: MessageType = field(default_factory=MessageType)
|
||||
entity_class: ManagedEntity = field(default_factory=ManagedEntity)
|
||||
entity_instance: int = field(default = 0)
|
||||
message_content_length: bytes = field(default=b"")
|
||||
device_identifier: bytes = field(default=b"")
|
||||
checksum: bytes = field(default=b"")
|
||||
|
||||
def __init__(self, message: str):
|
||||
self.msg_bytes = bytes.fromhex(message)
|
||||
self.transaction_correlation_identifier = self.msg_bytes[0:2]
|
||||
|
||||
msg_type = MessageType(self.msg_bytes[2])
|
||||
self.message_type = msg_type
|
||||
|
||||
self.device_identifier = self.msg_bytes[3].to_bytes()
|
||||
if self.device_identifier == b"\x0B":
|
||||
self.is_extended = True
|
||||
self.message_content_length = self.msg_bytes[8:10]
|
||||
self.message_contents = bytes(self.msg_bytes[10:-4])
|
||||
|
||||
elif self.device_identifier == b"\x0A":
|
||||
self.is_extended = False
|
||||
self.message_contents = bytes(self.msg_bytes[8:-4])
|
||||
|
||||
entity_id = int.from_bytes(self.msg_bytes[4:6])
|
||||
self.entity_class = ManagedEntity(entity_id)
|
||||
self.entity_instance = int.from_bytes(self.msg_bytes[6:8])
|
||||
|
||||
self.checksum = self.msg_bytes[-4:]
|
||||
|
||||
def __str__(self):
|
||||
_msg = f"""
|
||||
Extended: {self.is_extended}
|
||||
Transaction Correlation Identifier: {self.transaction_correlation_identifier.hex()} ({int.from_bytes(self.transaction_correlation_identifier)})
|
||||
Message Type:
|
||||
{str(self.message_type)}
|
||||
Device Identifier: {self.device_identifier.hex()}
|
||||
Managed Identity Identifier:
|
||||
Entity Class: {self.entity_class.name} ({self.entity_class.value})
|
||||
Entity Instance: {self.entity_instance}"""
|
||||
|
||||
if self.is_extended:
|
||||
_msg += f"""
|
||||
Message Content Length: {int.from_bytes(self.message_content_length)}
|
||||
Message Contents: {self.message_contents.hex()}
|
||||
MIC Trailer: {int.from_bytes(self.checksum)}
|
||||
"""
|
||||
else:
|
||||
_msg += f"""
|
||||
Message Contents: {self.message_contents.hex()}
|
||||
OMCI Trailer: {int.from_bytes(self.checksum)}
|
||||
"""
|
||||
return _msg
|
||||
85
src/message_type.py
Normal file
85
src/message_type.py
Normal file
@@ -0,0 +1,85 @@
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
|
||||
class OMCIMessageType(Enum):
|
||||
CREATE = (4, "Create", True, True)
|
||||
DELETE = (6, "Delete", True, True)
|
||||
SET = (
|
||||
8,
|
||||
"Set",
|
||||
True,
|
||||
None,
|
||||
) # Note 1 indicates a condition, which can be handled as None or custom logic
|
||||
GET = (9, "Get", True, False)
|
||||
GET_ALL_ALARMS = (11, "Get all alarms", True, False)
|
||||
GET_ALL_ALARMS_NEXT = (12, "Get all alarms next", True, False)
|
||||
MIB_UPLOAD = (13, "MIB upload", True, False)
|
||||
MIB_UPLOAD_NEXT = (14, "MIB upload next", True, False)
|
||||
MIB_RESET = (15, "MIB reset", True, True)
|
||||
ALARM = (16, "Alarm", True, False)
|
||||
ATTRIBUTE_VALUE_CHANGE = (17, "Attribute value change", True, False)
|
||||
TEST = (18, "Test", True, False)
|
||||
START_SOFTWARE_DOWNLOAD = (19, "Start software download", True, True)
|
||||
DOWNLOAD_SECTION = (
|
||||
20,
|
||||
"Download section",
|
||||
True,
|
||||
None,
|
||||
) # Note 2 indicates condition
|
||||
END_SOFTWARE_DOWNLOAD = (21, "End software download", True, True)
|
||||
ACTIVATE_SOFTWARE = (22, "Activate software", True, True)
|
||||
COMMIT_SOFTWARE = (23, "Commit software", True, True)
|
||||
SYNCHRONIZE_TIME = (24, "Synchronize time", True, False)
|
||||
REBOOT = (25, "Reboot", True, False)
|
||||
GET_NEXT = (26, "Get next", True, False)
|
||||
TEST_RESULT = (27, "Test result", True, False)
|
||||
GET_CURRENT_DATA = (28, "Get current data", True, False)
|
||||
SET_TABLE = (29, "Set table", True, True) # Note 3 could be handled separately
|
||||
UNKNOWN = (99, "Unknown", False, False)
|
||||
|
||||
def __init__(self, mt, description, ak_required, mib_data_sync):
|
||||
self.mt = mt
|
||||
self.description = description
|
||||
self.ak_required = ak_required
|
||||
self.mib_data_sync = mib_data_sync
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.description}"
|
||||
|
||||
|
||||
@dataclass
|
||||
class MessageType:
|
||||
db: bool = field(default=False)
|
||||
ar: bool = field(default=False)
|
||||
ak: bool = field(default=False)
|
||||
action: OMCIMessageType = field(default=OMCIMessageType.UNKNOWN)
|
||||
|
||||
def __init__(self, msg_type: bytes | int):
|
||||
if isinstance(msg_type, int):
|
||||
msg_type_bytes = msg_type.to_bytes(length=1, byteorder="big", signed=False)
|
||||
else:
|
||||
msg_type_bytes = msg_type
|
||||
|
||||
# Verifique se msg_type tem pelo menos um byte
|
||||
if len(msg_type_bytes) < 1:
|
||||
raise ValueError("msg_type must be at least 1 byte long")
|
||||
|
||||
# Interpret o byte (assumindo que seja o primeiro byte)
|
||||
first_byte = msg_type_bytes[0]
|
||||
|
||||
# Extraia os bits relevantes do byte:
|
||||
self.db = bool(first_byte & 0b10000000) # Bit mais significativo (bit 7)
|
||||
self.ar = bool(first_byte & 0b01000000) # Bit 6
|
||||
self.ak = bool(first_byte & 0b00100000) # Bit 5
|
||||
|
||||
# Os bits de ação (MT) ocupam, por exemplo, os 4 bits menos significativos (ajuste conforme necessário)
|
||||
action_bits = (
|
||||
first_byte & 0b00011111
|
||||
) # Extraia os bits 0 a 4 (ajustar conforme o protocolo)
|
||||
|
||||
# Mapeie os bits para o OMCIMessageType correspondente
|
||||
self.action = next((action for action in OMCIMessageType if action.mt == action_bits), OMCIMessageType.UNKNOWN)
|
||||
|
||||
def __str__(self):
|
||||
_msg = f"DB: {self.db} | AR: {self.ar} | AK: {self.ak} | Action: {self.action}"
|
||||
return _msg
|
||||
Reference in New Issue
Block a user