diff options
| author | Christian Poessinger <christian@poessinger.com> | 2019-09-03 12:54:18 +0200 | 
|---|---|---|
| committer | Christian Poessinger <christian@poessinger.com> | 2019-09-03 12:54:18 +0200 | 
| commit | c25a04907f3088aa29c7ffdb7c338fa169d891f4 (patch) | |
| tree | 6fc3245d4ff0fd47fee095ec9bdd3d5b4641c9d2 /python | |
| parent | cb9aa5447e79df7d83704a5e039937b72c77177d (diff) | |
| download | vyos-1x-c25a04907f3088aa29c7ffdb7c338fa169d891f4.tar.gz vyos-1x-c25a04907f3088aa29c7ffdb7c338fa169d891f4.zip | |
Python/ifconfig: T1557: bonding: add {add,del}_port for slave interface
Diffstat (limited to 'python')
| -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) + | 
