Skip to main content

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 bloques ont y uni.
  • 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) -> str
  • close() -> 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

jmq_olt_zyxel-1.0.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jmq_olt_zyxel-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file jmq_olt_zyxel-1.0.0.tar.gz.

File metadata

  • Download URL: jmq_olt_zyxel-1.0.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jmq_olt_zyxel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d9ed26f3348ef37e0bc73545518234c7130275fc74c1ced3dd3c4e67d7f464f4
MD5 ed6b9cf015e0fa24118b7c2565836491
BLAKE2b-256 deadb93812ea2442675f5dc085a25721560ad77bd4a99082510d7c4a16a23de7

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmq_olt_zyxel-1.0.0.tar.gz:

Publisher: python-publish.yml on juaquicar/jmq_olt_zyxel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jmq_olt_zyxel-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: jmq_olt_zyxel-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jmq_olt_zyxel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 703398cb5cf40144a480a9a1a1c5aee2b4fa4eaed25b7025d209cc8e61663277
MD5 f6711e295e6f24289f21e31aa69b538a
BLAKE2b-256 c57a1680a048137b9846c3653c0cce30c2603dbed6a412905d1e1f21d1c1fd90

See more details on using hashes here.

Provenance

The following attestation bundles were made for jmq_olt_zyxel-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on juaquicar/jmq_olt_zyxel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page