From c25a04907f3088aa29c7ffdb7c338fa169d891f4 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 3 Sep 2019 12:54:18 +0200 Subject: Python/ifconfig: T1557: bonding: add {add,del}_port for slave interface --- python/vyos/ifconfig.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 10653c645..74b90d0c4 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -913,10 +913,9 @@ class BridgeIf(Interface): def del_port(self, interface): """ - Add bridge member port + Remove member port from bridge instance. Example: - >>> from vyos.ifconfig import Interface >>> BridgeIf('br0').del_port('eth1') """ @@ -1076,3 +1075,26 @@ class BondIf(Interface): return self._write_sysfs('/sys/class/net/{}/bonding/arp_ip_target' .format(self._ifname), target) + def add_port(self, interface): + """ + Enslave physical interface to bond + + Example: + >>> from vyos.ifconfig import Interface + >>> BondIf('bond0').add_port('eth0') + >>> BondIf('bond0').add_port('eth1') + """ + return self._write_sysfs('/sys/class/net/{}/bonding/slaves' + .format(self._ifname), '+' + target) + + def del_port(self, interface): + """ + Remove physical port from bond + + Example: + >>> from vyos.ifconfig import Interface + >>> BondIf('bond0').del_port('eth1') + """ + return self._write_sysfs('/sys/class/net/{}/bonding/slaves' + .format(self._ifname), '-' + target) + -- cgit v1.2.3