netx/netx_api/cli_templates
2026-09-21 14:34:43 +08:00
..
cisco Switch CLI parsing to TextFSM and polish topology/workbench UX. 2026-08-02 23:06:40 +08:00
h3c Switch CLI parsing to TextFSM and polish topology/workbench UX. 2026-08-02 23:06:40 +08:00
huawei Switch CLI parsing to TextFSM and polish topology/workbench UX. 2026-08-02 23:06:40 +08:00
juniper Switch CLI parsing to TextFSM and polish topology/workbench UX. 2026-08-02 23:06:40 +08:00
zte Split ZTE L2VPN MAC outgoing into pw/AC/SID fields and skip separator rows. 2026-09-21 14:34:43 +08:00
index Add ZTE l2vpn forwardinfo detail biz_state metric with TextFSM and compare sheet. 2026-09-20 19:14:25 +08:00
README.md Improve topology UX, traffic discover logs, and CLI wrap parsing. 2026-08-03 19:24:43 +08:00

NetX CLI TextFSM templates

Custom TextFSM templates that complement (and can override) community ntc-templates. Organize by vendor folder; prefer adding templates here for every new CLI parse path.

Layout

cli_templates/
  index                 # global index (paths relative to this dir)
  README.md
  zte/                  # ZTE ZXROS / ROSNG, ...
  cisco/                # overrides / extras beyond community cisco_*
  huawei/
  h3c/
  juniper/

Lookup order

  1. Wrap-line join (netx_api.cli_wrap) — flatten last-column wraps for registered platform+command pairs (ZTE interface brief / LLDP brief today). Other vendors can register rules the same way; do not apply blindly (Huawei LLDP detail uses real indented fields).
  2. This tree (index → vendor/*.textfsm)
  3. Community ntc-templates package

No regex CLI parsers for field extraction. If both template trees miss, the call returns empty — fix or add a template. Wrap joining is the supported escape hatch when TextFSM alone cannot merge mid-token column wraps.

Vendor coverage (blind fill from community + NetX)

NetX vendor_key ntc platform LLDP command Port brief Port detail Notes
zte zte_zxros show lldp neighbor brief show interface brief show interface {if} NetX custom (community has iface only)
huawei huawei_vrp display lldp neighbor display interface brief display interface {if} NetX custom (community prompt-fragile)
cisco cisco_ios / nxos / xr show lldp neighbors detail show ip interface brief show interfaces {if} Community + NetX iface override
h3c hp_comware display lldp neighbor-information list display interface brief display interface {if} Community
juniper juniper_junos show lldp neighbors show interfaces show interfaces {if} Community (rates often sparse)
nokia alcatel_sros (stub / no SROS LLDP tpl) show port show port {if} Community port status; AOS LLDP via alcatel_aos
mikrotik mikrotik_routeros — /interface print brief /interface print detail … Community; no LLDP path
ericsson ericsson_ipos stub — — No community LLDP/iface templates

alcatel_aos device_type uses community show lldp remote-system (mapped to platform alcatel_aos).

Adding a template

  1. Put the file under the vendor folder, e.g. zte/zte_zxros_show_xxx.textfsm
  2. Name: {platform}_{command_slug}.textfsm (same convention as ntc-templates)
  3. Register in root index with a relative path: zte/zte_zxros_show_xxx.textfsm, .*, zte_zxros, sh[[ow]] ...
  4. Align Value names with community templates when possible
  5. If the CLI wraps the last column onto the next line, add a CliWrapRule in netx_api/cli_wrap.py (platform + command scoped) — do not try to solve mid-token wraps in TextFSM alone
  6. Add unit tests under tests/

When community already works, no file is required. When community is wrong/incomplete for our lab, add an override under the vendor folder with the same Platform+Command so NetX wins.

Concurrency

Template files are read-only and safe across processes. Parsing goes through netx_api.ntc_parse (wrap-join → fresh CliTable + process lock; never share instances across threads).