summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli')
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_vxlan.py27
-rwxr-xr-xsmoketest/scripts/cli/test_system_syslog.py25
2 files changed, 50 insertions, 2 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_vxlan.py b/smoketest/scripts/cli/test_interfaces_vxlan.py
index b2076b43b..05900a4ba 100755
--- a/smoketest/scripts/cli/test_interfaces_vxlan.py
+++ b/smoketest/scripts/cli/test_interfaces_vxlan.py
@@ -25,6 +25,7 @@ from vyos.utils.network import interface_exists
from vyos.utils.network import get_vxlan_vlan_tunnels
from vyos.utils.network import get_vxlan_vni_filter
from vyos.template import is_ipv6
+from vyos import ConfigError
from base_interfaces_test import BasicInterfaceTest
def convert_to_list(ranges_to_convert):
@@ -114,6 +115,32 @@ class VXLANInterfaceTest(BasicInterfaceTest.TestCase):
self.assertEqual(Interface(interface).get_admin_state(), 'up')
ttl += 10
+
+ def test_vxlan_group_remote_error(self):
+ intf = 'vxlan60'
+ options = [
+ 'group 239.4.4.5',
+ 'mtu 1420',
+ 'remote 192.168.0.254',
+ 'source-address 192.168.0.1',
+ 'source-interface eth0',
+ 'vni 60'
+ ]
+ params = []
+ for option in options:
+ opts = option.split()
+ params.append(opts[0])
+ self.cli_set(self._base_path + [ intf ] + opts)
+
+ with self.assertRaises(ConfigSessionError) as cm:
+ self.cli_commit()
+
+ exception = cm.exception
+ self.assertIn('Both group and remote cannot be specified', str(exception))
+ for param in params:
+ self.cli_delete(self._base_path + [intf, param])
+
+
def test_vxlan_external(self):
interface = 'vxlan0'
source_address = '192.0.2.1'
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}')