summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-14 19:32:13 +0200
committerChristian Poessinger <christian@poessinger.com>2020-06-18 21:45:51 +0200
commitf1f2b647195db515e55a769370b4a689a4dafa44 (patch)
treefd7e13dce67315d725e0807ed8f4f314cf5bf6ba
parentb02de1795f5b77d846bc7a6a1cce4e8fd1246e04 (diff)
downloadvyos-1x-f1f2b647195db515e55a769370b4a689a4dafa44.tar.gz
vyos-1x-f1f2b647195db515e55a769370b4a689a4dafa44.zip
console-server: T2490: add default CLI values
-rw-r--r--interface-definitions/service_serial-proxy.xml.in6
-rwxr-xr-xsrc/conf_mode/system_serial-proxy.py15
2 files changed, 11 insertions, 10 deletions
diff --git a/interface-definitions/service_serial-proxy.xml.in b/interface-definitions/service_serial-proxy.xml.in
index cedaae5ea..b027752b9 100644
--- a/interface-definitions/service_serial-proxy.xml.in
+++ b/interface-definitions/service_serial-proxy.xml.in
@@ -42,7 +42,7 @@
</leafNode>
<leafNode name="data-bits">
<properties>
- <help>Serial port data bits</help>
+ <help>Serial port data bits (default: 8)</help>
<completionHelp>
<list>7 8</list>
</completionHelp>
@@ -53,7 +53,7 @@
</leafNode>
<leafNode name="stop-bits">
<properties>
- <help>Serial port stop bits</help>
+ <help>Serial port stop bits (default: 1)</help>
<completionHelp>
<list>1 2</list>
</completionHelp>
@@ -64,7 +64,7 @@
</leafNode>
<leafNode name="parity">
<properties>
- <help>Parity setting</help>
+ <help>Parity setting (default: none)</help>
<completionHelp>
<list>even odd none</list>
</completionHelp>
diff --git a/src/conf_mode/system_serial-proxy.py b/src/conf_mode/system_serial-proxy.py
index 83369d39d..007277918 100755
--- a/src/conf_mode/system_serial-proxy.py
+++ b/src/conf_mode/system_serial-proxy.py
@@ -43,12 +43,12 @@ def get_config():
for serial_port in conf.list_nodes(['device']):
conf.set_level(base + ['device', serial_port])
serial = {
- 'data_bits': '',
- 'parity': '',
+ 'data_bits': '8',
+ 'parity': 'none',
'port': '',
'serial_port': '/dev/serial/by-bus/' + serial_port,
'speed': '',
- 'stop_bits': '',
+ 'stop_bits': '1',
'timeout': '600'
}
@@ -80,10 +80,11 @@ def verify(proxy):
raise ConfigError('Serial interface "{serial_port} does not exist"'
.format(**device))
- for key in ['data_bits', 'parity', 'port', 'speed', 'stop_bits']:
- if not device[key]:
- value = key.replace('_','-')
- raise ConfigError(f'{value} option must be defined!')
+ if not device['port']:
+ raise ConfigError(f'Port must be defined!')
+
+ if not device['speed']:
+ raise ConfigError(f'Speed must be defined!')
return None