summaryrefslogtreecommitdiff
path: root/python/vyos/configinterface.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/configinterface.py')
-rw-r--r--python/vyos/configinterface.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/python/vyos/configinterface.py b/python/vyos/configinterface.py
index 0f5b0842c..843d1c739 100644
--- a/python/vyos/configinterface.py
+++ b/python/vyos/configinterface.py
@@ -151,3 +151,24 @@ def remove_interface_address(intf, addr):
raise ConfigError('{} is not a valid interface address'.format(addr))
pass
+
+def remove_interface(ifname):
+ """
+ Remove given interface from operating system, e.g. 'dum0'
+ """
+
+ if os.path.isdir('/sys/class/net/' + ifname):
+ os.system('ip link delete "{}"'.format(ifname))
+
+ pass
+
+def add_interface(type, ifname):
+ """
+ Add given interface to operating system, e.g. add 'dummy' interface with
+ name 'dum0'
+ """
+
+ if not os.path.isdir('/sys/class/net/' + ifname):
+ os.system('ip link add "{}" type "{}"'.format(ifname, type))
+
+ pass