summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-11-10 19:13:23 +0100
committerGitHub <noreply@github.com>2022-11-10 19:13:23 +0100
commit4b3ab8de85618a96b89ffa84094f49b1fca06e0c (patch)
tree6b6194186d7987e61078c84edf518de838c1a0b8
parent991d92e60c5087a0e00cc7dccc144f62927ddd4e (diff)
parenta34d189f3218199e329892b3ce88b367337a6de8 (diff)
downloadvyos-1x-4b3ab8de85618a96b89ffa84094f49b1fca06e0c.tar.gz
vyos-1x-4b3ab8de85618a96b89ffa84094f49b1fca06e0c.zip
Merge pull request #1652 from aapostoliuk/T4496-sagitta
T4496: Refactoring vrf_list function in ping command
-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 = {