diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-11-07 16:45:58 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2025-11-07 16:45:58 +0100 |
| commit | b50808ac8245aa75bdca5b1996847125d1969dc3 (patch) | |
| tree | cc6e98e48ee4adcad12e32b08ead5d1bb35327be /smoketest/scripts/cli | |
| parent | 316b31e304db92d87e63321628be21f9f4cd1387 (diff) | |
| download | vyos-1x-b50808ac8245aa75bdca5b1996847125d1969dc3.tar.gz vyos-1x-b50808ac8245aa75bdca5b1996847125d1969dc3.zip | |
smoketest: T7996: drop frr-reload.py implementation when reading running config
Commit 9775bb49e ("frr: T7664: drop BASH/SED implementation in smoketest
getFRRconfig()") dropped a custom BASH/SED based implementation of how we
interacted with FRR to make use of the utility helpers from FRR team.
This changed added some arbitray warnings when executing about unclosed
files handles. ResourceWarning: unclosed file <_io.BufferedReader name=5>
Instead of importing the frr-reload Python module, we simply call popen() by
ourself.
Diffstat (limited to 'smoketest/scripts/cli')
| -rw-r--r-- | smoketest/scripts/cli/base_vyostest_shim.py | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/smoketest/scripts/cli/base_vyostest_shim.py b/smoketest/scripts/cli/base_vyostest_shim.py index cf3324a15..08639f31b 100644 --- a/smoketest/scripts/cli/base_vyostest_shim.py +++ b/smoketest/scripts/cli/base_vyostest_shim.py @@ -12,12 +12,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -import importlib.util import os import paramiko import pprint import re -import sys import unittest from time import sleep @@ -56,17 +54,6 @@ class VyOSUnitTestSHIM: @classmethod def setUpClass(cls): - # Import frr-reload.py functionality - file_path = '/usr/lib/frr/frr-reload.py' - module_name = 'frr_reload' - - spec = importlib.util.spec_from_file_location(module_name, file_path) - module = importlib.util.module_from_spec(spec) - sys.modules[module_name] = module - spec.loader.exec_module(module) - Vtysh = getattr(module, 'Vtysh') - cls._vtysh = Vtysh(bindir='/usr/bin', confdir='/etc/frr') - cls._session = ConfigSession(os.getpid()) cls._session.save_config(save_config) cls.debug = cls.debug_on() @@ -152,7 +139,11 @@ class VyOSUnitTestSHIM: start_subsection: search section under the result found by string stop_subsection: end of the subsection (usually something with "exit") """ - frr_config = self._vtysh.mark_show_run() + from vyos.utils.process import rc_cmd + + rc, frr_config = rc_cmd('vtysh -c "show running-config no-header"') + self.assertEqual(rc, 0) + if not start_section: return frr_config |
