diff options
-rw-r--r-- | .github/workflows/unused-imports.yml | 4 | ||||
-rw-r--r-- | data/templates/conntrackd/conntrackd.conf.j2 | 1 | ||||
-rw-r--r-- | interface-definitions/service_conntrack-sync.xml.in | 6 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_pppoe.py | 7 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_wireless.py | 4 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_service_https.py | 6 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_service_ssh.py | 10 |
7 files changed, 25 insertions, 13 deletions
diff --git a/.github/workflows/unused-imports.yml b/.github/workflows/unused-imports.yml index d6e820ae6..da57bd270 100644 --- a/.github/workflows/unused-imports.yml +++ b/.github/workflows/unused-imports.yml @@ -1,7 +1,9 @@ name: Check for unused imports using Pylint on: pull_request_target: - types: [opened, reopened, ready_for_review, locked] + branches: + - current + - sagitta jobs: Check-Unused-Imports: diff --git a/data/templates/conntrackd/conntrackd.conf.j2 b/data/templates/conntrackd/conntrackd.conf.j2 index 669b20877..30e619daf 100644 --- a/data/templates/conntrackd/conntrackd.conf.j2 +++ b/data/templates/conntrackd/conntrackd.conf.j2 @@ -4,6 +4,7 @@ Sync { Mode FTFW { DisableExternalCache {{ 'on' if disable_external_cache is vyos_defined else 'off' }} + StartupResync {{ 'on' if startup_resync is vyos_defined else 'off' }} } {% for iface, iface_config in interface.items() %} {% if iface_config.peer is vyos_defined %} diff --git a/interface-definitions/service_conntrack-sync.xml.in b/interface-definitions/service_conntrack-sync.xml.in index 397864867..631c830b4 100644 --- a/interface-definitions/service_conntrack-sync.xml.in +++ b/interface-definitions/service_conntrack-sync.xml.in @@ -81,6 +81,12 @@ <multi/> </properties> </leafNode> + <leafNode name="startup-resync"> + <properties> + <help>Order conntrackd to request a complete conntrack table resync against the other node at startup</help> + <valueless/> + </properties> + </leafNode> <node name="failover-mechanism"> <properties> <help>Failover mechanism to use for conntrack-sync</help> diff --git a/smoketest/scripts/cli/test_interfaces_pppoe.py b/smoketest/scripts/cli/test_interfaces_pppoe.py index e99d8b3d1..2683a3122 100755 --- a/smoketest/scripts/cli/test_interfaces_pppoe.py +++ b/smoketest/scripts/cli/test_interfaces_pppoe.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2019-2023 VyOS maintainers and contributors +# Copyright (C) 2019-2024 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -20,6 +20,7 @@ from psutil import process_iter from base_vyostest_shim import VyOSUnitTestSHIM from vyos.configsession import ConfigSessionError +from vyos.xml_ref import default_value config_file = '/etc/ppp/peers/{}' base_path = ['interfaces', 'pppoe'] @@ -169,10 +170,10 @@ class PPPoEInterfaceTest(VyOSUnitTestSHIM.TestCase): for interface in self._interfaces: user = f'VyOS-user-{interface}' passwd = f'VyOS-passwd-{interface}' + mtu_default = default_value(base_path + [interface, 'mtu']) - # verify "normal" PPPoE value - 1492 is default MTU tmp = get_config_value(interface, 'mtu')[1] - self.assertEqual(tmp, '1492') + self.assertEqual(tmp, mtu_default) tmp = get_config_value(interface, 'user')[1].replace('"', '') self.assertEqual(tmp, user) tmp = get_config_value(interface, 'password')[1].replace('"', '') diff --git a/smoketest/scripts/cli/test_interfaces_wireless.py b/smoketest/scripts/cli/test_interfaces_wireless.py index 95246a7b9..83b00ac0c 100755 --- a/smoketest/scripts/cli/test_interfaces_wireless.py +++ b/smoketest/scripts/cli/test_interfaces_wireless.py @@ -25,6 +25,7 @@ from vyos.configsession import ConfigSessionError from vyos.utils.process import process_named_running from vyos.utils.kernel import check_kmod from vyos.utils.file import read_file +from vyos.xml_ref import default_value def get_config_value(interface, key): tmp = read_file(f'/run/hostapd/{interface}.conf') @@ -127,7 +128,8 @@ class WirelessInterfaceTest(BasicInterfaceTest.TestCase): # channel tmp = get_config_value(interface, 'channel') - self.assertEqual('0', tmp) # default is channel 0 + cli_default = default_value(self._base_path + [interface, 'channel']) + self.assertEqual(cli_default, tmp) # auto-powersave is special tmp = get_config_value(interface, 'uapsd_advertisement_enabled') diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index 94eade2d7..f2a64627f 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -27,6 +27,7 @@ from vyos.utils.file import read_file from vyos.utils.file import write_file from vyos.utils.process import call from vyos.utils.process import process_named_running +from vyos.xml_ref import default_value from vyos.configsession import ConfigSessionError @@ -147,10 +148,8 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): @ignore_warning(InsecureRequestWarning) def test_api_auth(self): - vhost_id = 'example' address = '127.0.0.1' - port = '443' # default value - name = 'localhost' + port = default_value(base_path + ['port']) key = 'MySuperSecretVyOS' self.cli_set(base_path + ['api', 'keys', 'id', 'key-01', 'key', key]) @@ -420,7 +419,6 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): url = f'https://{address}/config-file' url_config = f'https://{address}/configure' headers = {} - tmp_file = 'tmp-config.boot' self.cli_set(base_path + ['api', 'keys', 'id', 'key-01', 'key', key]) self.cli_commit() diff --git a/smoketest/scripts/cli/test_service_ssh.py b/smoketest/scripts/cli/test_service_ssh.py index 031897c26..b09990c92 100755 --- a/smoketest/scripts/cli/test_service_ssh.py +++ b/smoketest/scripts/cli/test_service_ssh.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2019-2022 VyOS maintainers and contributors +# Copyright (C) 2019-2024 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -28,6 +28,7 @@ from vyos.utils.process import cmd from vyos.utils.process import is_systemd_service_running from vyos.utils.process import process_named_running from vyos.utils.file import read_file +from vyos.xml_ref import default_value PROCESS_NAME = 'sshd' SSHD_CONF = '/run/sshd/sshd_config' @@ -78,9 +79,10 @@ class TestServiceSSH(VyOSUnitTestSHIM.TestCase): # commit changes self.cli_commit() - # Check configured port - port = get_config_value('Port')[0] - self.assertEqual('22', port) # default value + # Check configured port agains CLI default value + port = get_config_value('Port') + cli_default = default_value(base_path + ['port']) + self.assertEqual(port, cli_default) def test_ssh_single_listen_address(self): # Check if SSH service can be configured and runs |