summaryrefslogtreecommitdiff
path: root/src/op_mode/ping.py
diff options
context:
space:
mode:
authoraapostoliuk <a.apostoliuk@vyos.io>2022-11-10 16:27:23 +0200
committeraapostoliuk <a.apostoliuk@vyos.io>2022-11-10 16:27:23 +0200
commita34d189f3218199e329892b3ce88b367337a6de8 (patch)
tree56e90d341b7c3a8814e44f56d688398de5d92c74 /src/op_mode/ping.py
parentaabfb09e42079eb735904ced2fab600de5a550f3 (diff)
downloadvyos-1x-a34d189f3218199e329892b3ce88b367337a6de8.tar.gz
vyos-1x-a34d189f3218199e329892b3ce88b367337a6de8.zip
T4496: Refactoring vrf_list function in ping command
Changed the function code of vrf_list to using the function from vyos.util
Diffstat (limited to 'src/op_mode/ping.py')
-rwxr-xr-xsrc/op_mode/ping.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/op_mode/ping.py b/src/op_mode/ping.py
index 5e5b95a0a..610e63cb3 100755
--- a/src/op_mode/ping.py
+++ b/src/op_mode/ping.py
@@ -18,8 +18,7 @@ import os
import sys
import socket
import ipaddress
-import json
-from vyos.util import cmd, rc_cmd
+from vyos.util import get_all_vrfs
from vyos.ifconfig import Section
@@ -36,13 +35,7 @@ def vrf_list() -> list:
Get list of VRFs in system
:rtype: list
"""
- result = cmd(f'sudo ip --json --brief link show type vrf')
- data = json.loads(result)
- vrflist: list = []
- for o in data:
- if 'ifname' in o:
- vrflist.append(o['ifname'])
- return vrflist
+ return list(get_all_vrfs().keys())
options = {