From a34d189f3218199e329892b3ce88b367337a6de8 Mon Sep 17 00:00:00 2001 From: aapostoliuk Date: Thu, 10 Nov 2022 16:27:23 +0200 Subject: T4496: Refactoring vrf_list function in ping command Changed the function code of vrf_list to using the function from vyos.util --- src/op_mode/ping.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/op_mode') 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 = { -- cgit v1.2.3