Skip to content

Commit 19af473

Browse files
committed
smoketest: T7229: add syslog test to verify source-address for remote
1 parent 4666bbc commit 19af473

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

smoketest/scripts/cli/test_system_syslog.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from base_vyostest_shim import VyOSUnitTestSHIM
2020

21+
from vyos.configsession import ConfigSessionError
2122
from vyos.utils.file import read_file
2223
from vyos.utils.process import cmd
2324
from vyos.utils.process import process_named_running
@@ -28,6 +29,8 @@
2829

2930
base_path = ['system', 'syslog']
3031

32+
dummy_interface = 'dum372874'
33+
3134
def get_config(string=''):
3235
"""
3336
Retrieve current "running configuration" from FRR
@@ -127,6 +130,7 @@ def test_basic(self):
127130
self.assertNotIn('module(load="immark"', config)
128131

129132
def test_remote(self):
133+
dummy_if_path = ['interfaces', 'dummy', dummy_interface]
130134
rhosts = {
131135
'169.254.0.1': {
132136
'facility': {'auth' : {'level': 'info'}},
@@ -175,6 +179,15 @@ def test_remote(self):
175179
protocol = remote_options['protocol']
176180
self.cli_set(remote_base + ['protocol'], value=protocol)
177181

182+
if 'source_address' in remote_options:
183+
source_address = remote_options['source_address']
184+
self.cli_set(remote_base + ['source-address', source_address])
185+
186+
# check validate() - source address does not exist
187+
with self.assertRaises(ConfigSessionError):
188+
self.cli_commit()
189+
self.cli_set(dummy_if_path + ['address', f'{source_address}/32'])
190+
178191
self.cli_commit()
179192

180193
config = read_file(RSYSLOG_CONF)
@@ -217,6 +230,9 @@ def test_remote(self):
217230
else:
218231
self.assertIn( ' TCP_Framing="traditional"', config)
219232

233+
# cleanup dummy interface
234+
self.cli_delete(dummy_if_path)
235+
220236
def test_vrf_source_address(self):
221237
rhosts = {
222238
'169.254.0.10': { },
@@ -258,7 +274,6 @@ def test_vrf_source_address(self):
258274
value=vrf)
259275

260276
self.cli_commit()
261-
config = read_file(RSYSLOG_CONF)
262277

263278
for remote, remote_options in rhosts.items():
264279
config = get_config(f'# Remote syslog to {remote}')

0 commit comments

Comments
 (0)