napalm_device_types/lag.py:16 _port_order already does it, but it is private.
IOS route table
Copies: netgear_smart.py:1695 and tplink_jetstream.py:1486. tplink's is a superset: more protocols, plus the outgoing interface.
LAG rows
procurve uses lag.pyadd_lag_interfaces.
tplink (tplink_jetstream.py:411) and netgear v7 (netgear_smart.py:679) build the rows by hand.
The base leaves an already-reported LAG row untouched, while the drivers annotate existing rows. It needs that option.
ARP from hosts
get_arp_table built from get_hosts() is identical in napalm_fritzbox/fritzbox.py:431 and napalm_zyxel/zyxel_driver.py:330.
This could be an arp_table_from_hosts() in residential_gateway.py.
Proposal: pure functions in napalm-device-types: parse_duration_text (returns -1.0 on no match), expand_port_ranges, kv_lookup, public port_sort_key, parse_ios_route_table, an annotate option in add_lag_interfaces, and arp_table_from_hosts. Each with fixtures from both dialects.
Prio P4.
From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.
Small parsers copied between drivers.
**Uptime text**
- Copies: `netgear_smart.py`:277 and `tplink_jetstream.py`:253 (same shape), and `procurve/parsers.py`:147.
- The hour regexes differ.
- Unknown input returns 0.0 in these, while `hpe_officeconnect/parsers.py`:96 returns -1, NAPALM's "unknown".
**Port-list range expansion**
- Copies: `netgear_smart.py`:1251 and :343 (v7), `tplink_jetstream.py`:862, `procurve/parsers.py`:711.
- tplink's inner loop duplicates its own `_expand_ports` (:892).
**Key/value lookup**
- Copies: `netgear_smart.py`:258, `tplink_jetstream.py`:237, `procurve/parsers.py`:27.
- In all three, "Name" also matches "System Name".
**Natural port sort**
- `re.split(r"(\d+)")` is copied five times.
- `napalm_device_types/lag.py`:16 `_port_order` already does it, but it is private.
**IOS route table**
- Copies: `netgear_smart.py`:1695 and `tplink_jetstream.py`:1486. tplink's is a superset: more protocols, plus the outgoing interface.
**LAG rows**
- procurve uses `lag.py` `add_lag_interfaces`.
- tplink (`tplink_jetstream.py`:411) and netgear v7 (`netgear_smart.py`:679) build the rows by hand.
- The base leaves an already-reported LAG row untouched, while the drivers annotate existing rows. It needs that option.
**ARP from hosts**
- `get_arp_table` built from `get_hosts()` is identical in `napalm_fritzbox/fritzbox.py`:431 and `napalm_zyxel/zyxel_driver.py`:330.
- This could be an `arp_table_from_hosts()` in `residential_gateway.py`.
**Proposal:** pure functions in napalm-device-types: `parse_duration_text` (returns -1.0 on no match), `expand_port_ranges`, `kv_lookup`, public `port_sort_key`, `parse_ios_route_table`, an annotate option in `add_lag_interfaces`, and `arp_table_from_hosts`. Each with fixtures from both dialects.
Prio P4.
From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.
Re-homed by `docs/STRUCTURE.md` (NAPALM/napalm-device-types#37, NetOrk/netork#1105): CLI text parsers do not go here. The natural port sort that `lag` already has may become public.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Small parsers copied between drivers.
Uptime text
netgear_smart.py:277 andtplink_jetstream.py:253 (same shape), andprocurve/parsers.py:147.hpe_officeconnect/parsers.py:96 returns -1, NAPALM's "unknown".Port-list range expansion
netgear_smart.py:1251 and :343 (v7),tplink_jetstream.py:862,procurve/parsers.py:711._expand_ports(:892).Key/value lookup
netgear_smart.py:258,tplink_jetstream.py:237,procurve/parsers.py:27.Natural port sort
re.split(r"(\d+)")is copied five times.napalm_device_types/lag.py:16_port_orderalready does it, but it is private.IOS route table
netgear_smart.py:1695 andtplink_jetstream.py:1486. tplink's is a superset: more protocols, plus the outgoing interface.LAG rows
lag.pyadd_lag_interfaces.tplink_jetstream.py:411) and netgear v7 (netgear_smart.py:679) build the rows by hand.ARP from hosts
get_arp_tablebuilt fromget_hosts()is identical innapalm_fritzbox/fritzbox.py:431 andnapalm_zyxel/zyxel_driver.py:330.arp_table_from_hosts()inresidential_gateway.py.Proposal: pure functions in napalm-device-types:
parse_duration_text(returns -1.0 on no match),expand_port_ranges,kv_lookup, publicport_sort_key,parse_ios_route_table, an annotate option inadd_lag_interfaces, andarp_table_from_hosts. Each with fixtures from both dialects.Prio P4.
From the NetOrk function index (NetOrk/netork#670); every location was checked against the current code. Paths are relative to each driver repo.
Re-homed by
docs/STRUCTURE.md(NAPALM/napalm-device-types#37, NetOrk/netork#1105): CLI text parsers do not go here. The natural port sort thatlagalready has may become public.