diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-03 13:57:57 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-03 13:57:57 +0200 |
commit | 74fcfa7fb48601febd0d9d0e4d53db20b28e4898 (patch) | |
tree | c8a6c903afb180cfbb2f6e8f87877de1f346e6bb /python | |
parent | 90e58236898918a3bc27ce451e245647e712ad40 (diff) | |
download | vyos-1x-74fcfa7fb48601febd0d9d0e4d53db20b28e4898.tar.gz vyos-1x-74fcfa7fb48601febd0d9d0e4d53db20b28e4898.zip |
Python/ifconfig: T1557: bonding: add get_slaves() call
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 0dba21ab1..e58c7e0bb 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1103,3 +1103,15 @@ class BondIf(Interface): return self._write_sysfs('/sys/class/net/{}/bonding/slaves' .format(self._ifname), '-' + interface) + def get_slaves(self): + """ + Return a list with all configured slave interfaces on this bond. + + Example: + >>> from vyos.ifconfig import Interface + >>> BondIf('bond0').get_slaves() + ['eth1', 'eth2'] + """ + slaves = self._read_sysfs('/sys/class/net/{}/bonding/slaves' + .format(self._ifname)) + return list(map(str, slaves.split())) |