Paquete de Integración OLT Zyxel con Python
Project description
Descripción
jmq_olt_zyxel es un paquete en Python que proporciona una interfaz basada en clases para conectar vía Telnet a un OLT Zyxel (modelo OLT1408A) y extraer información de las ONT (Optical Network Terminations) en estructuras de datos listas para serializar a JSON. Todo se realiza sin SNMP, únicamente mediante comandos Telnet y parseo de las salidas ASCII.
Características principales
-
Conexión y autenticación vía Telnet.
-
Métodos:
get_all_onts()→ lista ONT activas.get_unregistered_onts()→ lista ONT no registradas.get_ont_details(aid)→ detalles generales.get_ont_status_history(aid)→ historial de estado (status, timestamp).get_ont_config(aid)→ configuración dividida en bloquesontyuni.
-
Parseo robusto de tablas ASCII y bloques clave:valor.
-
Salida en estructuras nativas de Python.
Uso básico
Inicialización y login
from jmq_olt_zyxel.OLT1408A import APIOLT1408A
client = APIOLT1408A(
host="152.170.74.208",
port=2300,
username="admin",
password="1234",
prompt="OLT1408A#",
timeout=5
)
Obtener todas las ONT
all_onts = client.get_all_onts()
print(client.to_json(all_onts))
Salida:
[
{
"AID": "ont-1-1",
"SN": "5A5958458CADA659",
"Template-ID": "Template-1-121",
"Status": "IS",
"FW Version": "V544ACHK1b1_20",
"Model": "PX3321-T1",
"Distance": "0 m",
"ONT Rx": "-24.01",
"Description": ""
}
]
Obtener ONT no registradas
unreg = client.get_unregistered_onts()
print(client.to_json(unreg))
Salida:
[]
Obtener detalles de una ONT específica
details = client.get_ont_details("ont-1-1")
print(client.to_json(details))
Salida:
{
"Status": "Down",
"Estimated distance": "0 m",
"OMCI GEM port": "0",
"Model name": "N/A",
"Model ID": "0",
"Full bridge": "disable",
"US FEC": "disable",
"Alarm profile": "DEFVAL",
"Anti MAC Spoofing": "disable",
"Template Description": "Template-1-121",
"Management IP Address": "N/A",
"Ethernet 1": "Link Down",
"Wan 1": "Enable",
"Vlan": "10",
"Control Supported": "WAN(full) LAN WiFi ACS ..."
}
Obtener historial de estado
history = client.get_ont_status_history("ont-1-1")
print(client.to_json(history))
Salida:
[
{"status": "IS", "tt": "2037/ 3/14 16:02:16"},
{"status": "OOS-NP", "tt": "2037/ 3/14 16:02:16"},
{"status": "OOS-CD", "tt": "2037/ 3/14 16:02:07"},
{"status": "OOS-NR", "tt": "2037/ 3/14 16:01:25"}
]
Obtener configuración avanzada
config = client.get_ont_config("ont-1-1")
print(client.to_json(config))
Salida:
{
"ont": {
"sn": "5A5958458CADA659",
"password": "DEFAULT",
"full_bridge": "disable",
"template_description": "Template-1-121",
"alarm_profile": "DEFVAL",
"anti_mac_spoofing": "inactive",
"bwgroup": "1",
"usbwprofname": "DEFVAL",
"dsbwprofname": "DEFVAL",
"allocid": "256"
},
"uni": {
"active": true,
"pmenable": false,
"queues": [
{"tc": 0, "priority": 0, "weight": 0, "usbwprofname": "DEFVAL", "dsbwprofname": "DEFVAL", "dsoption": "olt", "bwsharegroupid": "1"},
{"tc": 1, "priority": 2, "weight": 2, "usbwprofname": "DEFVAL", "dsbwprofname": "DEFVAL", "dsoption": "olt", "bwsharegroupid": "1"}
],
"vlan": "1"
}
}
Cerrar sesión Telnet
client.close()
Referencia de la API
get_all_onts() -> List[Dict[str, Any]]get_unregistered_onts() -> List[Dict[str, Any]]get_ont_details(aid: str) -> Dict[str, Any]get_ont_status_history(aid: str) -> List[Dict[str, str]]get_ont_config(aid: str) -> Dict[str, Any]to_json(data: object) -> strclose() -> None
Licencia
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jmq_olt_zyxel-0.0.1.tar.gz.
File metadata
- Download URL: jmq_olt_zyxel-0.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37b3229f827ddc0a3020ff09f41d3befc227e71ceb394e9d24b0c9aea3e8a836
|
|
| MD5 |
43964fdaa8942fead39f6788756af36a
|
|
| BLAKE2b-256 |
d57533b2e5913b1a00b2526955b1427fa6dabd96c8d89e9aad40aad55a6713be
|
File details
Details for the file jmq_olt_zyxel-0.0.1-py3-none-any.whl.
File metadata
- Download URL: jmq_olt_zyxel-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ff788497109fafaee6f7aa177933a5f17f65ffc615036aad317495cfffc12c1
|
|
| MD5 |
928eb82ff3358cad0212ce6f650e8c43
|
|
| BLAKE2b-256 |
a8609d22e77a3feb63fe0dc4cec82f9ddfb79b9726e55f94ddd8112bdff01faa
|