diff options
-rw-r--r-- | python/vyos/ifconfig.py | 26 |
1 files changed, 24 insertions, 2 deletions
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) + |