mirror of
https://github.com/hansjone/netx.git
synced 2026-10-09 03:10:46 +08:00
Add ZTE-first port traffic monitoring with task wizard and ops wall.
Collect interface bit/s via CLI on a schedule, store samples in Postgres, and chart trends with uPlot. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
a95c6598bb
commit
efe8f58cd2
25 changed files with 2880 additions and 36 deletions
29
netx_api/port_traffic_commands.py
Normal file
29
netx_api/port_traffic_commands.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""Vendor → port traffic CLI command matrix (ZTE first)."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from .config_sync_commands import normalize_vendor_key
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class PortTrafficCommands:
|
||||
brief: str
|
||||
detail_template: str # format with ifname=
|
||||
vendor_key: str = "other"
|
||||
|
||||
|
||||
def commands_for_vendor(vendor: str, device_type: str = "") -> PortTrafficCommands | None:
|
||||
key = normalize_vendor_key(vendor, device_type)
|
||||
if key == "zte":
|
||||
return PortTrafficCommands(
|
||||
brief="show interface brief",
|
||||
detail_template="show interface {ifname}",
|
||||
vendor_key=key,
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def detail_command(cmds: PortTrafficCommands, ifname: str) -> str:
|
||||
return cmds.detail_template.format(ifname=ifname)
|
||||
Loading…
Add table
Add a link
Reference in a new issue