summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface-definitions/service_console-server.xml.in3
-rwxr-xr-xsrc/conf_mode/service_console-server.py9
2 files changed, 5 insertions, 7 deletions
diff --git a/interface-definitions/service_console-server.xml.in b/interface-definitions/service_console-server.xml.in
index 348d591dd..59a9fe237 100644
--- a/interface-definitions/service_console-server.xml.in
+++ b/interface-definitions/service_console-server.xml.in
@@ -50,6 +50,7 @@
<regex>(7|8)</regex>
</constraint>
</properties>
+ <defaultValue>8</defaultValue>
</leafNode>
<leafNode name="stop-bits">
<properties>
@@ -61,6 +62,7 @@
<regex>(1|2)</regex>
</constraint>
</properties>
+ <defaultValue>1</defaultValue>
</leafNode>
<leafNode name="parity">
<properties>
@@ -72,6 +74,7 @@
<regex>(even|odd|none)</regex>
</constraint>
</properties>
+ <defaultValue>none</defaultValue>
</leafNode>
<node name="ssh">
<properties>
diff --git a/src/conf_mode/service_console-server.py b/src/conf_mode/service_console-server.py
index 7f6967983..ace6b8ca4 100755
--- a/src/conf_mode/service_console-server.py
+++ b/src/conf_mode/service_console-server.py
@@ -22,17 +22,11 @@ from vyos.config import Config
from vyos.configdict import dict_merge
from vyos.template import render
from vyos.util import call
+from vyos.xml import defaults
from vyos import ConfigError
config_file = r'/run/conserver/conserver.cf'
-# Default values are necessary until the implementation of T2588 is completed
-default_values = {
- 'data_bits': '8',
- 'parity': 'none',
- 'stop_bits': '1'
-}
-
def get_config():
conf = Config()
base = ['service', 'console-server']
@@ -52,6 +46,7 @@ def get_config():
# We have gathered the dict representation of the CLI, but there are default
# options which we need to update into the dictionary retrived.
+ default_values = defaults(base + ['device'])
for device in proxy['device'].keys():
tmp = dict_merge(default_values, proxy['device'][device])
proxy['device'][device] = tmp