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:30:38 +0200 |
commit | 0ac696663b6885e659987efdbe83ae7d4a3f7779 (patch) | |
tree | 3753f739290ccdfd7519cb43d5b0d3fb3896068b | |
parent | 8e61868039d8556b089abeec1d09d2d2d1f0cda4 (diff) | |
download | vyos-1x-0ac696663b6885e659987efdbe83ae7d4a3f7779.tar.gz vyos-1x-0ac696663b6885e659987efdbe83ae7d4a3f7779.zip |
smoketest: l2tpv3: only remove modules if they are loaded
-rw-r--r-- | smoketest/scripts/cli/base_interfaces_test.py | 2 | ||||
-rwxr-xr-x | smoketest/scripts/cli/test_interfaces_l2tpv3.py | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py index f897088ef..bc95c78b1 100644 --- a/smoketest/scripts/cli/base_interfaces_test.py +++ b/smoketest/scripts/cli/base_interfaces_test.py @@ -437,7 +437,7 @@ class BasicInterfaceTest: tmp = read_file(f'/proc/sys/net/ipv6/conf/{interface}/dad_transmits') self.assertEqual(dad_transmits, tmp) - def test_dhcpv6_clinet_options(self): + def test_dhcpv6_client_options(self): if not self._test_ipv6_dhcpc6: self.skipTest('not supported') diff --git a/smoketest/scripts/cli/test_interfaces_l2tpv3.py b/smoketest/scripts/cli/test_interfaces_l2tpv3.py index a2091ff10..06ced5c40 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.TestCase): +class L2TPv3InterfaceTest(BasicInterfaceTest.TestCase): @classmethod def setUpClass(cls): cls._test_ip = True @@ -53,12 +54,17 @@ class GeneveInterfaceTest(BasicInterfaceTest.TestCase): 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 - cmd('sudo rmmod l2tp_ip6 l2tp_eth l2tp_eth l2tp_netlink l2tp_core') + 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) |