summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-11-27 15:25:18 +0100
committerGitHub <noreply@github.com>2023-11-27 15:25:18 +0100
commit5f575360b0c996187e7f05cccc5caff6a658544d (patch)
tree562c3eed41cd3d603ee12ad4fe02a6a43b1c6ce7 /python
parentb1a6d770e2d391119b318bcd7fa7ae438555440b (diff)
parente02546655adefe1a6fb3660402e697f872d3ffe7 (diff)
downloadvyos-1x-5f575360b0c996187e7f05cccc5caff6a658544d.tar.gz
vyos-1x-5f575360b0c996187e7f05cccc5caff6a658544d.zip
Merge pull request #2546 from c-po/t5749-vrf-fixup
vyos.utils: T5749: fix get_vrf_members() call to iproute2
Diffstat (limited to 'python')
-rw-r--r--python/vyos/utils/network.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py
index 6a5de5423..2a0808fca 100644
--- a/python/vyos/utils/network.py
+++ b/python/vyos/utils/network.py
@@ -61,14 +61,17 @@ def get_vrf_members(vrf: str) -> list:
"""
import json
from vyos.utils.process import cmd
- if not interface_exists(vrf):
- raise ValueError(f'VRF "{vrf}" does not exist!')
- output = cmd(f'ip --json --brief link show master {vrf}')
- answer = json.loads(output)
interfaces = []
- for data in answer:
- if 'ifname' in data:
- interfaces.append(data.get('ifname'))
+ try:
+ if not interface_exists(vrf):
+ raise ValueError(f'VRF "{vrf}" does not exist!')
+ output = cmd(f'ip --json --brief link show vrf {vrf}')
+ answer = json.loads(output)
+ for data in answer:
+ if 'ifname' in data:
+ interfaces.append(data.get('ifname'))
+ except:
+ pass
return interfaces
def get_interface_vrf(interface):