summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest')
-rw-r--r--smoketest/config-tests/basic-vyos8
-rw-r--r--smoketest/config-tests/bgp-azure-ipsec-gateway4
-rw-r--r--smoketest/config-tests/dialup-router-complex2
-rw-r--r--smoketest/config-tests/dialup-router-medium-vpn4
-rw-r--r--smoketest/config-tests/dialup-router-wireguard-ipv62
-rwxr-xr-xsmoketest/scripts/cli/test_system_syslog.py103
6 files changed, 73 insertions, 50 deletions
diff --git a/smoketest/config-tests/basic-vyos b/smoketest/config-tests/basic-vyos
index 6ff28ec2e..b6bb6ac67 100644
--- a/smoketest/config-tests/basic-vyos
+++ b/smoketest/config-tests/basic-vyos
@@ -96,8 +96,8 @@ set system syslog global facility all level 'info'
set system syslog global facility auth level 'info'
set system syslog global facility local7 level 'debug'
set system syslog global preserve-fqdn
-set system syslog host syslog.vyos.net facility auth level 'warning'
-set system syslog host syslog.vyos.net facility local7 level 'notice'
-set system syslog host syslog.vyos.net format octet-counted
-set system syslog host syslog.vyos.net port '8000'
+set system syslog remote syslog.vyos.net facility auth level 'warning'
+set system syslog remote syslog.vyos.net facility local7 level 'notice'
+set system syslog remote syslog.vyos.net format octet-counted
+set system syslog remote syslog.vyos.net port '8000'
set system time-zone 'Europe/Berlin'
diff --git a/smoketest/config-tests/bgp-azure-ipsec-gateway b/smoketest/config-tests/bgp-azure-ipsec-gateway
index bbd7b961f..91ec057a9 100644
--- a/smoketest/config-tests/bgp-azure-ipsec-gateway
+++ b/smoketest/config-tests/bgp-azure-ipsec-gateway
@@ -137,8 +137,8 @@ set system logs logrotate messages rotate '10'
set system name-server '192.0.2.254'
set system syslog global facility all level 'info'
set system syslog global facility local7 level 'debug'
-set system syslog host 10.0.9.188 facility all level 'info'
-set system syslog host 10.0.9.188 protocol 'udp'
+set system syslog remote 10.0.9.188 facility all level 'info'
+set system syslog remote 10.0.9.188 protocol 'udp'
set system time-zone 'Europe/Berlin'
set vpn ipsec authentication psk peer_51-105-0-1 id '51.105.0.1'
set vpn ipsec authentication psk peer_51-105-0-1 id '192.0.2.189'
diff --git a/smoketest/config-tests/dialup-router-complex b/smoketest/config-tests/dialup-router-complex
index c693cc382..404bf342c 100644
--- a/smoketest/config-tests/dialup-router-complex
+++ b/smoketest/config-tests/dialup-router-complex
@@ -736,5 +736,5 @@ set system option reboot-on-panic
set system option startup-beep
set system syslog global facility all level 'debug'
set system syslog global facility local7 level 'debug'
-set system syslog host 172.16.100.1 facility all level 'warning'
+set system syslog remote 172.16.100.1 facility all level 'warning'
set system time-zone 'Europe/Berlin'
diff --git a/smoketest/config-tests/dialup-router-medium-vpn b/smoketest/config-tests/dialup-router-medium-vpn
index d6b00c678..b7187887b 100644
--- a/smoketest/config-tests/dialup-router-medium-vpn
+++ b/smoketest/config-tests/dialup-router-medium-vpn
@@ -315,8 +315,8 @@ set system static-host-mapping host-name host109.vyos.net inet '192.168.0.109'
set system sysctl parameter net.core.default_qdisc value 'fq'
set system sysctl parameter net.ipv4.tcp_congestion_control value 'bbr'
set system syslog global facility all level 'info'
-set system syslog host 192.168.0.252 facility all level 'debug'
-set system syslog host 192.168.0.252 protocol 'udp'
+set system syslog remote 192.168.0.252 facility all level 'debug'
+set system syslog remote 192.168.0.252 protocol 'udp'
set system task-scheduler task Update-Blacklists executable path '/config/scripts/vyos-foo-update.script'
set system task-scheduler task Update-Blacklists interval '3h'
set system time-zone 'Pacific/Auckland'
diff --git a/smoketest/config-tests/dialup-router-wireguard-ipv6 b/smoketest/config-tests/dialup-router-wireguard-ipv6
index 3e298fb82..e4b8bcac4 100644
--- a/smoketest/config-tests/dialup-router-wireguard-ipv6
+++ b/smoketest/config-tests/dialup-router-wireguard-ipv6
@@ -693,5 +693,5 @@ set system option reboot-on-panic
set system option startup-beep
set system syslog global facility all level 'debug'
set system syslog global facility local7 level 'debug'
-set system syslog host 172.16.100.1 facility all level 'warning'
+set system syslog remote 172.16.100.1 facility all level 'warning'
set system time-zone 'Europe/Berlin'
diff --git a/smoketest/scripts/cli/test_system_syslog.py b/smoketest/scripts/cli/test_system_syslog.py
index a86711119..961b7a6f4 100755
--- a/smoketest/scripts/cli/test_system_syslog.py
+++ b/smoketest/scripts/cli/test_system_syslog.py
@@ -53,31 +53,10 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase):
# Check for running process
self.assertFalse(process_named_running(PROCESS_NAME))
- def test_syslog_basic(self):
- host1 = '127.0.0.10'
- host2 = '127.0.0.20'
-
- self.cli_set(base_path + ['host', host1, 'port', '999'])
- self.cli_set(base_path + ['host', host1, 'facility', 'all', 'level', 'all'])
- self.cli_set(base_path + ['host', host2, 'facility', 'kern', 'level', 'err'])
+ def test_syslog_console(self):
self.cli_set(base_path + ['console', 'facility', 'all', 'level', 'warning'])
-
self.cli_commit()
- # verify log level and facilities in config file
- # *.warning /dev/console
- # *.* @198.51.100.1:999
- # kern.err @192.0.2.1:514
- config = [
- get_config_value('\*.\*'),
- get_config_value('kern.err'),
- get_config_value('\*.warning'),
- ]
- expected = [f'@{host1}:999', f'@{host2}:514', '/dev/console']
-
- for i in range(0, 3):
- self.assertIn(expected[i], config[i])
- # Check for running process
- self.assertTrue(process_named_running(PROCESS_NAME))
+ self.assertIn('/dev/console', get_config_value('\*.warning'))
def test_syslog_global(self):
hostname = 'vyos123'
@@ -100,32 +79,76 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase):
for e in expected:
self.assertIn(e, config)
- # Check for running process
- self.assertTrue(process_named_running(PROCESS_NAME))
def test_syslog_remote(self):
- rhost = '169.254.0.1'
- default_port = default_value(base_path + ['host', rhost, 'port'])
-
- self.cli_set(base_path + ['global', 'facility', 'all', 'level', 'info'])
- self.cli_set(base_path + ['global', 'facility', 'local7', 'level', 'debug'])
- self.cli_set(base_path + ['host', rhost, 'facility', 'all', 'level', 'all'])
- self.cli_set(base_path + ['host', rhost, 'protocol', 'tcp'])
+ rhosts = {
+ '169.254.0.1': {
+ 'facility': {'name' : 'auth', 'level': 'info'},
+ 'protocol': 'udp',
+ },
+ '169.254.0.2': {
+ 'port': '1514',
+ 'protocol': 'udp',
+ },
+ '169.254.0.3': {
+ 'format': ['include-timezone', 'octet-counted'],
+ 'protocol': 'tcp',
+ },
+ }
+ default_port = default_value(base_path + ['remote', next(iter(rhosts)), 'port'])
+
+ for remote, remote_options in rhosts.items():
+ remote_base = base_path + ['remote', remote]
+
+ if 'port' in remote_options:
+ self.cli_set(remote_base + ['port', remote_options['port']])
+
+ if ('facility' in remote_options and
+ 'name' in remote_options['facility'] and
+ 'level' in remote_options['facility']
+ ):
+ facility = remote_options['facility']['name']
+ level = remote_options['facility']['level']
+ self.cli_set(remote_base + ['facility', facility, 'level', level])
+
+ if 'format' in remote_options:
+ for format in remote_options['format']:
+ self.cli_set(remote_base + ['format', format])
+
+ if 'protocol' in remote_options:
+ protocol = remote_options['protocol']
+ self.cli_set(remote_base + ['protocol', protocol])
self.cli_commit()
config = read_file(RSYSLOG_CONF)
- self.assertIn(f'*.* @@{rhost}:{default_port}', config)
+ for remote, remote_options in rhosts.items():
+ tmp = ' '
+ if ('facility' in remote_options and
+ 'name' in remote_options['facility'] and
+ 'level' in remote_options['facility']
+ ):
+ facility = remote_options['facility']['name']
+ level = remote_options['facility']['level']
+ tmp = f'{facility}.{level} '
- # Change default port and enable "octet-counting" mode
- port = '10514'
- self.cli_set(base_path + ['host', rhost, 'port', port])
- self.cli_set(base_path + ['host', rhost, 'format', 'octet-counted'])
- self.cli_commit()
+ tmp += '@'
+ if 'protocol' in remote_options and remote_options['protocol'] == 'tcp':
+ tmp += '@'
- config = read_file(RSYSLOG_CONF)
- self.assertIn(f'*.* @@(o){rhost}:{port}', config)
+ if 'format' in remote_options and 'octet-counted' in remote_options['format']:
+ tmp += '(o)'
+
+ port = default_port
+ if 'port' in remote_options:
+ port = remote_options['port']
+
+ tmp += f'{remote}:{port}'
+
+ if 'format' in remote_options and 'include-timezone' in remote_options['format']:
+ tmp += ';RSYSLOG_SyslogProtocol23Format'
+ self.assertIn(tmp, config)
if __name__ == '__main__':
unittest.main(verbosity=2)