Networks: Sort interfaces in their groups (lan, guest, ...) by slot name
Description
Interfaces in interfaces groups (wan, lan, guest) are not sorted before passing them out into result JSON.
It is reproducible on Omnia, both TOS 6.0 and TOS 5.3.x.
Final order of interfaces is determined by list ifname
order in /etc/config/network
.
- TOS 5.3.x: https://gitlab.nic.cz/turris/foris-controller/foris-controller/-/blob/release/v2.1.3/foris_controller_backends/networks/__init__.py#L47-50
- TOS 6.0: https://gitlab.nic.cz/turris/foris-controller/foris-controller/-/blob/master/foris_controller_backends/networks/__init__.py#L89-91
We should sort interfaces in interfaces groups (lan, guest) by slot name to ensure nice ordered interface listing.
Actual behavior
/etc/config/network
config interface 'lan'
[...]
list ifname 'lan3'
list ifname 'lan0'
list ifname 'lan1'
list ifname 'lan4'
list ifname 'lan2'
Returns interfaces in order given by uci config list
:
lan3 lan0 lan1 lan4 lan2
(Also seen in reForis)
Expected behavior
Return interfaces sorted, regardless of order in uci config list
:
lan0 lan1 lan2 lan3 lan4