summaryrefslogtreecommitdiff
path: root/src/op_mode/ping.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/op_mode/ping.py')
-rwxr-xr-xsrc/op_mode/ping.py28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/op_mode/ping.py b/src/op_mode/ping.py
index f1d87a118..583d8792c 100755
--- a/src/op_mode/ping.py
+++ b/src/op_mode/ping.py
@@ -1,6 +1,6 @@
#! /usr/bin/env python3
-# Copyright (C) 2020 VyOS maintainers and contributors
+# Copyright (C) 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
@@ -14,29 +14,13 @@
# 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 os
import sys
import socket
import ipaddress
-from vyos.utils.network import get_all_vrfs
-from vyos.ifconfig import Section
-
-
-def interface_list() -> list:
- """
- Get list of interfaces in system
- :rtype: list
- """
- return Section.interfaces()
-
-
-def vrf_list() -> list:
- """
- Get list of VRFs in system
- :rtype: list
- """
- return list(get_all_vrfs().keys())
+from vyos.utils.network import interface_list
+from vyos.utils.network import vrf_list
+from vyos.utils.process import call
options = {
'audible': {
@@ -295,6 +279,4 @@ if __name__ == '__main__':
sys.exit(f'ping: Unknown host: {host}')
command = convert(ping[version], args)
-
- # print(f'{command} {host}')
- os.system(f'{command} {host}')
+ call(f'{command} {host}')