diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-06-14 19:00:49 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-06-18 21:45:40 +0200 |
commit | b02de1795f5b77d846bc7a6a1cce4e8fd1246e04 (patch) | |
tree | 4998739ef2197564796b8e72a759cc2aff02c5be | |
parent | 6727ddc78035c14ca5015419ef4a9240af8288d8 (diff) | |
download | vyos-1x-b02de1795f5b77d846bc7a6a1cce4e8fd1246e04.tar.gz vyos-1x-b02de1795f5b77d846bc7a6a1cce4e8fd1246e04.zip |
console-server: T2490: rename CLI to "serial-proxy"
-rw-r--r-- | data/templates/ser2net/ser2net.conf.tmpl | 4 | ||||
-rw-r--r-- | interface-definitions/service_serial-proxy.xml.in (renamed from interface-definitions/ser2net.xml.in) | 2 | ||||
-rwxr-xr-x | src/conf_mode/system_serial-proxy.py (renamed from src/conf_mode/ser2net.py) | 26 |
3 files changed, 15 insertions, 17 deletions
diff --git a/data/templates/ser2net/ser2net.conf.tmpl b/data/templates/ser2net/ser2net.conf.tmpl index 202fe8104..0e946e84e 100644 --- a/data/templates/ser2net/ser2net.conf.tmpl +++ b/data/templates/ser2net/ser2net.conf.tmpl @@ -69,9 +69,7 @@ # The original config file shipped with the upstream sources can be # found in /usr/share/doc/ser2net/examples -BANNER:banner:\r\nser2net port \p device \d [\s] (VyOS)\r\n\r\n - -#3001:telnet:600:/dev/ttyS1:19200 8DATABITS NONE 1STOPBIT banner +BANNER:banner:\r\nConnected to serial proxy device \d [\s]\r\n\r\n {% for d in devices %} localhost,{{ d.port }}:telnet:{{ d.timeout }}:{{ d.serial_port }}:{{ d.speed }} {{ d.data_bits}}DATABITS {{ d.parity | upper }} {{ d.stop_bits}}STOPBIT banner diff --git a/interface-definitions/ser2net.xml.in b/interface-definitions/service_serial-proxy.xml.in index 8b025070f..cedaae5ea 100644 --- a/interface-definitions/ser2net.xml.in +++ b/interface-definitions/service_serial-proxy.xml.in @@ -2,7 +2,7 @@ <interfaceDefinition> <node name="service"> <children> - <node name="ser2net" owner="${vyos_conf_scripts_dir}/ser2net.py"> + <node name="serial-proxy" owner="${vyos_conf_scripts_dir}/system_serial-proxy.py"> <properties> <help>Serial to Network</help> </properties> diff --git a/src/conf_mode/ser2net.py b/src/conf_mode/system_serial-proxy.py index ec8afcb48..83369d39d 100755 --- a/src/conf_mode/ser2net.py +++ b/src/conf_mode/system_serial-proxy.py @@ -31,9 +31,9 @@ default_config_data = { } def get_config(): - ser2net = deepcopy(default_config_data) + proxy = deepcopy(default_config_data) conf = Config() - base = ['service', 'ser2net'] + base = ['service', 'serial-proxy'] if not conf.exists(base): return None @@ -67,15 +67,15 @@ def get_config(): if conf.exists(['speed']): serial['speed'] = conf.return_value(['speed']) - ser2net['devices'].append(serial) + proxy['devices'].append(serial) - return ser2net + return proxy -def verify(ser2net): - if not ser2net: +def verify(proxy): + if not proxy: return None - for device in ser2net['devices']: + for device in proxy['devices']: if not os.path.exists('{serial_port}'.format(**device)): raise ConfigError('Serial interface "{serial_port} does not exist"' .format(**device)) @@ -87,22 +87,22 @@ def verify(ser2net): return None -def generate(ser2net): - if not ser2net: +def generate(proxy): + if not proxy: return None - render(config_file, 'ser2net/ser2net.conf.tmpl', ser2net) + render(config_file, 'ser2net/ser2net.conf.tmpl', proxy) return None -def apply(ser2net): - if not ser2net: +def apply(proxy): + if not proxy: call('systemctl stop ser2net.service') if os.path.isfile(config_file): os.unlink(config_file) return None - call('systemctl restart ser2net.service') + call('systemctl start ser2net.service') return None if __name__ == '__main__': |