Summary
At the moment the internal scripting of VyOS refers to modems by number when communicating with ModemManager. We should migrate this to (optionally) use the modem unique identifier, generated by ModemManager instead.
Use case
The current method of referring to Modems works fine in the “normal” path. I.e. when the modem is functioning normally. The modem is assigned to slot 0 on boot and stays there so the scripts work as intended.
However, there are a lot of (unfortunately common ) edge cases where this isn’t the case. If a modem resets during operation it will drop its USB connection and reenumerate. In this case ModemManager will place the modem into slot 1 as it considers it to be a new device. However, the Linux kernel will still place it as wwan0. So, all of the VyOS internal scripting breaks from this point forward until the whole computer (or VM) is reset.
ModemManager supports referring to modems through a unique identifier which is formed of a hash of various parameters of the modem like the IMEI number. This is supposed to be unique for a hardware configuration and will allow the system to heal if there is a modem reenumeration. Think of it akin to a MAC address for a NIC but for a modem
Additional information
I can think of two ways to implement this in VyOS. One is to force the usage of device ids the same way MAC addresses need to be used to identify NICs. This would make the behaviour very stable but could break some existing deployments which rely on the old behaviour somehow
Or, the system could check to see if a device id has been specified in the config and preferentially use it. Then fall back to the old method if not. This will make sure not to break existing deployments but means more code to maintain in the future. I’d be interested to know the maintainers opinions on which one they would prefer before I start coding this.