fix(vlans): set_vlan and set_interface refuse values with line breaks (#17) #18

Merged
christianmanivong merged 2 commits from fix/vlan-name-2455 into main 2026-11-13 08:55:06 +00:00
2 Commits
Author SHA1 Message Date
Christian Manivong a689c50ee1 refactor: CLI value checks in their own module, uptime parser in parsers.py (#17)
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 52s
driver / test (3.12) (pull_request) Successful in 55s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 25s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Successful in 2m22s
driver / publish (pull_request) Skipped
The checks against line breaks and double quotes made the driver module
27 lines longer than the quality ratchet allows (2014, recorded 1987) and
set_interface 53 lines long (limit 50).

The checks move to cli_values.py (check_cli_values); the uptime parser,
a pure parser without the driver, moves to parsers.py as
parse_uptime_seconds and reads its four units in one loop; set_vlan and
set_interface say in one docstring line what they refuse. Behaviour is
unchanged; the uptime test gains a string without days and an empty one.
The baseline is lowered to what is measured now (1971).
2026-11-13 08:59:30 +01:00
Christian Manivong ea001751cb fix(vlans): set_vlan and set_interface refuse values with line breaks (#17)
driver / standard (pull_request) Failing after 17s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 1m1s
driver / test (3.13) (pull_request) Successful in 53s
driver / lowest (pull_request) Successful in 27s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m19s
CI / driver (pull_request) Failing after 2m53s
driver / publish (pull_request) Skipped
The VLAN name went into `name "<name>"`, a port's description into
`description <text>`, each one line of a block sent line by line in
config mode and then saved: a line break ended the line and the switch
ran the rest as commands, a double quote ended the VLAN name. netOrk
replays VLAN names other devices reported here (NetOrk/netork#2455).

set_vlan() now raises ValueError for a name containing \r, \n or ",
set_interface() for a description containing \r or \n, before anything
is sent.
2026-11-12 22:25:56 +01:00