summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-08-23 15:46:23 +0200
committerGitHub <noreply@github.com>2019-08-23 15:46:23 +0200
commit2f3aa28f259ee7f23ef8a4a091db8ced2202bbd8 (patch)
tree4e7567aa474c050c3becbf8ff2618c5781e396ed
parentdb67a7e9e6f448567203ceb5f6364e78c7bb3300 (diff)
parent87be8bbd814f2e387c3b60fbd3f44e55a21b2bce (diff)
downloadvyos-1x-2f3aa28f259ee7f23ef8a4a091db8ced2202bbd8.tar.gz
vyos-1x-2f3aa28f259ee7f23ef8a4a091db8ced2202bbd8.zip
Merge pull request #114 from DmitriyEshenko/dummy
[dummy] T1609 Fixing dummy interface state
-rw-r--r--interface-definitions/interfaces-dummy.xml1
-rwxr-xr-xsrc/conf_mode/interface-dummy.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/interface-definitions/interfaces-dummy.xml b/interface-definitions/interfaces-dummy.xml
index 7c425480a..4450b69b7 100644
--- a/interface-definitions/interfaces-dummy.xml
+++ b/interface-definitions/interfaces-dummy.xml
@@ -42,6 +42,7 @@
<leafNode name="disable">
<properties>
<help>Disable interface</help>
+ <valueless/>
</properties>
</leafNode>
</children>
diff --git a/src/conf_mode/interface-dummy.py b/src/conf_mode/interface-dummy.py
index ff9d57c89..8c939ce95 100755
--- a/src/conf_mode/interface-dummy.py
+++ b/src/conf_mode/interface-dummy.py
@@ -22,6 +22,7 @@ import copy
import vyos.configinterface as VyIfconfig
+from vyos.interfaceconfig import Interface
from vyos.config import Config
from vyos import ConfigError
@@ -100,6 +101,11 @@ def apply(dummy):
for addr in dummy['address']:
VyIfconfig.add_interface_address(dummy['intf'], addr)
+ if dummy['disable']:
+ Interface(dummy['intf']).linkstate = 'down'
+ else:
+ Interface(dummy['intf']).linkstate = 'up'
+
return None
if __name__ == '__main__':