What was wrong:set_vlan() put the name into name "<name>", set_interface() the description into description <text>; each block is sent line by line in config mode and 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 (NetOrk/netork#2455).
Fix:_check_cli_values() before anything is sent: set_vlan() raises ValueError for a name containing \r, \n or ", set_interface() for a description containing \r or \n.
Tests:tests/unit/test_cli_values.py — refused values with nothing sent (red before the fix), a plain name sent quoted, a one-line description sent.
**What was wrong:** `set_vlan()` put the name into `name "<name>"`, `set_interface()` the description into `description <text>`; each block is sent line by line in config mode and 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 (NetOrk/netork#2455).
**Fix:** `_check_cli_values()` before anything is sent: `set_vlan()` raises `ValueError` for a name containing `\r`, `\n` or `"`, `set_interface()` for a description containing `\r` or `\n`.
**Tests:** `tests/unit/test_cli_values.py` — refused values with nothing sent (red before the fix), a plain name sent quoted, a one-line description sent.
Closes #17
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.
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).
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.
What was wrong:
set_vlan()put the name intoname "<name>",set_interface()the description intodescription <text>; each block is sent line by line in config mode and 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 (NetOrk/netork#2455).Fix:
_check_cli_values()before anything is sent:set_vlan()raisesValueErrorfor a name containing\r,\nor",set_interface()for a description containing\ror\n.Tests:
tests/unit/test_cli_values.py— refused values with nothing sent (red before the fix), a plain name sent quoted, a one-line description sent.Closes #17