summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-11-19 07:37:56 +0100
committerChristian Poessinger <christian@poessinger.com>2021-11-19 07:37:59 +0100
commita14f93adfa633eabff90524e1f83d56092ec0c3c (patch)
tree6b7eb461cf3bcffde26be4dccf199fa16705d1a6 /python
parentd9a19b77a56031fa3fbfa43a85c8be7ee83ae3d7 (diff)
downloadvyos-1x-a14f93adfa633eabff90524e1f83d56092ec0c3c.tar.gz
vyos-1x-a14f93adfa633eabff90524e1f83d56092ec0c3c.zip
ethernet: T4011: deleting interface should place interface in admin down state
Interface will still be visible to the operating system.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/ethernet.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/ethernet.py b/python/vyos/ifconfig/ethernet.py
index 2e59a7afc..9d54dc78e 100644
--- a/python/vyos/ifconfig/ethernet.py
+++ b/python/vyos/ifconfig/ethernet.py
@@ -80,6 +80,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.