summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/accelppp.py2
-rwxr-xr-xsrc/op_mode/bgp.py6
-rwxr-xr-xsrc/op_mode/bridge.py7
-rwxr-xr-xsrc/op_mode/clear_conntrack.py5
-rwxr-xr-xsrc/op_mode/clear_dhcp_lease.py6
-rwxr-xr-xsrc/op_mode/connect_disconnect.py10
-rwxr-xr-xsrc/op_mode/conntrack.py6
-rwxr-xr-xsrc/op_mode/conntrack_sync.py8
-rwxr-xr-xsrc/op_mode/container.py8
-rwxr-xr-xsrc/op_mode/dhcp.py6
-rwxr-xr-xsrc/op_mode/dns.py2
-rwxr-xr-xsrc/op_mode/dns_dynamic.py2
-rwxr-xr-xsrc/op_mode/dns_forwarding_reset.py2
-rwxr-xr-xsrc/op_mode/dns_forwarding_statistics.py2
-rwxr-xr-xsrc/op_mode/firewall.py4
-rwxr-xr-xsrc/op_mode/flow_accounting_op.py10
-rwxr-xr-xsrc/op_mode/format_disk.py8
-rwxr-xr-xsrc/op_mode/generate_interfaces_debug_archive.py2
-rwxr-xr-xsrc/op_mode/generate_ipsec_debug_archive.py2
-rwxr-xr-xsrc/op_mode/generate_openconnect_otp_key.py4
-rwxr-xr-xsrc/op_mode/generate_ovpn_client_file.py2
-rwxr-xr-xsrc/op_mode/generate_ssh_server_key.py6
-rwxr-xr-xsrc/op_mode/generate_system_login_user.py4
-rwxr-xr-xsrc/op_mode/igmp-proxy.py3
-rwxr-xr-xsrc/op_mode/ikev2_profile_generator.py2
-rwxr-xr-xsrc/op_mode/interfaces.py8
-rwxr-xr-xsrc/op_mode/ipoe-control.py5
-rwxr-xr-xsrc/op_mode/ipsec.py2
-rwxr-xr-xsrc/op_mode/lldp.py4
-rwxr-xr-xsrc/op_mode/log.py2
-rwxr-xr-xsrc/op_mode/nat.py4
-rwxr-xr-xsrc/op_mode/neighbor.py7
-rwxr-xr-xsrc/op_mode/nhrp.py6
-rwxr-xr-xsrc/op_mode/openconnect-control.py11
-rwxr-xr-xsrc/op_mode/openconnect.py2
-rwxr-xr-xsrc/op_mode/openvpn.py6
-rwxr-xr-xsrc/op_mode/ping.py2
-rwxr-xr-xsrc/op_mode/pki.py5
-rwxr-xr-xsrc/op_mode/policy_route.py4
-rwxr-xr-xsrc/op_mode/powerctrl.py6
-rwxr-xr-xsrc/op_mode/ppp-server-ctrl.py5
-rwxr-xr-xsrc/op_mode/reset_openvpn.py4
-rwxr-xr-xsrc/op_mode/reset_vpn.py4
-rwxr-xr-xsrc/op_mode/restart_dhcp_relay.py4
-rwxr-xr-xsrc/op_mode/restart_frr.py10
-rwxr-xr-xsrc/op_mode/route.py4
-rwxr-xr-xsrc/op_mode/sflow.py2
-rwxr-xr-xsrc/op_mode/show-bond.py2
-rwxr-xr-xsrc/op_mode/show_acceleration.py6
-rwxr-xr-xsrc/op_mode/show_openconnect_otp.py4
-rwxr-xr-xsrc/op_mode/show_openvpn_mfa.py6
-rwxr-xr-xsrc/op_mode/show_sensors.py22
-rw-r--r--src/op_mode/show_techsupport_report.py2
-rwxr-xr-xsrc/op_mode/show_virtual_server.py2
-rwxr-xr-xsrc/op_mode/show_wireless.py4
-rwxr-xr-xsrc/op_mode/show_wwan.py2
-rwxr-xr-xsrc/op_mode/snmp.py2
-rwxr-xr-xsrc/op_mode/snmp_ifmib.py4
-rwxr-xr-xsrc/op_mode/storage.py2
-rwxr-xr-xsrc/op_mode/traceroute.py2
-rwxr-xr-xsrc/op_mode/uptime.py6
-rwxr-xr-xsrc/op_mode/vpn_ike_sa.py6
-rwxr-xr-xsrc/op_mode/vpn_ipsec.py2
-rwxr-xr-xsrc/op_mode/vrf.py4
-rwxr-xr-xsrc/op_mode/wireguard_client.py6
-rwxr-xr-xsrc/op_mode/zone.py4
66 files changed, 169 insertions, 145 deletions
diff --git a/src/op_mode/accelppp.py b/src/op_mode/accelppp.py
index 00de45fc8..67ce786d0 100755
--- a/src/op_mode/accelppp.py
+++ b/src/op_mode/accelppp.py
@@ -21,7 +21,7 @@ import vyos.accel_ppp
import vyos.opmode
from vyos.configquery import ConfigTreeQuery
-from vyos.util import rc_cmd
+from vyos.utils.process import rc_cmd
accel_dict = {
diff --git a/src/op_mode/bgp.py b/src/op_mode/bgp.py
index af9ea788b..096113cb4 100755
--- a/src/op_mode/bgp.py
+++ b/src/op_mode/bgp.py
@@ -81,7 +81,7 @@ ArgFamily = typing.Literal['inet', 'inet6', 'l2vpn']
ArgFamilyModifier = typing.Literal['unicast', 'labeled_unicast', 'multicast', 'vpn', 'flowspec']
def show_summary(raw: bool):
- from vyos.util import cmd
+ from vyos.utils.process import cmd
if raw:
from json import loads
@@ -96,7 +96,7 @@ def show_summary(raw: bool):
return output
def show_neighbors(raw: bool):
- from vyos.util import cmd
+ from vyos.utils.process import cmd
from vyos.utils.dict import dict_to_list
if raw:
@@ -129,7 +129,7 @@ def show(raw: bool,
frr_command = frr_command_template.render(kwargs)
frr_command = re.sub(r'\s+', ' ', frr_command)
- from vyos.util import cmd
+ from vyos.utils.process import cmd
output = cmd(f"vtysh -c '{frr_command}'")
if raw:
diff --git a/src/op_mode/bridge.py b/src/op_mode/bridge.py
index d6098c158..5531c41d0 100755
--- a/src/op_mode/bridge.py
+++ b/src/op_mode/bridge.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -22,8 +22,9 @@ import typing
from sys import exit
from tabulate import tabulate
-from vyos.util import cmd, rc_cmd
-from vyos.util import dict_search
+from vyos.utils.process import cmd
+from vyos.utils.process import rc_cmd
+from vyos.utils.dict import dict_search
import vyos.opmode
diff --git a/src/op_mode/clear_conntrack.py b/src/op_mode/clear_conntrack.py
index 423694187..fec7cf144 100755
--- a/src/op_mode/clear_conntrack.py
+++ b/src/op_mode/clear_conntrack.py
@@ -16,8 +16,9 @@
import sys
-from vyos.util import ask_yes_no
-from vyos.util import cmd, DEVNULL
+from vyos.utils.io import ask_yes_no
+from vyos.utils.process import cmd
+from vyos.utils.process import DEVNULL
if not ask_yes_no("This will clear all currently tracked and expected connections. Continue?"):
sys.exit(1)
diff --git a/src/op_mode/clear_dhcp_lease.py b/src/op_mode/clear_dhcp_lease.py
index 250dbcce1..f372d3af0 100755
--- a/src/op_mode/clear_dhcp_lease.py
+++ b/src/op_mode/clear_dhcp_lease.py
@@ -7,9 +7,9 @@ from isc_dhcp_leases import Lease
from isc_dhcp_leases import IscDhcpLeases
from vyos.configquery import ConfigTreeQuery
-from vyos.util import ask_yes_no
-from vyos.util import call
-from vyos.util import commit_in_progress
+from vyos.utils.io import ask_yes_no
+from vyos.utils.process import call
+from vyos.utils.commit import commit_in_progress
config = ConfigTreeQuery()
diff --git a/src/op_mode/connect_disconnect.py b/src/op_mode/connect_disconnect.py
index d39e88bf3..89f929be7 100755
--- a/src/op_mode/connect_disconnect.py
+++ b/src/op_mode/connect_disconnect.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020-2021 VyOS maintainers and contributors
+# Copyright (C) 2020-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -19,10 +19,10 @@ import argparse
from psutil import process_iter
-from vyos.util import call
-from vyos.util import commit_in_progress
-from vyos.util import DEVNULL
-from vyos.util import is_wwan_connected
+from vyos.utils.process import call
+from vyos.utils.commit import commit_in_progress
+from vyos.utils.network import is_wwan_connected
+from vyos.utils.process import DEVNULL
def check_ppp_interface(interface):
if not os.path.isfile(f'/etc/ppp/peers/{interface}'):
diff --git a/src/op_mode/conntrack.py b/src/op_mode/conntrack.py
index ea7c4c208..cf8adf795 100755
--- a/src/op_mode/conntrack.py
+++ b/src/op_mode/conntrack.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -19,8 +19,8 @@ import typing
import xmltodict
from tabulate import tabulate
-from vyos.util import cmd
-from vyos.util import run
+from vyos.utils.process import cmd
+from vyos.utils.process import run
import vyos.opmode
diff --git a/src/op_mode/conntrack_sync.py b/src/op_mode/conntrack_sync.py
index c3345a936..a38688e45 100755
--- a/src/op_mode/conntrack_sync.py
+++ b/src/op_mode/conntrack_sync.py
@@ -24,10 +24,10 @@ import vyos.opmode
from argparse import ArgumentParser
from vyos.configquery import CliShellApiConfigQuery
from vyos.configquery import ConfigTreeQuery
-from vyos.util import call
-from vyos.util import commit_in_progress
-from vyos.util import cmd
-from vyos.util import run
+from vyos.utils.commit import commit_in_progress
+from vyos.utils.process import call
+from vyos.utils.process import cmd
+from vyos.utils.process import run
from vyos.template import render_to_string
conntrackd_bin = '/usr/sbin/conntrackd'
diff --git a/src/op_mode/container.py b/src/op_mode/container.py
index 7f726f076..5a022d0c0 100755
--- a/src/op_mode/container.py
+++ b/src/op_mode/container.py
@@ -19,7 +19,7 @@ import sys
from sys import exit
-from vyos.util import cmd
+from vyos.utils.process import cmd
import vyos.opmode
@@ -36,14 +36,14 @@ def _get_raw_data(command: str) -> list:
return data
def add_image(name: str):
- from vyos.util import rc_cmd
+ from vyos.utils.process import rc_cmd
rc, output = rc_cmd(f'podman image pull {name}')
if rc != 0:
raise vyos.opmode.InternalError(output)
def delete_image(name: str):
- from vyos.util import rc_cmd
+ from vyos.utils.process import rc_cmd
rc, output = rc_cmd(f'podman image rm --force {name}')
if rc != 0:
@@ -77,7 +77,7 @@ def show_network(raw: bool):
def restart(name: str):
- from vyos.util import rc_cmd
+ from vyos.utils.process import rc_cmd
rc, output = rc_cmd(f'systemctl restart vyos-container-{name}.service')
if rc != 0:
diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py
index fe7f252ba..3e51e990b 100755
--- a/src/op_mode/dhcp.py
+++ b/src/op_mode/dhcp.py
@@ -27,9 +27,9 @@ import vyos.opmode
from vyos.base import Warning
from vyos.configquery import ConfigTreeQuery
-from vyos.util import cmd
-from vyos.util import dict_search
-from vyos.util import is_systemd_service_running
+from vyos.utils.process import cmd
+from vyos.utils.dict import dict_search
+from vyos.utils.process import is_systemd_service_running
config = ConfigTreeQuery()
lease_valid_states = ['all', 'active', 'free', 'expired', 'released', 'abandoned', 'reset', 'backup']
diff --git a/src/op_mode/dns.py b/src/op_mode/dns.py
index f8863c530..2168aef89 100755
--- a/src/op_mode/dns.py
+++ b/src/op_mode/dns.py
@@ -20,7 +20,7 @@ import sys
from tabulate import tabulate
from vyos.configquery import ConfigTreeQuery
-from vyos.util import cmd
+from vyos.utils.process import cmd
import vyos.opmode
diff --git a/src/op_mode/dns_dynamic.py b/src/op_mode/dns_dynamic.py
index 76ca5249b..12aa5494a 100755
--- a/src/op_mode/dns_dynamic.py
+++ b/src/op_mode/dns_dynamic.py
@@ -22,7 +22,7 @@ from tabulate import tabulate
from vyos.config import Config
from vyos.template import is_ipv4, is_ipv6
-from vyos.util import call
+from vyos.utils.process import call
cache_file = r'/run/ddclient/ddclient.cache'
diff --git a/src/op_mode/dns_forwarding_reset.py b/src/op_mode/dns_forwarding_reset.py
index bfc640a26..55e20918f 100755
--- a/src/op_mode/dns_forwarding_reset.py
+++ b/src/op_mode/dns_forwarding_reset.py
@@ -25,7 +25,7 @@ import argparse
from sys import exit
from vyos.config import Config
-from vyos.util import call
+from vyos.utils.process import call
PDNS_CMD='/usr/bin/rec_control --socket-dir=/run/powerdns'
diff --git a/src/op_mode/dns_forwarding_statistics.py b/src/op_mode/dns_forwarding_statistics.py
index d79b6c024..32b5c76a7 100755
--- a/src/op_mode/dns_forwarding_statistics.py
+++ b/src/op_mode/dns_forwarding_statistics.py
@@ -4,7 +4,7 @@ import jinja2
from sys import exit
from vyos.config import Config
-from vyos.util import cmd
+from vyos.utils.process import cmd
PDNS_CMD='/usr/bin/rec_control --socket-dir=/run/powerdns'
diff --git a/src/op_mode/firewall.py b/src/op_mode/firewall.py
index 46bda5f7e..8260bbb77 100755
--- a/src/op_mode/firewall.py
+++ b/src/op_mode/firewall.py
@@ -21,8 +21,8 @@ import re
import tabulate
from vyos.config import Config
-from vyos.util import cmd
-from vyos.util import dict_search_args
+from vyos.utils.process import cmd
+from vyos.utils.dict import dict_search_args
def get_firewall_interfaces(firewall, name=None, ipv6=False):
directions = ['in', 'out', 'local']
diff --git a/src/op_mode/flow_accounting_op.py b/src/op_mode/flow_accounting_op.py
index 514143cd7..497ccafdf 100755
--- a/src/op_mode/flow_accounting_op.py
+++ b/src/op_mode/flow_accounting_op.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018 VyOS maintainers and contributors
+# Copyright (C) 2018-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -13,18 +13,18 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
import sys
import argparse
import re
import ipaddress
import os.path
+
from tabulate import tabulate
from json import loads
-from vyos.util import cmd
-from vyos.util import commit_in_progress
-from vyos.util import run
+from vyos.utils.commit import commit_in_progress
+from vyos.utils.process import cmd
+from vyos.utils.process import run
from vyos.logger import syslog
# some default values
diff --git a/src/op_mode/format_disk.py b/src/op_mode/format_disk.py
index b3ba44e87..31ceb196a 100755
--- a/src/op_mode/format_disk.py
+++ b/src/op_mode/format_disk.py
@@ -20,10 +20,10 @@ import re
from datetime import datetime
-from vyos.util import ask_yes_no
-from vyos.util import call
-from vyos.util import cmd
-from vyos.util import DEVNULL
+from vyos.utils.io import ask_yes_no
+from vyos.utils.process import call
+from vyos.utils.process import cmd
+from vyos.utils.process import DEVNULL
def list_disks():
disks = set()
diff --git a/src/op_mode/generate_interfaces_debug_archive.py b/src/op_mode/generate_interfaces_debug_archive.py
index f5767080a..3059aad23 100755
--- a/src/op_mode/generate_interfaces_debug_archive.py
+++ b/src/op_mode/generate_interfaces_debug_archive.py
@@ -20,7 +20,7 @@ from shutil import rmtree
from socket import gethostname
from sys import exit
from tarfile import open as tar_open
-from vyos.util import rc_cmd
+from vyos.utils.process import rc_cmd
import os
# define a list of commands that needs to be executed
diff --git a/src/op_mode/generate_ipsec_debug_archive.py b/src/op_mode/generate_ipsec_debug_archive.py
index 1422559a8..60195d48b 100755
--- a/src/op_mode/generate_ipsec_debug_archive.py
+++ b/src/op_mode/generate_ipsec_debug_archive.py
@@ -20,7 +20,7 @@ from shutil import rmtree
from socket import gethostname
from sys import exit
from tarfile import open as tar_open
-from vyos.util import rc_cmd
+from vyos.utils.process import rc_cmd
# define a list of commands that needs to be executed
CMD_LIST: list[str] = [
diff --git a/src/op_mode/generate_openconnect_otp_key.py b/src/op_mode/generate_openconnect_otp_key.py
index 363bcf3ea..99b67d261 100755
--- a/src/op_mode/generate_openconnect_otp_key.py
+++ b/src/op_mode/generate_openconnect_otp_key.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -17,7 +17,7 @@
import argparse
import os
-from vyos.util import popen
+from vyos.utils.process import popen
from secrets import token_hex
from base64 import b32encode
diff --git a/src/op_mode/generate_ovpn_client_file.py b/src/op_mode/generate_ovpn_client_file.py
index 0628e6135..cec370a07 100755
--- a/src/op_mode/generate_ovpn_client_file.py
+++ b/src/op_mode/generate_ovpn_client_file.py
@@ -22,7 +22,7 @@ from textwrap import fill
from vyos.configquery import ConfigTreeQuery
from vyos.ifconfig import Section
-from vyos.util import cmd
+from vyos.utils.process import cmd
client_config = """
diff --git a/src/op_mode/generate_ssh_server_key.py b/src/op_mode/generate_ssh_server_key.py
index 43e94048d..d6063c43c 100755
--- a/src/op_mode/generate_ssh_server_key.py
+++ b/src/op_mode/generate_ssh_server_key.py
@@ -15,9 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sys import exit
-from vyos.util import ask_yes_no
-from vyos.util import cmd
-from vyos.util import commit_in_progress
+from vyos.utils.io import ask_yes_no
+from vyos.utils.process import cmd
+from vyos.utils.commit import commit_in_progress
if not ask_yes_no('Do you really want to remove the existing SSH host keys?'):
exit(0)
diff --git a/src/op_mode/generate_system_login_user.py b/src/op_mode/generate_system_login_user.py
index 8f8827b1b..1b328eae0 100755
--- a/src/op_mode/generate_system_login_user.py
+++ b/src/op_mode/generate_system_login_user.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -17,7 +17,7 @@
import argparse
import os
-from vyos.util import popen
+from vyos.utils.process import popen
from secrets import token_hex
from base64 import b32encode
diff --git a/src/op_mode/igmp-proxy.py b/src/op_mode/igmp-proxy.py
index 0086c9aa6..a640b0bbf 100755
--- a/src/op_mode/igmp-proxy.py
+++ b/src/op_mode/igmp-proxy.py
@@ -28,7 +28,8 @@ import tabulate
import vyos.config
import vyos.opmode
-from vyos.util import bytes_to_human, print_error
+from vyos.util import bytes_to_human
+from vyos.utils.io import print_error
def _is_configured():
"""Check if IGMP proxy is configured"""
diff --git a/src/op_mode/ikev2_profile_generator.py b/src/op_mode/ikev2_profile_generator.py
index a22f04c45..5454cc0ce 100755
--- a/src/op_mode/ikev2_profile_generator.py
+++ b/src/op_mode/ikev2_profile_generator.py
@@ -24,7 +24,7 @@ from cryptography.x509.oid import NameOID
from vyos.configquery import ConfigTreeQuery
from vyos.pki import load_certificate
from vyos.template import render_to_string
-from vyos.util import ask_input
+from vyos.utils.io import ask_input
# Apple profiles only support one IKE/ESP encryption cipher and hash, whereas
# VyOS comes with a multitude of different proposals for a connection.
diff --git a/src/op_mode/interfaces.py b/src/op_mode/interfaces.py
index f38b95a71..782e178c6 100755
--- a/src/op_mode/interfaces.py
+++ b/src/op_mode/interfaces.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -28,7 +28,9 @@ import vyos.opmode
from vyos.ifconfig import Section
from vyos.ifconfig import Interface
from vyos.ifconfig import VRRP
-from vyos.util import cmd, rc_cmd, call
+from vyos.utils.process import cmd
+from vyos.utils.process import rc_cmd
+from vyos.utils.process import call
def catch_broken_pipe(func):
def wrapped(*args, **kwargs):
@@ -384,7 +386,7 @@ def _format_show_counters(data: list):
rx_errors = entry.get('rx_over_errors')
tx_errors = entry.get('tx_carrier_errors')
data_entries.append([interface, rx_packets, rx_bytes, tx_packets, tx_bytes, rx_dropped, tx_dropped, rx_errors, tx_errors])
-
+
headers = ['Interface', 'Rx Packets', 'Rx Bytes', 'Tx Packets', 'Tx Bytes', 'Rx Dropped', 'Tx Dropped', 'Rx Errors', 'Tx Errors']
output = tabulate(data_entries, headers, numalign="left")
print (output)
diff --git a/src/op_mode/ipoe-control.py b/src/op_mode/ipoe-control.py
index 7111498b2..0f33beca7 100755
--- a/src/op_mode/ipoe-control.py
+++ b/src/op_mode/ipoe-control.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020 VyOS maintainers and contributors
+# Copyright (C) 2020-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -18,7 +18,8 @@ import sys
import argparse
from vyos.config import Config
-from vyos.util import popen, run
+from vyos.utils.process import popen
+from vyos.utils.process import run
cmd_dict = {
'cmd_base' : '/usr/bin/accel-cmd -p 2002 ',
diff --git a/src/op_mode/ipsec.py b/src/op_mode/ipsec.py
index 823bd039d..774459771 100755
--- a/src/op_mode/ipsec.py
+++ b/src/op_mode/ipsec.py
@@ -23,7 +23,7 @@ from tabulate import tabulate
from vyos.util import convert_data
from vyos.util import seconds_to_human
-from vyos.util import cmd
+from vyos.utils.process import cmd
from vyos.configquery import ConfigTreeQuery
import vyos.opmode
diff --git a/src/op_mode/lldp.py b/src/op_mode/lldp.py
index 1a1b94783..c287b8fa6 100755
--- a/src/op_mode/lldp.py
+++ b/src/op_mode/lldp.py
@@ -22,8 +22,8 @@ import typing
from tabulate import tabulate
from vyos.configquery import ConfigTreeQuery
-from vyos.util import cmd
-from vyos.util import dict_search
+from vyos.utils.process import cmd
+from vyos.utils.dict import dict_search
import vyos.opmode
unconf_message = 'LLDP is not configured'
diff --git a/src/op_mode/log.py b/src/op_mode/log.py
index b0abd6191..797ba5a88 100755
--- a/src/op_mode/log.py
+++ b/src/op_mode/log.py
@@ -21,7 +21,7 @@ import typing
from jinja2 import Template
-from vyos.util import rc_cmd
+from vyos.utils.process import rc_cmd
import vyos.opmode
diff --git a/src/op_mode/nat.py b/src/op_mode/nat.py
index c92795745..71a40c0e1 100755
--- a/src/op_mode/nat.py
+++ b/src/op_mode/nat.py
@@ -25,8 +25,8 @@ from tabulate import tabulate
import vyos.opmode
from vyos.configquery import ConfigTreeQuery
-from vyos.util import cmd
-from vyos.util import dict_search
+from vyos.utils.process import cmd
+from vyos.utils.dict import dict_search
base = 'nat'
unconf_message = 'NAT is not configured'
diff --git a/src/op_mode/neighbor.py b/src/op_mode/neighbor.py
index b329ea280..1edeb0045 100755
--- a/src/op_mode/neighbor.py
+++ b/src/op_mode/neighbor.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -41,7 +41,7 @@ def interface_exists(interface):
def get_raw_data(family, interface=None, state=None):
from json import loads
- from vyos.util import cmd
+ from vyos.utils.process import cmd
if interface:
if not interface_exists(interface):
@@ -102,7 +102,7 @@ def show(raw: bool, family: ArgFamily, interface: typing.Optional[str],
return format_neighbors(data, interface)
def reset(family: ArgFamily, interface: typing.Optional[str], address: typing.Optional[str]):
- from vyos.util import run
+ from vyos.utils.process import run
if address and interface:
raise ValueError("interface and address parameters are mutually exclusive")
@@ -114,7 +114,6 @@ def reset(family: ArgFamily, interface: typing.Optional[str], address: typing.Op
# Flush an entire neighbor table
run(f"""ip --family {family} neighbor flush""")
-
if __name__ == '__main__':
try:
res = vyos.opmode.run(sys.modules[__name__])
diff --git a/src/op_mode/nhrp.py b/src/op_mode/nhrp.py
index 5ff91a59c..e66f33079 100755
--- a/src/op_mode/nhrp.py
+++ b/src/op_mode/nhrp.py
@@ -18,9 +18,9 @@ import sys
import tabulate
import vyos.opmode
-from vyos.util import cmd
-from vyos.util import process_named_running
-from vyos.util import colon_separated_to_dict
+from vyos.utils.process import cmd
+from vyos.utils.process import process_named_running
+from vyos.utils.dict import colon_separated_to_dict
def _get_formatted_output(output_dict: dict) -> str:
diff --git a/src/op_mode/openconnect-control.py b/src/op_mode/openconnect-control.py
index 20c50e779..b70d4fa16 100755
--- a/src/op_mode/openconnect-control.py
+++ b/src/op_mode/openconnect-control.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020 VyOS maintainers and contributors
+# Copyright (C) 2020-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -18,12 +18,13 @@ import sys
import argparse
import json
-from vyos.config import Config
-from vyos.util import popen
-from vyos.util import run
-from vyos.util import DEVNULL
from tabulate import tabulate
+from vyos.config import Config
+from vyos.utils.process import popen
+from vyos.utils.process import run
+from vyos.utils.process import DEVNULL
+
occtl = '/usr/bin/occtl'
occtl_socket = '/run/ocserv/occtl.socket'
diff --git a/src/op_mode/openconnect.py b/src/op_mode/openconnect.py
index b21890728..cfa0678a7 100755
--- a/src/op_mode/openconnect.py
+++ b/src/op_mode/openconnect.py
@@ -19,7 +19,7 @@ import json
from tabulate import tabulate
from vyos.configquery import ConfigTreeQuery
-from vyos.util import rc_cmd
+from vyos.utils.process import rc_cmd
import vyos.opmode
diff --git a/src/op_mode/openvpn.py b/src/op_mode/openvpn.py
index d9ae965c5..f59206330 100755
--- a/src/op_mode/openvpn.py
+++ b/src/op_mode/openvpn.py
@@ -24,9 +24,9 @@ from tabulate import tabulate
import vyos.opmode
from vyos.util import bytes_to_human
-from vyos.util import commit_in_progress
-from vyos.util import call
-from vyos.util import rc_cmd
+from vyos.utils.commit import commit_in_progress
+from vyos.utils.process import call
+from vyos.utils.process import rc_cmd
from vyos.config import Config
ArgMode = typing.Literal['client', 'server', 'site_to_site']
diff --git a/src/op_mode/ping.py b/src/op_mode/ping.py
index 610e63cb3..934cfdb52 100755
--- a/src/op_mode/ping.py
+++ b/src/op_mode/ping.py
@@ -18,7 +18,7 @@ import os
import sys
import socket
import ipaddress
-from vyos.util import get_all_vrfs
+from vyos.utils.network import get_all_vrfs
from vyos.ifconfig import Section
diff --git a/src/op_mode/pki.py b/src/op_mode/pki.py
index 7ea295ff1..7a8195a89 100755
--- a/src/op_mode/pki.py
+++ b/src/op_mode/pki.py
@@ -35,8 +35,9 @@ from vyos.pki import load_certificate, load_certificate_request, load_private_ke
from vyos.pki import load_crl, load_dh_parameters, load_public_key
from vyos.pki import verify_certificate
from vyos.xml import defaults
-from vyos.util import ask_input, ask_yes_no
-from vyos.util import cmd
+from vyos.utils.io import ask_input
+from vyos.utils.io import ask_yes_no
+from vyos.utils.process import cmd
from vyos.util import install_into_config
CERT_REQ_END = '-----END CERTIFICATE REQUEST-----'
diff --git a/src/op_mode/policy_route.py b/src/op_mode/policy_route.py
index fae47adec..eff99de7f 100755
--- a/src/op_mode/policy_route.py
+++ b/src/op_mode/policy_route.py
@@ -19,8 +19,8 @@ import re
import tabulate
from vyos.config import Config
-from vyos.util import cmd
-from vyos.util import dict_search_args
+from vyos.utils.process import cmd
+from vyos.utils.dict import dict_search_args
def get_config_policy(conf, name=None, ipv6=False):
config_path = ['policy']
diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py
index 2bb2e717b..3ac5991b4 100755
--- a/src/op_mode/powerctrl.py
+++ b/src/op_mode/powerctrl.py
@@ -22,7 +22,11 @@ from datetime import datetime, timedelta, time as type_time, date as type_date
from sys import exit
from time import time
-from vyos.util import ask_yes_no, cmd, call, run, STDOUT
+from vyos.utils.io import ask_yes_no
+from vyos.utils.process import call
+from vyos.utils.process import cmd
+from vyos.utils.process import run
+from vyos.utils.process import STDOUT
systemd_sched_file = "/run/systemd/shutdown/scheduled"
diff --git a/src/op_mode/ppp-server-ctrl.py b/src/op_mode/ppp-server-ctrl.py
index e93963fdd..2bae5b32a 100755
--- a/src/op_mode/ppp-server-ctrl.py
+++ b/src/op_mode/ppp-server-ctrl.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019 VyOS maintainers and contributors
+# Copyright (C) 2019-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -18,7 +18,8 @@ import sys
import argparse
from vyos.config import Config
-from vyos.util import popen, DEVNULL
+from vyos.utils.process import popen
+from vyos.utils.process import DEVNULL
cmd_dict = {
'cmd_base' : '/usr/bin/accel-cmd -p {} ',
diff --git a/src/op_mode/reset_openvpn.py b/src/op_mode/reset_openvpn.py
index efbf65083..cef5299da 100755
--- a/src/op_mode/reset_openvpn.py
+++ b/src/op_mode/reset_openvpn.py
@@ -16,8 +16,8 @@
import os
from sys import argv, exit
-from vyos.util import call
-from vyos.util import commit_in_progress
+from vyos.utils.process import call
+from vyos.utils.commit import commit_in_progress
if __name__ == '__main__':
if (len(argv) < 1):
diff --git a/src/op_mode/reset_vpn.py b/src/op_mode/reset_vpn.py
index 46195d6cd..61d7c8c81 100755
--- a/src/op_mode/reset_vpn.py
+++ b/src/op_mode/reset_vpn.py
@@ -13,10 +13,11 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
import sys
import typing
-from vyos.util import run
+from vyos.utils.process import run
import vyos.opmode
@@ -29,7 +30,6 @@ cmd_dict = {
}
}
-
def reset_conn(protocol: str, username: typing.Optional[str] = None,
interface: typing.Optional[str] = None):
if protocol in cmd_dict['vpn_types']:
diff --git a/src/op_mode/restart_dhcp_relay.py b/src/op_mode/restart_dhcp_relay.py
index 9203c009f..3ead97f4c 100755
--- a/src/op_mode/restart_dhcp_relay.py
+++ b/src/op_mode/restart_dhcp_relay.py
@@ -23,8 +23,8 @@ import argparse
import os
import vyos.config
-from vyos.util import call
-from vyos.util import commit_in_progress
+from vyos.utils.process import call
+from vyos.utils.commit import commit_in_progress
parser = argparse.ArgumentParser()
diff --git a/src/op_mode/restart_frr.py b/src/op_mode/restart_frr.py
index 680d9f8cc..5cce377eb 100755
--- a/src/op_mode/restart_frr.py
+++ b/src/op_mode/restart_frr.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019-2021 VyOS maintainers and contributors
+# Copyright (C) 2019-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -23,10 +23,10 @@ from logging.handlers import SysLogHandler
from shutil import rmtree
from vyos.base import Warning
-from vyos.util import call
-from vyos.util import ask_yes_no
-from vyos.util import process_named_running
-from vyos.util import makedir
+from vyos.utils.io import ask_yes_no
+from vyos.utils.file import makedir
+from vyos.utils.process import call
+from vyos.utils.process import process_named_running
# some default values
watchfrr = '/usr/lib/frr/watchfrr.sh'
diff --git a/src/op_mode/route.py b/src/op_mode/route.py
index d6d6b7d6f..4aa57dbf4 100755
--- a/src/op_mode/route.py
+++ b/src/op_mode/route.py
@@ -57,7 +57,7 @@ frr_command_template = Template("""
ArgFamily = typing.Literal['inet', 'inet6']
def show_summary(raw: bool, family: ArgFamily, table: typing.Optional[int], vrf: typing.Optional[str]):
- from vyos.util import cmd
+ from vyos.utils.process import cmd
if family == 'inet':
family_cmd = 'ip'
@@ -119,7 +119,7 @@ def show(raw: bool,
frr_command = frr_command_template.render(kwargs)
frr_command = re.sub(r'\s+', ' ', frr_command)
- from vyos.util import cmd
+ from vyos.utils.process import cmd
output = cmd(f"vtysh -c '{frr_command}'")
if raw:
diff --git a/src/op_mode/sflow.py b/src/op_mode/sflow.py
index 88f70d6bd..dca7f44cb 100755
--- a/src/op_mode/sflow.py
+++ b/src/op_mode/sflow.py
@@ -20,7 +20,7 @@ import sys
from tabulate import tabulate
from vyos.configquery import ConfigTreeQuery
-from vyos.util import cmd
+from vyos.utils.process import cmd
import vyos.opmode
diff --git a/src/op_mode/show-bond.py b/src/op_mode/show-bond.py
index edf7847fc..f676e0841 100755
--- a/src/op_mode/show-bond.py
+++ b/src/op_mode/show-bond.py
@@ -19,7 +19,7 @@ import jinja2
from argparse import ArgumentParser
from vyos.ifconfig import Section
from vyos.ifconfig import BondIf
-from vyos.util import read_file
+from vyos.utils.file import read_file
from sys import exit
diff --git a/src/op_mode/show_acceleration.py b/src/op_mode/show_acceleration.py
index 48c31d4d9..1c4831f1d 100755
--- a/src/op_mode/show_acceleration.py
+++ b/src/op_mode/show_acceleration.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019-2022 VyOS maintainers and contributors
+# Copyright (C) 2019-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -20,8 +20,8 @@ import re
import argparse
from vyos.config import Config
-from vyos.util import popen
-from vyos.util import call
+from vyos.utils.process import call
+from vyos.utils.process import popen
def detect_qat_dev():
output, err = popen('lspci -nn', decode='utf-8')
diff --git a/src/op_mode/show_openconnect_otp.py b/src/op_mode/show_openconnect_otp.py
index 88982c50b..415a5f72c 100755
--- a/src/op_mode/show_openconnect_otp.py
+++ b/src/op_mode/show_openconnect_otp.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-# Copyright 2017, 2022 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2017-2023 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,7 @@ import os
from vyos.config import Config
from vyos.xml import defaults
from vyos.configdict import dict_merge
-from vyos.util import popen
+from vyos.utils.process import popen
from base64 import b32encode
otp_file = '/run/ocserv/users.oath'
diff --git a/src/op_mode/show_openvpn_mfa.py b/src/op_mode/show_openvpn_mfa.py
index 1ab54600c..100c42154 100755
--- a/src/op_mode/show_openvpn_mfa.py
+++ b/src/op_mode/show_openvpn_mfa.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
-
-# Copyright 2017, 2021 VyOS maintainers and contributors <maintainers@vyos.io>
+#
+# Copyright 2017-2023 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@ import socket
import urllib.parse
import argparse
-from vyos.util import popen
+from vyos.utils.process import popen
otp_file = '/config/auth/openvpn/{interface}-otp-secrets'
diff --git a/src/op_mode/show_sensors.py b/src/op_mode/show_sensors.py
index 6ae477647..5e3084fe9 100755
--- a/src/op_mode/show_sensors.py
+++ b/src/op_mode/show_sensors.py
@@ -1,9 +1,25 @@
#!/usr/bin/env python3
+#
+# Copyright 2017-2023 VyOS maintainers and contributors <maintainers@vyos.io>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library. If not, see <http://www.gnu.org/licenses/>.
import re
import sys
-from vyos.util import popen
-from vyos.util import DEVNULL
+from vyos.utils.process import popen
+from vyos.utils.process import DEVNULL
+
output,retcode = popen("sensors --no-adapter", stderr=DEVNULL)
if retcode == 0:
print (output)
@@ -23,5 +39,3 @@ else:
print ("No sensors found")
sys.exit(1)
-
-
diff --git a/src/op_mode/show_techsupport_report.py b/src/op_mode/show_techsupport_report.py
index 782004144..d27221e54 100644
--- a/src/op_mode/show_techsupport_report.py
+++ b/src/op_mode/show_techsupport_report.py
@@ -17,7 +17,7 @@
import os
from typing import List
-from vyos.util import rc_cmd
+from vyos.utils.process import rc_cmd
from vyos.ifconfig import Section
from vyos.ifconfig import Interface
diff --git a/src/op_mode/show_virtual_server.py b/src/op_mode/show_virtual_server.py
index 377180dec..7880edc97 100755
--- a/src/op_mode/show_virtual_server.py
+++ b/src/op_mode/show_virtual_server.py
@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from vyos.configquery import ConfigTreeQuery
-from vyos.util import call
+from vyos.utils.process import call
def is_configured():
""" Check if high-availability virtual-server is configured """
diff --git a/src/op_mode/show_wireless.py b/src/op_mode/show_wireless.py
index 19ab6771c..340163057 100755
--- a/src/op_mode/show_wireless.py
+++ b/src/op_mode/show_wireless.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2019 VyOS maintainers and contributors
+# Copyright (C) 2019-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -21,7 +21,7 @@ from sys import exit
from copy import deepcopy
from vyos.config import Config
-from vyos.util import popen
+from vyos.utils.process import popen
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--scan", help="Scan for Wireless APs on given interface, e.g. 'wlan0'")
diff --git a/src/op_mode/show_wwan.py b/src/op_mode/show_wwan.py
index eb601a456..bd97bb0e5 100755
--- a/src/op_mode/show_wwan.py
+++ b/src/op_mode/show_wwan.py
@@ -18,7 +18,7 @@ import argparse
from sys import exit
from vyos.configquery import ConfigTreeQuery
-from vyos.util import cmd
+from vyos.utils.process import cmd
parser = argparse.ArgumentParser()
parser.add_argument("--model", help="Get module model", action="store_true")
diff --git a/src/op_mode/snmp.py b/src/op_mode/snmp.py
index 5fae67881..43f5d9e0a 100755
--- a/src/op_mode/snmp.py
+++ b/src/op_mode/snmp.py
@@ -24,7 +24,7 @@ import sys
import argparse
from vyos.config import Config
-from vyos.util import call
+from vyos.utils.process import call
config_file_daemon = r'/etc/snmp/snmpd.conf'
diff --git a/src/op_mode/snmp_ifmib.py b/src/op_mode/snmp_ifmib.py
index 2479936bd..c71febac9 100755
--- a/src/op_mode/snmp_ifmib.py
+++ b/src/op_mode/snmp_ifmib.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018 VyOS maintainers and contributors
+# Copyright (C) 2018-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -24,7 +24,7 @@ import argparse
import netifaces
from vyos.config import Config
-from vyos.util import popen
+from vyos.utils.process import popen
parser = argparse.ArgumentParser(description='Retrieve SNMP interfaces information')
parser.add_argument('--ifindex', action='store', nargs='?', const='all', help='Show interface index')
diff --git a/src/op_mode/storage.py b/src/op_mode/storage.py
index d16e271bd..9704a9cf5 100755
--- a/src/op_mode/storage.py
+++ b/src/op_mode/storage.py
@@ -18,7 +18,7 @@
import sys
import vyos.opmode
-from vyos.util import cmd
+from vyos.utils.process import cmd
# FIY: As of coreutils from Debian Buster and Bullseye,
# the outpt looks like this:
diff --git a/src/op_mode/traceroute.py b/src/op_mode/traceroute.py
index 6c7030ea0..2f0edf53a 100755
--- a/src/op_mode/traceroute.py
+++ b/src/op_mode/traceroute.py
@@ -18,7 +18,7 @@ import os
import sys
import socket
import ipaddress
-from vyos.util import get_all_vrfs
+from vyos.utils.network import get_all_vrfs
from vyos.ifconfig import Section
diff --git a/src/op_mode/uptime.py b/src/op_mode/uptime.py
index 2ebe6783b..62908164e 100755
--- a/src/op_mode/uptime.py
+++ b/src/op_mode/uptime.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2021-2022 VyOS maintainers and contributors
+# Copyright (C) 2021-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -20,7 +20,7 @@ import vyos.opmode
def _get_uptime_seconds():
from re import search
- from vyos.util import read_file
+ from vyos.utils.file import read_file
data = read_file("/proc/uptime")
seconds = search("([0-9\.]+)\s", data).group(1)
@@ -29,7 +29,7 @@ def _get_uptime_seconds():
def _get_load_averages():
from re import search
- from vyos.util import cmd
+ from vyos.utils.process import cmd
from vyos.cpu import get_core_count
data = cmd("uptime")
diff --git a/src/op_mode/vpn_ike_sa.py b/src/op_mode/vpn_ike_sa.py
index 4b44c5c15..069c12069 100755
--- a/src/op_mode/vpn_ike_sa.py
+++ b/src/op_mode/vpn_ike_sa.py
@@ -19,7 +19,7 @@ import re
import sys
import vici
-from vyos.util import process_named_running
+from vyos.utils.process import process_named_running
ike_sa_peer_prefix = """\
Peer ID / IP Local ID / IP
@@ -39,8 +39,6 @@ def ike_sa(peer, nat):
peers = []
for conn in sas:
for name, sa in conn.items():
- if peer and not name.startswith('peer_' + peer):
- continue
if name.startswith('peer_') and name in peers:
continue
if nat and 'nat-local' not in sa:
@@ -70,7 +68,7 @@ if __name__ == '__main__':
args = parser.parse_args()
- if not process_named_running('charon'):
+ if not process_named_running('charon-systemd'):
print("IPsec Process NOT Running")
sys.exit(0)
diff --git a/src/op_mode/vpn_ipsec.py b/src/op_mode/vpn_ipsec.py
index b81d1693e..ef89e605f 100755
--- a/src/op_mode/vpn_ipsec.py
+++ b/src/op_mode/vpn_ipsec.py
@@ -17,7 +17,7 @@
import re
import argparse
-from vyos.util import call
+from vyos.utils.process import call
SWANCTL_CONF = '/etc/swanctl/swanctl.conf'
diff --git a/src/op_mode/vrf.py b/src/op_mode/vrf.py
index a9a416761..1f0bbbaeb 100755
--- a/src/op_mode/vrf.py
+++ b/src/op_mode/vrf.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2022 VyOS maintainers and contributors
+# Copyright (C) 2022-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -20,7 +20,7 @@ import sys
import typing
from tabulate import tabulate
-from vyos.util import cmd
+from vyos.utils.process import cmd
import vyos.opmode
diff --git a/src/op_mode/wireguard_client.py b/src/op_mode/wireguard_client.py
index 76c1ff7d1..04d8ce28c 100755
--- a/src/op_mode/wireguard_client.py
+++ b/src/op_mode/wireguard_client.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2021 VyOS maintainers and contributors
+# Copyright (C) 2021-2023 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -23,8 +23,8 @@ from ipaddress import ip_interface
from vyos.ifconfig import Section
from vyos.template import is_ipv4
from vyos.template import is_ipv6
-from vyos.util import cmd
-from vyos.util import popen
+from vyos.utils.process import cmd
+from vyos.utils.process import popen
if os.geteuid() != 0:
exit("You need to have root privileges to run this script.\nPlease try again, this time using 'sudo'. Exiting.")
diff --git a/src/op_mode/zone.py b/src/op_mode/zone.py
index f326215b1..17ce90396 100755
--- a/src/op_mode/zone.py
+++ b/src/op_mode/zone.py
@@ -19,8 +19,8 @@ import vyos.opmode
import tabulate
from vyos.configquery import ConfigTreeQuery
-from vyos.util import dict_search_args
-from vyos.util import dict_search
+from vyos.utils.dict import dict_search_args
+from vyos.utils.dict import dict_search
def get_config_zone(conf, name=None):