diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-04-05 16:20:34 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-04-05 16:32:47 +0200 |
commit | b9fc9f1ea59861765b64d34dee3f7e46e6753e52 (patch) | |
tree | 09fe170ba928ebd660075009cf9aa60484d0dcfc /smoketest/scripts/cli/test_interfaces_l2tpv3.py | |
parent | e7c643c8c8b84619d78abfe05e490b644bd109bc (diff) | |
download | vyos-1x-b9fc9f1ea59861765b64d34dee3f7e46e6753e52.tar.gz vyos-1x-b9fc9f1ea59861765b64d34dee3f7e46e6753e52.zip |
smoketest: l2tpv3: only remove modules if they are loaded
(cherry picked from commit 0ac696663b6885e659987efdbe83ae7d4a3f7779)
Diffstat (limited to 'smoketest/scripts/cli/test_interfaces_l2tpv3.py')
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_l2tpv3.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/smoketest/scripts/cli/test_interfaces_l2tpv3.py b/smoketest/scripts/cli/test_interfaces_l2tpv3.py index a89895b92..b9e65f51d 100755 --- a/smoketest/scripts/cli/test_interfaces_l2tpv3.py +++ b/smoketest/scripts/cli/test_interfaces_l2tpv3.py @@ -14,13 +14,14 @@ # 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 os import json import unittest from base_interfaces_test import BasicInterfaceTest from vyos.util import cmd -class GeneveInterfaceTest(BasicInterfaceTest.BaseTest): +class L2TPv3InterfaceTest(BasicInterfaceTest.BaseTest): @classmethod def setUpClass(cls): cls._test_ip = True @@ -51,9 +52,17 @@ class GeneveInterfaceTest(BasicInterfaceTest.BaseTest): for opt in self._options[interface]: dict.update({opt.split()[0].replace('-','_'): opt.split()[1]}) - for key in ['peer_session_id', 'peer_tunnel_id', 'session_id', 'tunnel_id']: + for key in ['peer_session_id', 'peer_tunnel_id', + 'session_id', 'tunnel_id']: self.assertEqual(str(config[key]), dict[key]) if __name__ == '__main__': + # when re-running this test, cleanup loaded modules first so they are + # reloaded on demand - not needed but test more and more features + for module in ['l2tp_ip6', 'l2tp_ip', 'l2tp_eth', 'l2tp_eth', + 'l2tp_netlink', 'l2tp_core']: + if os.path.exists(f'/sys/module/{module}'): + cmd(f'sudo rmmod {module}') + unittest.main(verbosity=2) |