Page MenuHomeVyOS Platform

disconnect interface wwan0 throws exception
Closed, ResolvedPublicBUG

Description

When attempting to bounce a 4G interface I received this exception

vyos@vyos:~$ disconnect interface wwan0
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/connect_disconnect.py", line 103, in <module>
    main()
  File "/usr/libexec/vyos/op_mode/connect_disconnect.py", line 96, in main
    disconnect(args.disconnect)
  File "/usr/libexec/vyos/op_mode/connect_disconnect.py", line 75, in disconnect
    if not is_wwan_connected(interface):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/utils/network.py", line 169, in is_wwan_connected
    if not is_systemd_service_active('ModemManager.service'):
           ^^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'is_systemd_service_active' is not defined

I went and manually imported it in that file

from vyos.utils.process import is_systemd_service_active

then ran it again, got this exception

vyos@vyos:~$ disconnect interface wwan0
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/connect_disconnect.py", line 103, in <module>
    main()
  File "/usr/libexec/vyos/op_mode/connect_disconnect.py", line 96, in main
    disconnect(args.disconnect)
  File "/usr/libexec/vyos/op_mode/connect_disconnect.py", line 75, in disconnect
    if not is_wwan_connected(interface):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/vyos/utils/network.py", line 179, in is_wwan_connected
    return dict_search('modem.generic.state', tmp) == 'connected'
           ^^^^^^^^^^^
NameError: name 'dict_search' is not defined

After importing that

from vyos.utils.dict import dict_search

and attempting again it worked fine

Version

root@vyos:~# show version
Version:          VyOS 1.5-rolling-202401161743
Release train:    current

Built by:         autobuild@vyos.net
Built on:         Tue 16 Jan 2024 19:41 UTC
Build UUID:       f7976e02-b740-4027-8c96-6335bbea4315
Build commit ID:  365f10340ec2f1

Architecture:     x86_64
Boot via:         installed image
System type:      bare metal

Hardware vendor:  Lanner Electronics Inc.
Hardware model:   NCA-1515B-VS1
Hardware S/N:     LR202112012772
Hardware UUID:    03000200-0400-0500-0006-000700080009

Copyright:        VyOS maintainers and contributors

Details

Version
1.5-rolling-202401161743
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)