diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-03-10 09:50:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-10 09:50:00 +0000 |
commit | 344455475089ee03e3e3a1ad9f7e61b69a2fdfff (patch) | |
tree | 9eae2f98bcd0ef6ecfc3b8d69138025a2553b457 /smoketest | |
parent | b12c9ec6db804f8e9494502e0612850c72670fee (diff) | |
parent | 19af4736532ce942dd9c72e36ad08d97a54cc17c (diff) | |
download | vyos-1x-344455475089ee03e3e3a1ad9f7e61b69a2fdfff.tar.gz vyos-1x-344455475089ee03e3e3a1ad9f7e61b69a2fdfff.zip |
Merge pull request #4386 from c-po/syslog-T7229
syslog: T7229: advanced format should not have IPv6 addresses in [] brackets
Diffstat (limited to 'smoketest')
-rwxr-xr-x | smoketest/scripts/cli/test_system_syslog.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/smoketest/scripts/cli/test_system_syslog.py b/smoketest/scripts/cli/test_system_syslog.py index e642b5660..ba325ced8 100755 --- a/smoketest/scripts/cli/test_system_syslog.py +++ b/smoketest/scripts/cli/test_system_syslog.py @@ -18,6 +18,7 @@ import unittest from base_vyostest_shim import VyOSUnitTestSHIM +from vyos.configsession import ConfigSessionError from vyos.utils.file import read_file from vyos.utils.process import cmd from vyos.utils.process import process_named_running @@ -28,6 +29,8 @@ RSYSLOG_CONF = '/run/rsyslog/rsyslog.conf' base_path = ['system', 'syslog'] +dummy_interface = 'dum372874' + def get_config(string=''): """ Retrieve current "running configuration" from FRR @@ -127,15 +130,22 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase): self.assertNotIn('module(load="immark"', config) def test_remote(self): + dummy_if_path = ['interfaces', 'dummy', dummy_interface] rhosts = { '169.254.0.1': { 'facility': {'auth' : {'level': 'info'}}, 'protocol': 'udp', }, - '169.254.0.2': { + '2001:db8::1': { + 'facility': {'all' : {'level': 'debug'}}, 'port': '1514', 'protocol': 'udp', }, + 'syslog.vyos.net': { + 'facility': {'all' : {'level': 'debug'}}, + 'port': '1515', + 'protocol': 'tcp', + }, '169.254.0.3': { 'facility': {'auth' : {'level': 'info'}, 'kern' : {'level': 'debug'}, @@ -169,6 +179,15 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase): protocol = remote_options['protocol'] self.cli_set(remote_base + ['protocol'], value=protocol) + if 'source_address' in remote_options: + source_address = remote_options['source_address'] + self.cli_set(remote_base + ['source-address', source_address]) + + # check validate() - source address does not exist + with self.assertRaises(ConfigSessionError): + self.cli_commit() + self.cli_set(dummy_if_path + ['address', f'{source_address}/32']) + self.cli_commit() config = read_file(RSYSLOG_CONF) @@ -211,6 +230,9 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase): else: self.assertIn( ' TCP_Framing="traditional"', config) + # cleanup dummy interface + self.cli_delete(dummy_if_path) + def test_vrf_source_address(self): rhosts = { '169.254.0.10': { }, @@ -252,7 +274,6 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase): value=vrf) self.cli_commit() - config = read_file(RSYSLOG_CONF) for remote, remote_options in rhosts.items(): config = get_config(f'# Remote syslog to {remote}') |