summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-07-08 17:30:02 +0200
committerChristian Breunig <christian@breunig.cc>2023-07-08 17:30:02 +0200
commit618984bb98acf25d2d201c155e7911b0a1cf4ec2 (patch)
tree8ca96e229985bd00f2b8ffb1d5badd7c4e7d1929 /python/vyos/util.py
parent79abc95eff245c7bedf496781bbe74a6e40c9ce5 (diff)
downloadvyos-1x-618984bb98acf25d2d201c155e7911b0a1cf4ec2.tar.gz
vyos-1x-618984bb98acf25d2d201c155e7911b0a1cf4ec2.zip
vyos.utils: T5195: take the time and use the full command over an abbreviation
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r--python/vyos/util.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 33da5da40..ed651fdc3 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -913,7 +913,7 @@ def get_interface_config(interface):
if not os.path.exists(f'/sys/class/net/{interface}'):
return None
from json import loads
- tmp = loads(cmd(f'ip -d -j link show {interface}'))[0]
+ tmp = loads(cmd(f'ip --detail --json link show dev {interface}'))[0]
return tmp
def get_interface_address(interface):
@@ -923,7 +923,7 @@ def get_interface_address(interface):
if not os.path.exists(f'/sys/class/net/{interface}'):
return None
from json import loads
- tmp = loads(cmd(f'ip -d -j addr show {interface}'))[0]
+ tmp = loads(cmd(f'ip --detail --json addr show dev {interface}'))[0]
return tmp
def get_interface_namespace(iface):
@@ -937,17 +937,17 @@ def get_interface_namespace(iface):
return None
for ns in tmp:
- namespace = f'{ns["name"]}'
+ netns = f'{ns["name"]}'
# Search interface in each netns
- data = loads(cmd(f'ip netns exec {namespace} ip -j link show'))
- for compare in data:
- if iface == compare["ifname"]:
- return namespace
+ data = loads(cmd(f'ip netns exec {netns} ip --json link show'))
+ for tmp in data:
+ if iface == tmp["ifname"]:
+ return netns
def get_all_vrfs():
""" Return a dictionary of all system wide known VRF instances """
from json import loads
- tmp = loads(cmd('ip -j vrf list'))
+ tmp = loads(cmd('ip --json vrf list'))
# Result is of type [{"name":"red","table":1000},{"name":"blue","table":2000}]
# so we will re-arrange it to a more nicer representation:
# {'red': {'table': 1000}, 'blue': {'table': 2000}}