diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-11-19 07:37:56 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-11-19 07:39:04 +0100 |
commit | 783dcc13e22be9d81179ab986062a12ed49cd601 (patch) | |
tree | 9e42df753bf6a3d832d02215520cdcc37bf70d1d /python/vyos | |
parent | 038fb7a4dd7d22c9fc604811509f9a1477d4a89d (diff) | |
download | vyos-1x-783dcc13e22be9d81179ab986062a12ed49cd601.tar.gz vyos-1x-783dcc13e22be9d81179ab986062a12ed49cd601.zip |
ethernet: T4011: deleting interface should place interface in admin down state
Interface will still be visible to the operating system.
(cherry picked from commit a14f93adfa633eabff90524e1f83d56092ec0c3c)
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/ifconfig/ethernet.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py index d06b0a842..4ae350634 100644 --- a/python/vyos/ifconfig/ethernet.py +++ b/python/vyos/ifconfig/ethernet.py @@ -81,6 +81,23 @@ class EthernetIf(Interface): super().__init__(ifname, **kargs) self.ethtool = Ethtool(ifname) + def remove(self): + """ + Remove interface from config. Removing the interface deconfigures all + assigned IP addresses. + Example: + >>> from vyos.ifconfig import WWANIf + >>> i = EthernetIf('eth0') + >>> i.remove() + """ + + if self.exists(self.ifname): + # interface is placed in A/D state when removed from config! It + # will remain visible for the operating system. + self.set_admin_state('down') + + super().remove() + def set_flow_control(self, enable): """ Changes the pause parameters of the specified Ethernet device. |