diff options
86 files changed, 239 insertions, 58 deletions
diff --git a/smoketest/scripts/cli/base_accel_ppp_test.py b/smoketest/scripts/cli/base_accel_ppp_test.py index d7dc43757..2a1698ab7 100644 --- a/smoketest/scripts/cli/base_accel_ppp_test.py +++ b/smoketest/scripts/cli/base_accel_ppp_test.py @@ -46,6 +46,8 @@ class BasicAccelPPPTest: # ensure we can also run this test on a live system - so lets clean # out the current configuration :) self.cli_delete(self._base_path) + # always forward to base class + super().setUp() def tearDown(self): # Check for running process @@ -56,6 +58,8 @@ class BasicAccelPPPTest: # Check for running process self.assertFalse(process_named_running(self._process_name)) + # always forward to base class + super().tearDown() def set(self, path): self.cli_set(self._base_path + path) diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py index 45b300857..7dba60313 100644 --- a/smoketest/scripts/cli/base_interfaces_test.py +++ b/smoketest/scripts/cli/base_interfaces_test.py @@ -217,6 +217,9 @@ class BasicInterfaceTest: else: self.assertFalse(process_named_running(daemon)) + # always forward to base class + super().tearDown() + def test_dhcp_disable_interface(self): if not self._test_dhcp: self.skipTest(MSG_TESTCASE_UNSUPPORTED) diff --git a/smoketest/scripts/cli/base_vyostest_shim.py b/smoketest/scripts/cli/base_vyostest_shim.py index cb1759a5b..6415a0e3c 100644 --- a/smoketest/scripts/cli/base_vyostest_shim.py +++ b/smoketest/scripts/cli/base_vyostest_shim.py @@ -68,7 +68,6 @@ class VyOSUnitTestSHIM: cls._session = ConfigSession(os.getpid()) cls._session.save_config(save_config) cls.debug = cls.debug_on() - pass @classmethod def tearDownClass(cls): @@ -83,6 +82,12 @@ class VyOSUnitTestSHIM: cls._session.discard() cls.fail(cls) + def setUp(self): + pass + + def tearDown(self): + pass + def cli_set(self, path, value=None): if self.debug: str = f'set {" ".join(path)} {value}' if value else f'set {" ".join(path)}' diff --git a/smoketest/scripts/cli/test_cgnat.py b/smoketest/scripts/cli/test_cgnat.py index 7f09094b9..541fc9fc5 100755 --- a/smoketest/scripts/cli/test_cgnat.py +++ b/smoketest/scripts/cli/test_cgnat.py @@ -37,6 +37,9 @@ class TestCGNAT(VyOSUnitTestSHIM.TestCase): self.cli_commit() self.assertFalse(os.path.exists(nftables_cgnat_config)) + # always forward to base class + super().tearDown() + def test_cgnat(self): internal_name = 'vyos-int-01' external_name = 'vyos-ext-01' diff --git a/smoketest/scripts/cli/test_configd_init.py b/smoketest/scripts/cli/test_configd_init.py index c367736fc..cf9d40b94 100755 --- a/smoketest/scripts/cli/test_configd_init.py +++ b/smoketest/scripts/cli/test_configd_init.py @@ -22,20 +22,26 @@ from base_vyostest_shim import VyOSUnitTestSHIM from vyos.utils.process import is_systemd_service_running from vyos.utils.process import cmd +service_name = 'vyos-configd.service' + class TestConfigdInit(unittest.TestCase): def setUp(self): - self.running_state = is_systemd_service_running('vyos-configd.service') + self.running_state = is_systemd_service_running(service_name) + # always forward to base class + super().setUp() + + def tearDown(self): + if not self.running_state: + cmd(f'sudo systemctl stop {service_name}') + # always forward to base class + super().tearDown() def test_configd_init(self): if not self.running_state: - cmd('sudo systemctl start vyos-configd.service') + cmd(f'sudo systemctl start {service_name}') # allow time for init to succeed/fail sleep(2) - self.assertTrue(is_systemd_service_running('vyos-configd.service')) - - def tearDown(self): - if not self.running_state: - cmd('sudo systemctl stop vyos-configd.service') + self.assertTrue(is_systemd_service_running(service_name)) if __name__ == '__main__': unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) diff --git a/smoketest/scripts/cli/test_container.py b/smoketest/scripts/cli/test_container.py index fd8272f44..2317d7a4b 100755 --- a/smoketest/scripts/cli/test_container.py +++ b/smoketest/scripts/cli/test_container.py @@ -33,13 +33,11 @@ PROCESS_PIDFILE = '/run/vyos-container-{0}.service.pid' busybox_image = 'busybox:stable' busybox_image_path = '/usr/share/vyos/busybox-stable.tar' - def cmd_to_json(command): c = cmd(command + ' --format=json') data = json.loads(c)[0] return data - class TestContainer(VyOSUnitTestSHIM.TestCase): @classmethod def setUpClass(cls): @@ -70,6 +68,8 @@ class TestContainer(VyOSUnitTestSHIM.TestCase): # Ensure systemd units are removed units = glob.glob('/run/systemd/system/vyos-container-*') self.assertEqual(units, []) + # always forward to base class + super().tearDown() def test_basic(self): cont_name = 'c1' @@ -242,7 +242,7 @@ class TestContainer(VyOSUnitTestSHIM.TestCase): self.assertEqual(n['NetworkSettings']['Networks']['bridge1']['MacAddress'], '02:00:00:00:00:01') n = cmd_to_json(f'sudo podman container inspect test2') self.assertEqual(n['NetworkSettings']['Networks']['bridge1']['MacAddress'], '02:00:00:00:00:02') - + def test_ipv4_network(self): prefix = '192.0.2.0/24' base_name = 'ipv4' diff --git a/smoketest/scripts/cli/test_firewall.py b/smoketest/scripts/cli/test_firewall.py index f1a28a054..90a396df5 100755 --- a/smoketest/scripts/cli/test_firewall.py +++ b/smoketest/scripts/cli/test_firewall.py @@ -71,6 +71,8 @@ class TestFirewall(VyOSUnitTestSHIM.TestCase): ] self.verify_nftables(nftables_search, 'ip vyos_filter', inverse=True) + # always forward to base class + super().tearDown() def wait_for_domain_resolver(self, table, set_name, element, max_wait=10): # Resolver no longer blocks commit, need to wait for daemon to populate set diff --git a/smoketest/scripts/cli/test_high-availability_virtual-server.py b/smoketest/scripts/cli/test_high-availability_virtual-server.py index d3780973e..1e243278e 100755 --- a/smoketest/scripts/cli/test_high-availability_virtual-server.py +++ b/smoketest/scripts/cli/test_high-availability_virtual-server.py @@ -38,6 +38,8 @@ class TestHAVirtualServer(VyOSUnitTestSHIM.TestCase): # Process must be terminated after deleting the config self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_ha_virtual_server(self): algo = 'least-connection' diff --git a/smoketest/scripts/cli/test_high-availability_vrrp.py b/smoketest/scripts/cli/test_high-availability_vrrp.py index 893087d05..5a4c41b6d 100755 --- a/smoketest/scripts/cli/test_high-availability_vrrp.py +++ b/smoketest/scripts/cli/test_high-availability_vrrp.py @@ -50,6 +50,8 @@ class TestVRRP(VyOSUnitTestSHIM.TestCase): # Process must be terminated after deleting the config self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_default_values(self): for group in groups: diff --git a/smoketest/scripts/cli/test_interfaces_bridge.py b/smoketest/scripts/cli/test_interfaces_bridge.py index fb5d84880..1a67a9165 100755 --- a/smoketest/scripts/cli/test_interfaces_bridge.py +++ b/smoketest/scripts/cli/test_interfaces_bridge.py @@ -57,7 +57,7 @@ class BridgeInterfaceTest(BasicInterfaceTest.TestCase): def tearDown(self): for intf in self._interfaces: self.cli_delete(self._base_path + [intf]) - + # always forward to base class super().tearDown() def test_isolated_interfaces(self): diff --git a/smoketest/scripts/cli/test_interfaces_input.py b/smoketest/scripts/cli/test_interfaces_input.py index 737138b0a..fc1a3bdb8 100755 --- a/smoketest/scripts/cli/test_interfaces_input.py +++ b/smoketest/scripts/cli/test_interfaces_input.py @@ -33,6 +33,8 @@ class InputInterfaceTest(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_01_description(self): # Check if PPPoE dialer can be configured and runs diff --git a/smoketest/scripts/cli/test_interfaces_macsec.py b/smoketest/scripts/cli/test_interfaces_macsec.py index 57fdce4dd..85ac9b795 100755 --- a/smoketest/scripts/cli/test_interfaces_macsec.py +++ b/smoketest/scripts/cli/test_interfaces_macsec.py @@ -50,7 +50,9 @@ class MACsecInterfaceTest(BasicInterfaceTest.TestCase): super(MACsecInterfaceTest, cls).setUpClass() def tearDown(self): + # always forward to base class super().tearDown() + self.assertFalse(process_named_running(PROCESS_NAME)) def test_macsec_encryption(self): diff --git a/smoketest/scripts/cli/test_interfaces_openvpn.py b/smoketest/scripts/cli/test_interfaces_openvpn.py index fd898cb84..e646ec6fd 100755 --- a/smoketest/scripts/cli/test_interfaces_openvpn.py +++ b/smoketest/scripts/cli/test_interfaces_openvpn.py @@ -118,6 +118,9 @@ class TestInterfacesOpenVPN(VyOSUnitTestSHIM.TestCase): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() + def test_openvpn_client_verify(self): # Create OpenVPN client interface and test verify() steps. interface = 'vtun2000' diff --git a/smoketest/scripts/cli/test_interfaces_pppoe.py b/smoketest/scripts/cli/test_interfaces_pppoe.py index 06585f43b..5537e3ca3 100755 --- a/smoketest/scripts/cli/test_interfaces_pppoe.py +++ b/smoketest/scripts/cli/test_interfaces_pppoe.py @@ -132,6 +132,9 @@ class PPPoEInterfaceTest(VyOSUnitTestSHIM.TestCase): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() + def _verify_interface_address(self, interface): # Verify that the assigned IPv4/IPv6 addresses from the BRAS (PPPoE # server) are from the assigned pools diff --git a/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py b/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py index 6f2ddd302..c2149440b 100755 --- a/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_virtual-ethernet.py @@ -36,9 +36,9 @@ class VEthInterfaceTest(BasicInterfaceTest.TestCase): super(VEthInterfaceTest, cls).setUpClass() # As we always need a pair of veth interfaces, we can not rely on the base - # class check to determine if there is a dhcp6c or dhclient instance running. - # This test will always fail as there is an instance running on the peer - # interface. + # class check to determine if there is a dhcp6c or dhclient instance + # running. This test will always fail as there is an instance still running + # on the peer interface. def tearDown(self): self.cli_delete(self._base_path) self.cli_commit() diff --git a/smoketest/scripts/cli/test_load-balancing_haproxy.py b/smoketest/scripts/cli/test_load-balancing_haproxy.py index 2b8672e1f..8efa259f5 100755 --- a/smoketest/scripts/cli/test_load-balancing_haproxy.py +++ b/smoketest/scripts/cli/test_load-balancing_haproxy.py @@ -166,6 +166,9 @@ class TestLoadBalancingReverseProxy(VyOSUnitTestSHIM.TestCase): # Process must be terminated after deleting the config self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() + def base_config(self): self.cli_set(base_path + ['service', haproxy_service_name, 'mode', 'http']) self.cli_set(base_path + ['service', haproxy_service_name, 'port', '4433']) diff --git a/smoketest/scripts/cli/test_load-balancing_wan.py b/smoketest/scripts/cli/test_load-balancing_wan.py index 029818875..8dc0c2622 100755 --- a/smoketest/scripts/cli/test_load-balancing_wan.py +++ b/smoketest/scripts/cli/test_load-balancing_wan.py @@ -67,6 +67,9 @@ class TestLoadBalancingWan(VyOSUnitTestSHIM.TestCase): for chain in removed_chains: self.verify_nftables_chain_exists('ip vyos_wanloadbalance', chain, inverse=True) + # always forward to base class + super().tearDown() + def test_table_routes(self): ns1 = 'ns201' ns2 = 'ns202' diff --git a/smoketest/scripts/cli/test_nat.py b/smoketest/scripts/cli/test_nat.py index ed57d4a62..a7669971d 100755 --- a/smoketest/scripts/cli/test_nat.py +++ b/smoketest/scripts/cli/test_nat.py @@ -45,6 +45,8 @@ class TestNAT(VyOSUnitTestSHIM.TestCase): self.cli_commit() self.assertFalse(os.path.exists(nftables_nat_config)) self.assertFalse(os.path.exists(nftables_static_nat_conf)) + # always forward to base class + super().tearDown() def wait_for_domain_resolver(self, table, set_name, element, max_wait=10): # Resolver no longer blocks commit, need to wait for daemon to populate set diff --git a/smoketest/scripts/cli/test_nat64.py b/smoketest/scripts/cli/test_nat64.py index 379e6cecd..077648118 100755 --- a/smoketest/scripts/cli/test_nat64.py +++ b/smoketest/scripts/cli/test_nat64.py @@ -38,6 +38,8 @@ class TestNAT64(VyOSUnitTestSHIM.TestCase): self.cli_delete(base_path) self.cli_commit() self.assertFalse(os.path.exists(jool_nat64_config)) + # always forward to base class + super().tearDown() def test_snat64(self): rule = '100' diff --git a/smoketest/scripts/cli/test_nat66.py b/smoketest/scripts/cli/test_nat66.py index 7e8e725a5..5e5e4829a 100755 --- a/smoketest/scripts/cli/test_nat66.py +++ b/smoketest/scripts/cli/test_nat66.py @@ -36,6 +36,8 @@ class TestNAT66(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_source_nat66(self): source_prefix = 'fc00::/64' diff --git a/smoketest/scripts/cli/test_netns.py b/smoketest/scripts/cli/test_netns.py index 5b0fcc809..89d22ef77 100755 --- a/smoketest/scripts/cli/test_netns.py +++ b/smoketest/scripts/cli/test_netns.py @@ -35,7 +35,8 @@ class NetNSTest(VyOSUnitTestSHIM.TestCase): tmp = cmd('ip netns ls') self.assertFalse(tmp) - super(NetNSTest, self).tearDown() + # always forward to base class + super().tearDown() def test_netns_create(self): namespaces = ['mgmt', 'front', 'back'] diff --git a/smoketest/scripts/cli/test_pki.py b/smoketest/scripts/cli/test_pki.py index 6ffbd6071..540dc8e9a 100755 --- a/smoketest/scripts/cli/test_pki.py +++ b/smoketest/scripts/cli/test_pki.py @@ -163,6 +163,8 @@ class TestPKI(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_valid_pki(self): # Valid CA diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py index 5cb15c242..5a700ddc1 100755 --- a/smoketest/scripts/cli/test_policy.py +++ b/smoketest/scripts/cli/test_policy.py @@ -36,6 +36,8 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_access_list(self): acls = { diff --git a/smoketest/scripts/cli/test_policy_local-route.py b/smoketest/scripts/cli/test_policy_local-route.py index 51c400619..a127f38cd 100644 --- a/smoketest/scripts/cli/test_policy_local-route.py +++ b/smoketest/scripts/cli/test_policy_local-route.py @@ -52,6 +52,8 @@ class TestPolicyLocalRoute(VyOSUnitTestSHIM.TestCase): self.verify_rules(ip_rule_search, inverse=True) self.verify_rules(ip_rule_search, inverse=True, addr_family='inet6') + # always forward to base class + super().tearDown() def test_local_pbr_matching_criteria(self): self.cli_set(['policy', 'local-route', 'rule', '4', 'inbound-interface', interface]) diff --git a/smoketest/scripts/cli/test_policy_route.py b/smoketest/scripts/cli/test_policy_route.py index 8caa7b342..939e4bc53 100755 --- a/smoketest/scripts/cli/test_policy_route.py +++ b/smoketest/scripts/cli/test_policy_route.py @@ -70,6 +70,8 @@ class TestPolicyRoute(VyOSUnitTestSHIM.TestCase): ] self.verify_rules(ip_rule_search, inverse=True) + # always forward to base class + super().tearDown() def test_pbr_group(self): self.cli_set(['firewall', 'group', 'network-group', 'smoketest_network', 'network', '172.16.99.0/24']) diff --git a/smoketest/scripts/cli/test_protocols_babel.py b/smoketest/scripts/cli/test_protocols_babel.py index cca5b5659..e8e9e6d21 100755 --- a/smoketest/scripts/cli/test_protocols_babel.py +++ b/smoketest/scripts/cli/test_protocols_babel.py @@ -49,6 +49,8 @@ class TestProtocolsBABEL(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(babel_daemon)) + # always forward to base class + super().tearDown() def test_01_basic(self): diversity_factor = '64' diff --git a/smoketest/scripts/cli/test_protocols_bfd.py b/smoketest/scripts/cli/test_protocols_bfd.py index 46d33edf3..90235d632 100755 --- a/smoketest/scripts/cli/test_protocols_bfd.py +++ b/smoketest/scripts/cli/test_protocols_bfd.py @@ -97,6 +97,8 @@ class TestProtocolsBFD(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(bfd_daemon)) + # always forward to base class + super().tearDown() def test_bfd_peer(self): self.cli_set(['vrf', 'name', vrf_name, 'table', '1000']) diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py index ba63b2296..23c2bf592 100755 --- a/smoketest/scripts/cli/test_protocols_bgp.py +++ b/smoketest/scripts/cli/test_protocols_bgp.py @@ -207,8 +207,12 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): cls.cli_delete(cls, ['policy', 'prefix-list']) cls.cli_delete(cls, ['policy', 'prefix-list6']) + super(TestProtocolsBGP, cls).tearDownClass() + def setUp(self): self.cli_set(base_path + ['system-as', ASN]) + # always forward to base class + super().setUp() def tearDown(self): # cleanup any possible VRF mess @@ -223,6 +227,8 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(bgp_daemon)) + # always forward to base class + super().tearDown() def create_bgp_instances_for_import_test(self): table = '1000' diff --git a/smoketest/scripts/cli/test_protocols_failover.py b/smoketest/scripts/cli/test_protocols_failover.py index 132d427ec..04d9374fd 100755 --- a/smoketest/scripts/cli/test_protocols_failover.py +++ b/smoketest/scripts/cli/test_protocols_failover.py @@ -119,6 +119,8 @@ class TestProtocolsFailover(VyOSUnitTestSHIM.TestCase): ) self.clean_and_stop_daemon() + # always forward to base class + super().setUp() self.clean_dhclient_lease_files = set() self.need_dhcp_dir_cleanup = False @@ -142,6 +144,8 @@ class TestProtocolsFailover(VyOSUnitTestSHIM.TestCase): f'-6 route show proto {failover_protocol_value} table all' ) self.assertEqual(failover_routes, [], "Some failover IPv6 routes left") + # always forward to base class + super().tearDown() def wait_for_ip_output(self, ip_command_args, check, pause=0.1, timeout=3): tries = ceil(timeout / pause) diff --git a/smoketest/scripts/cli/test_protocols_igmp-proxy.py b/smoketest/scripts/cli/test_protocols_igmp-proxy.py index 31c813fe8..799d20252 100755 --- a/smoketest/scripts/cli/test_protocols_igmp-proxy.py +++ b/smoketest/scripts/cli/test_protocols_igmp-proxy.py @@ -54,6 +54,8 @@ class TestProtocolsIGMPProxy(VyOSUnitTestSHIM.TestCase): # Check for no longer running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_igmpproxy(self): threshold = '20' diff --git a/smoketest/scripts/cli/test_protocols_isis.py b/smoketest/scripts/cli/test_protocols_isis.py index f6ca91370..58ba77ea0 100755 --- a/smoketest/scripts/cli/test_protocols_isis.py +++ b/smoketest/scripts/cli/test_protocols_isis.py @@ -50,6 +50,8 @@ class TestProtocolsISIS(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(isis_daemon)) + # always forward to base class + super().tearDown() def test_isis_01_redistribute(self): prefix_list = 'EXPORT-ISIS' diff --git a/smoketest/scripts/cli/test_protocols_mpls.py b/smoketest/scripts/cli/test_protocols_mpls.py index cabaaf0ef..aa79d36b9 100755 --- a/smoketest/scripts/cli/test_protocols_mpls.py +++ b/smoketest/scripts/cli/test_protocols_mpls.py @@ -83,6 +83,8 @@ class TestProtocolsMPLS(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(ldpd_daemon)) + # always forward to base class + super().tearDown() def test_mpls_basic(self): router_id = '1.2.3.4' diff --git a/smoketest/scripts/cli/test_protocols_nhrp.py b/smoketest/scripts/cli/test_protocols_nhrp.py index 1f4b12a23..6a4e12f80 100755 --- a/smoketest/scripts/cli/test_protocols_nhrp.py +++ b/smoketest/scripts/cli/test_protocols_nhrp.py @@ -38,6 +38,8 @@ class TestProtocolsNHRP(VyOSUnitTestSHIM.TestCase): self.cli_delete(nhrp_path) self.cli_delete(tunnel_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_01_nhrp_config(self): tunnel_if = "tun100" diff --git a/smoketest/scripts/cli/test_protocols_openfabric.py b/smoketest/scripts/cli/test_protocols_openfabric.py index c61e47768..f5dcc53cd 100644 --- a/smoketest/scripts/cli/test_protocols_openfabric.py +++ b/smoketest/scripts/cli/test_protocols_openfabric.py @@ -48,6 +48,8 @@ class TestProtocolsOpenFabric(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(openfabric_daemon)) + # always forward to base class + super().tearDown() def openfabric_base_config(self): self.cli_set(['interfaces', 'dummy', dummy_if]) diff --git a/smoketest/scripts/cli/test_protocols_ospf.py b/smoketest/scripts/cli/test_protocols_ospf.py index 2c7c5837a..dfa09dadc 100755 --- a/smoketest/scripts/cli/test_protocols_ospf.py +++ b/smoketest/scripts/cli/test_protocols_ospf.py @@ -61,6 +61,8 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(ospf_daemon)) + # always forward to base class + super().tearDown() def test_ospf_01_defaults(self): # commit changes diff --git a/smoketest/scripts/cli/test_protocols_ospfv3.py b/smoketest/scripts/cli/test_protocols_ospfv3.py index 07da105ba..db6602db8 100755 --- a/smoketest/scripts/cli/test_protocols_ospfv3.py +++ b/smoketest/scripts/cli/test_protocols_ospfv3.py @@ -59,6 +59,8 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(ospf6_daemon)) + # always forward to base class + super().tearDown() def test_ospfv3_01_basic(self): seq = '10' diff --git a/smoketest/scripts/cli/test_protocols_pim.py b/smoketest/scripts/cli/test_protocols_pim.py index 780d4af23..cb04c5bb2 100755 --- a/smoketest/scripts/cli/test_protocols_pim.py +++ b/smoketest/scripts/cli/test_protocols_pim.py @@ -43,6 +43,8 @@ class TestProtocolsPIM(VyOSUnitTestSHIM.TestCase): # pimd process must be stopped by now self.assertFalse(process_named_running(pim_daemon)) + # always forward to base class + super().tearDown() def test_01_pim_basic(self): rp = '127.0.0.1' diff --git a/smoketest/scripts/cli/test_protocols_pim6.py b/smoketest/scripts/cli/test_protocols_pim6.py index f0ad85007..f1c35e058 100755 --- a/smoketest/scripts/cli/test_protocols_pim6.py +++ b/smoketest/scripts/cli/test_protocols_pim6.py @@ -42,6 +42,8 @@ class TestProtocolsPIMv6(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(pim6_daemon)) + # always forward to base class + super().tearDown() def test_pim6_01_mld_simple(self): # commit changes diff --git a/smoketest/scripts/cli/test_protocols_rip.py b/smoketest/scripts/cli/test_protocols_rip.py index 784cddc5e..71d3e183c 100755 --- a/smoketest/scripts/cli/test_protocols_rip.py +++ b/smoketest/scripts/cli/test_protocols_rip.py @@ -71,6 +71,8 @@ class TestProtocolsRIP(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(rip_daemon)) + # always forward to base class + super().tearDown() def test_rip_01_parameters(self): distance = '40' diff --git a/smoketest/scripts/cli/test_protocols_ripng.py b/smoketest/scripts/cli/test_protocols_ripng.py index c410f0f30..4dc3e2cfa 100755 --- a/smoketest/scripts/cli/test_protocols_ripng.py +++ b/smoketest/scripts/cli/test_protocols_ripng.py @@ -71,6 +71,8 @@ class TestProtocolsRIPng(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(ripng_daemon)) + # always forward to base class + super().tearDown() def test_ripng_01_parameters(self): metric = '8' diff --git a/smoketest/scripts/cli/test_protocols_rpki.py b/smoketest/scripts/cli/test_protocols_rpki.py index d45245316..1345f254c 100755 --- a/smoketest/scripts/cli/test_protocols_rpki.py +++ b/smoketest/scripts/cli/test_protocols_rpki.py @@ -131,6 +131,8 @@ class TestProtocolsRPKI(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(bgp_daemon)) + # always forward to base class + super().tearDown() def test_rpki(self): expire_interval = '3600' diff --git a/smoketest/scripts/cli/test_protocols_segment-routing.py b/smoketest/scripts/cli/test_protocols_segment-routing.py index 41f33672b..8d826f07c 100755 --- a/smoketest/scripts/cli/test_protocols_segment-routing.py +++ b/smoketest/scripts/cli/test_protocols_segment-routing.py @@ -44,6 +44,8 @@ class TestProtocolsSegmentRouting(VyOSUnitTestSHIM.TestCase): # check process health and continuity self.assertEqual(self.daemon_pid, process_named_running(zebra_daemon)) + # always forward to base class + super().tearDown() def test_srv6(self): interfaces = Section.interfaces('ethernet', vlan=False) diff --git a/smoketest/scripts/cli/test_protocols_static.py b/smoketest/scripts/cli/test_protocols_static.py index a8bb3dbae..03115b7b8 100755 --- a/smoketest/scripts/cli/test_protocols_static.py +++ b/smoketest/scripts/cli/test_protocols_static.py @@ -187,6 +187,9 @@ class TestProtocolsStatic(VyOSUnitTestSHIM.TestCase): v6route = self.getFRRconfig('ipv6 route') self.assertFalse(v6route) + # always forward to base class + super().tearDown() + def test_01_static(self): self.cli_set(['vrf', 'name', 'black', 'table', '43210']) for route, route_config in routes.items(): diff --git a/smoketest/scripts/cli/test_protocols_static_arp.py b/smoketest/scripts/cli/test_protocols_static_arp.py index 37cd9f27b..447e5779d 100755 --- a/smoketest/scripts/cli/test_protocols_static_arp.py +++ b/smoketest/scripts/cli/test_protocols_static_arp.py @@ -49,6 +49,8 @@ class TestARP(VyOSUnitTestSHIM.TestCase): # delete test config self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_static_arp(self): test_data = { diff --git a/smoketest/scripts/cli/test_qos.py b/smoketest/scripts/cli/test_qos.py index 0b4afcf9d..3529fecf9 100755 --- a/smoketest/scripts/cli/test_qos.py +++ b/smoketest/scripts/cli/test_qos.py @@ -86,6 +86,8 @@ class TestQoS(VyOSUnitTestSHIM.TestCase): # delete testing SSH config self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_01_cake(self): bandwidth = 1000000 diff --git a/smoketest/scripts/cli/test_service_broadcast-relay.py b/smoketest/scripts/cli/test_service_broadcast-relay.py index f7604048c..d51fd112c 100755 --- a/smoketest/scripts/cli/test_service_broadcast-relay.py +++ b/smoketest/scripts/cli/test_service_broadcast-relay.py @@ -27,15 +27,26 @@ class TestServiceBroadcastRelay(VyOSUnitTestSHIM.TestCase): _address1 = '192.0.2.1/24' _address2 = '192.0.2.1/24' - def setUp(self): - self.cli_set(['interfaces', 'dummy', 'dum1001', 'address', self._address1]) - self.cli_set(['interfaces', 'dummy', 'dum1002', 'address', self._address2]) + @classmethod + def setUpClass(cls): + # always forward to base class + super(TestServiceBroadcastRelay, cls).setUpClass() - def tearDown(self): - self.cli_delete(['interfaces', 'dummy', 'dum1001']) - self.cli_delete(['interfaces', 'dummy', 'dum1002']) - self.cli_delete(base_path) - self.cli_commit() + cls.cli_set(cls, ['interfaces', 'dummy', 'dum1001', 'address', cls._address1]) + cls.cli_set(cls, ['interfaces', 'dummy', 'dum1002', 'address', cls._address2]) + # ensure we can also run this test on a live system - so lets clean + # out the current configuration :) + cls.cli_delete(cls, base_path) + + @classmethod + def tearDownClass(cls): + cls.cli_delete(cls, ['interfaces', 'dummy', 'dum1001']) + cls.cli_delete(cls, ['interfaces', 'dummy', 'dum1002']) + cls.cli_delete(cls, base_path) + cls.cli_commit(cls) + + # always forward to base class + super(TestServiceBroadcastRelay, cls).tearDownClass() def test_broadcast_relay_service(self): ids = range(1, 5) diff --git a/smoketest/scripts/cli/test_service_dhcp-relay.py b/smoketest/scripts/cli/test_service_dhcp-relay.py index 4e9b7b0ea..eca7c1c51 100755 --- a/smoketest/scripts/cli/test_service_dhcp-relay.py +++ b/smoketest/scripts/cli/test_service_dhcp-relay.py @@ -31,6 +31,8 @@ class TestServiceDHCPRelay(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_relay_default(self): max_size = '800' @@ -121,4 +123,3 @@ class TestServiceDHCPRelay(VyOSUnitTestSHIM.TestCase): if __name__ == '__main__': unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) - diff --git a/smoketest/scripts/cli/test_service_dhcp-server.py b/smoketest/scripts/cli/test_service_dhcp-server.py index ec8d08388..9f66bdb78 100755 --- a/smoketest/scripts/cli/test_service_dhcp-server.py +++ b/smoketest/scripts/cli/test_service_dhcp-server.py @@ -66,6 +66,8 @@ class TestServiceDHCPServer(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def walk_path(self, obj, path): current = obj diff --git a/smoketest/scripts/cli/test_service_dhcpv6-server.py b/smoketest/scripts/cli/test_service_dhcpv6-server.py index 769c799b2..4e0a19444 100755 --- a/smoketest/scripts/cli/test_service_dhcpv6-server.py +++ b/smoketest/scripts/cli/test_service_dhcpv6-server.py @@ -56,6 +56,8 @@ class TestServiceDHCPv6Server(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def walk_path(self, obj, path): current = obj diff --git a/smoketest/scripts/cli/test_service_dns_dynamic.py b/smoketest/scripts/cli/test_service_dns_dynamic.py index ac5911cb9..a4c06af88 100755 --- a/smoketest/scripts/cli/test_service_dns_dynamic.py +++ b/smoketest/scripts/cli/test_service_dns_dynamic.py @@ -59,6 +59,8 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase): # Check for process not running anymore self.assertFalse(process_named_running(DDCLIENT_PNAME)) + # always forward to base class + super().tearDown() # IPv4 standard DDNS service configuration def test_01_dyndns_service_standard(self): diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py index 5786b13eb..ffc0d7734 100755 --- a/smoketest/scripts/cli/test_service_dns_forwarding.py +++ b/smoketest/scripts/cli/test_service_dns_forwarding.py @@ -49,6 +49,14 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase): # out the current configuration :) cls.cli_delete(cls, base_path) + def setUp(self): + # always forward to base class + super().setUp() + for network in allow_from: + self.cli_set(base_path + ['allow-from', network]) + for address in listen_adress: + self.cli_set(base_path + ['listen-address', address]) + def tearDown(self): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) @@ -59,14 +67,8 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase): # Check for running process self.assertFalse(process_named_running(PROCESS_NAME)) - - def setUp(self): - # forward to base class - super().setUp() - for network in allow_from: - self.cli_set(base_path + ['allow-from', network]) - for address in listen_adress: - self.cli_set(base_path + ['listen-address', address]) + # always forward to base class + super().tearDown() def test_basic_forwarding(self): # Check basic DNS forwarding settings diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index df7657685..7fee7158d 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -113,6 +113,8 @@ class TestHTTPSService(VyOSUnitTestSHIM.TestCase): # Check for stopped process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_listen_address(self): test_prefix = ['192.0.2.1/26', '2001:db8:1::ffff/64'] diff --git a/smoketest/scripts/cli/test_service_lldp.py b/smoketest/scripts/cli/test_service_lldp.py index 037ecc15b..9a022a0ac 100755 --- a/smoketest/scripts/cli/test_service_lldp.py +++ b/smoketest/scripts/cli/test_service_lldp.py @@ -59,6 +59,8 @@ class TestServiceLLDP(VyOSUnitTestSHIM.TestCase): # service is no longer allowed to run after it was removed self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_lldp_basic(self): self.cli_set(base_path) diff --git a/smoketest/scripts/cli/test_service_mdns_repeater.py b/smoketest/scripts/cli/test_service_mdns_repeater.py index 2bf6ceffb..3caaf7be7 100755 --- a/smoketest/scripts/cli/test_service_mdns_repeater.py +++ b/smoketest/scripts/cli/test_service_mdns_repeater.py @@ -61,9 +61,10 @@ class TestServiceMDNSrepeater(VyOSUnitTestSHIM.TestCase): self.cli_delete(base_path) self.cli_commit() - # Check that there is no longer a running process self.assertFalse(process_named_running('avahi-daemon')) + # always forward to base class + super().tearDown() def test_service_dual_stack(self): # mDNS browsing domains in addition to the default one (local) diff --git a/smoketest/scripts/cli/test_service_monitoring_network_event.py b/smoketest/scripts/cli/test_service_monitoring_network_event.py index cdbdf0bc0..e36e16b03 100644 --- a/smoketest/scripts/cli/test_service_monitoring_network_event.py +++ b/smoketest/scripts/cli/test_service_monitoring_network_event.py @@ -38,6 +38,8 @@ class TestMonitoringNetworkEvent(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_network_event_log(self): expected_config = { diff --git a/smoketest/scripts/cli/test_service_monitoring_prometheus.py b/smoketest/scripts/cli/test_service_monitoring_prometheus.py index ddf5ee525..df27162ef 100755 --- a/smoketest/scripts/cli/test_service_monitoring_prometheus.py +++ b/smoketest/scripts/cli/test_service_monitoring_prometheus.py @@ -53,6 +53,8 @@ class TestMonitoringPrometheus(VyOSUnitTestSHIM.TestCase): self.cli_commit() self.assertFalse(process_named_running(NODE_EXPORTER_PROCESS_NAME)) self.assertFalse(process_named_running(FRR_EXPORTER_PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_node_exporter(self): self.cli_set(base_path + ['node-exporter', 'listen-address', listen_ip]) diff --git a/smoketest/scripts/cli/test_service_monitoring_telegraf.py b/smoketest/scripts/cli/test_service_monitoring_telegraf.py index c13a8b844..3e401cc7e 100755 --- a/smoketest/scripts/cli/test_service_monitoring_telegraf.py +++ b/smoketest/scripts/cli/test_service_monitoring_telegraf.py @@ -36,12 +36,12 @@ class TestMonitoringTelegraf(VyOSUnitTestSHIM.TestCase): def tearDown(self): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - self.cli_delete(base_path) self.cli_commit() - # Check for not longer running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_basic_config(self): self.cli_set(base_path + ['influxdb', 'authentication', 'organization', org]) diff --git a/smoketest/scripts/cli/test_service_monitoring_zabbix-agent.py b/smoketest/scripts/cli/test_service_monitoring_zabbix-agent.py index 10581eb57..a98999d9e 100755 --- a/smoketest/scripts/cli/test_service_monitoring_zabbix-agent.py +++ b/smoketest/scripts/cli/test_service_monitoring_zabbix-agent.py @@ -31,12 +31,12 @@ class TestZabbixAgent(VyOSUnitTestSHIM.TestCase): def tearDown(self): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - self.cli_delete(base_path) self.cli_commit() - # Process must be terminated after deleting the config self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_zabbix_agent(self): directory = '/tmp' diff --git a/smoketest/scripts/cli/test_service_ndp-proxy.py b/smoketest/scripts/cli/test_service_ndp-proxy.py index 537ecc574..d1c37bbe4 100755 --- a/smoketest/scripts/cli/test_service_ndp-proxy.py +++ b/smoketest/scripts/cli/test_service_ndp-proxy.py @@ -43,12 +43,13 @@ class TestServiceNDPProxy(VyOSUnitTestSHIM.TestCase): def tearDown(self): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - # delete testing SSH config self.cli_delete(base_path) self.cli_commit() self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_basic(self): interfaces = Section.interfaces('ethernet') diff --git a/smoketest/scripts/cli/test_service_ntp.py b/smoketest/scripts/cli/test_service_ntp.py index 60542ca40..6488182f3 100755 --- a/smoketest/scripts/cli/test_service_ntp.py +++ b/smoketest/scripts/cli/test_service_ntp.py @@ -38,11 +38,12 @@ class TestSystemNTP(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.assertTrue(process_named_running(PROCESS_NAME)) - self.cli_delete(base_path) self.cli_commit() - + # Check for no longer running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_base_options(self): # Test basic NTP support with multiple servers and their options diff --git a/smoketest/scripts/cli/test_service_pppoe-server.py b/smoketest/scripts/cli/test_service_pppoe-server.py index 01a9565c8..5e1cbdd88 100755 --- a/smoketest/scripts/cli/test_service_pppoe-server.py +++ b/smoketest/scripts/cli/test_service_pppoe-server.py @@ -40,6 +40,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.TestCase): def tearDown(self): self.cli_delete(local_if) + # always forward to base class super().tearDown() def verify(self, conf): diff --git a/smoketest/scripts/cli/test_service_router-advert.py b/smoketest/scripts/cli/test_service_router-advert.py index 5900e29a5..b44d0d6c6 100755 --- a/smoketest/scripts/cli/test_service_router-advert.py +++ b/smoketest/scripts/cli/test_service_router-advert.py @@ -55,12 +55,12 @@ class TestServiceRADVD(VyOSUnitTestSHIM.TestCase): def tearDown(self): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - self.cli_delete(base_path) self.cli_commit() - # Check for no longer running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_common(self): self.cli_set(base_path + ['prefix', prefix, 'no-on-link-flag']) @@ -265,7 +265,7 @@ class TestServiceRADVD(VyOSUnitTestSHIM.TestCase): for ula_prefix in ula_prefixes: self.cli_set(base_path + ['auto-ignore', ula_prefix]) - + # commit and reload config self.cli_commit() config = read_file(RADVD_CONF) @@ -278,10 +278,10 @@ class TestServiceRADVD(VyOSUnitTestSHIM.TestCase): self.assertIn(f' {isp_prefix};', config) for ula_prefix in ula_prefixes: self.assertIn(f' {ula_prefix};', config) - + # remove a prefix and verify it's gone self.cli_delete(base_path + ['auto-ignore', ula_prefixes[1]]) - + # commit and reload config self.cli_commit() config = read_file(RADVD_CONF) diff --git a/smoketest/scripts/cli/test_service_salt-minion.py b/smoketest/scripts/cli/test_service_salt-minion.py index 491df903b..483e829bc 100755 --- a/smoketest/scripts/cli/test_service_salt-minion.py +++ b/smoketest/scripts/cli/test_service_salt-minion.py @@ -58,6 +58,8 @@ class TestServiceSALT(VyOSUnitTestSHIM.TestCase): # no issue on VMWare. if cmd('systemd-detect-virt') != 'kvm': self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_default(self): servers = ['192.0.2.1', '192.0.2.2'] diff --git a/smoketest/scripts/cli/test_service_snmp.py b/smoketest/scripts/cli/test_service_snmp.py index 07ee716b7..6f6aeb7b6 100755 --- a/smoketest/scripts/cli/test_service_snmp.py +++ b/smoketest/scripts/cli/test_service_snmp.py @@ -58,13 +58,13 @@ class TestSNMPService(VyOSUnitTestSHIM.TestCase): def tearDown(self): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - # delete testing SNMP config self.cli_delete(base_path) self.cli_commit() - # Check for running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_snmp_basic(self): dummy_if = 'dum7312' diff --git a/smoketest/scripts/cli/test_service_ssh.py b/smoketest/scripts/cli/test_service_ssh.py index 0e8f5868d..6935464a7 100755 --- a/smoketest/scripts/cli/test_service_ssh.py +++ b/smoketest/scripts/cli/test_service_ssh.py @@ -163,6 +163,8 @@ class TestServiceSSH(VyOSUnitTestSHIM.TestCase): # We can not use process_named_running here - we rather need to check # that the systemd service is no longer running self.assertFalse(is_systemd_service_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_ssh_default(self): # Check if SSH service runs with default settings - used for checking diff --git a/smoketest/scripts/cli/test_service_stunnel.py b/smoketest/scripts/cli/test_service_stunnel.py index 3296830a5..4bfa22659 100755 --- a/smoketest/scripts/cli/test_service_stunnel.py +++ b/smoketest/scripts/cli/test_service_stunnel.py @@ -182,6 +182,8 @@ class TestServiceStunnel(VyOSUnitTestSHIM.TestCase): # Check for stopped process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def set_pki(self): self.cli_set(['pki', 'ca', 'ca-1', 'certificate', ca_certificate.replace('\n','')]) diff --git a/smoketest/scripts/cli/test_service_tftp-server.py b/smoketest/scripts/cli/test_service_tftp-server.py index 43182aa43..71c147087 100755 --- a/smoketest/scripts/cli/test_service_tftp-server.py +++ b/smoketest/scripts/cli/test_service_tftp-server.py @@ -52,12 +52,12 @@ class TestServiceTFTPD(VyOSUnitTestSHIM.TestCase): def tearDown(self): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - self.cli_delete(base_path) self.cli_commit() - # Check for no longer running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_tftpd_single(self): directory = '/tmp' diff --git a/smoketest/scripts/cli/test_service_webproxy.py b/smoketest/scripts/cli/test_service_webproxy.py index 63a8caa63..7f3731800 100755 --- a/smoketest/scripts/cli/test_service_webproxy.py +++ b/smoketest/scripts/cli/test_service_webproxy.py @@ -45,6 +45,8 @@ class TestServiceWebProxy(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_01_basic_proxy(self): default_cache = '100' diff --git a/smoketest/scripts/cli/test_system_acceleration_qat.py b/smoketest/scripts/cli/test_system_acceleration_qat.py index c75ee74c7..744322b4a 100755 --- a/smoketest/scripts/cli/test_system_acceleration_qat.py +++ b/smoketest/scripts/cli/test_system_acceleration_qat.py @@ -26,6 +26,8 @@ class TestIntelQAT(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_simple_unsupported(self): # Check if configuration script is in place and that the config script diff --git a/smoketest/scripts/cli/test_system_conntrack.py b/smoketest/scripts/cli/test_system_conntrack.py index 53ba4983a..b0b34b740 100755 --- a/smoketest/scripts/cli/test_system_conntrack.py +++ b/smoketest/scripts/cli/test_system_conntrack.py @@ -71,6 +71,8 @@ class TestSystemConntrack(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_conntrack_options(self): conntrack_config = { diff --git a/smoketest/scripts/cli/test_system_flow-accounting.py b/smoketest/scripts/cli/test_system_flow-accounting.py index b553ccfea..7de865b72 100755 --- a/smoketest/scripts/cli/test_system_flow-accounting.py +++ b/smoketest/scripts/cli/test_system_flow-accounting.py @@ -86,6 +86,8 @@ class TestSystemFlowAccounting(VyOSUnitTestSHIM.TestCase): self.assertFalse(is_module_loaded(module_name)) self._assert_ingress_interfaces([]) self._assert_egress_interfaces([]) + # always forward to base class + super().tearDown() def test_basic(self): engine_id = '33' diff --git a/smoketest/scripts/cli/test_system_frr.py b/smoketest/scripts/cli/test_system_frr.py index 413cb8bba..588f52bf5 100755 --- a/smoketest/scripts/cli/test_system_frr.py +++ b/smoketest/scripts/cli/test_system_frr.py @@ -51,6 +51,8 @@ class TestSystemFRR(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_frr_snmp_multipledaemons(self): # test SNMP integration for multiple daemons diff --git a/smoketest/scripts/cli/test_system_ip.py b/smoketest/scripts/cli/test_system_ip.py index fdea3ab16..fadbdec47 100755 --- a/smoketest/scripts/cli/test_system_ip.py +++ b/smoketest/scripts/cli/test_system_ip.py @@ -34,6 +34,8 @@ class TestSystemIP(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_system_ip_forwarding(self): # Test if IPv4 forwarding can be disabled globally, default is '1' diff --git a/smoketest/scripts/cli/test_system_ipv6.py b/smoketest/scripts/cli/test_system_ipv6.py index cd80efab4..edf479fa4 100755 --- a/smoketest/scripts/cli/test_system_ipv6.py +++ b/smoketest/scripts/cli/test_system_ipv6.py @@ -35,6 +35,8 @@ class TestSystemIPv6(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_system_ipv6_forwarding(self): # Test if IPv6 forwarding can be disabled globally, default is '1' diff --git a/smoketest/scripts/cli/test_system_lcd.py b/smoketest/scripts/cli/test_system_lcd.py index 52530f573..27f7ede6b 100755 --- a/smoketest/scripts/cli/test_system_lcd.py +++ b/smoketest/scripts/cli/test_system_lcd.py @@ -28,6 +28,8 @@ class TestSystemLCD(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_system_display(self): # configure some system display diff --git a/smoketest/scripts/cli/test_system_login.py b/smoketest/scripts/cli/test_system_login.py index a400eebff..b67f3f546 100755 --- a/smoketest/scripts/cli/test_system_login.py +++ b/smoketest/scripts/cli/test_system_login.py @@ -178,6 +178,8 @@ class TestSystemLogin(VyOSUnitTestSHIM.TestCase): usernames = [x[0] for x in getpwall()] for user in users: self.assertNotIn(user, usernames) + # always forward to base class + super().tearDown() def test_add_linux_system_user(self): # We are not allowed to re-use a username already taken by the Linux diff --git a/smoketest/scripts/cli/test_system_logs.py b/smoketest/scripts/cli/test_system_logs.py index 6c77182e4..81fbf8048 100755 --- a/smoketest/scripts/cli/test_system_logs.py +++ b/smoketest/scripts/cli/test_system_logs.py @@ -56,10 +56,11 @@ def logrotate_config_parse(file_path): class TestSystemLogs(VyOSUnitTestSHIM.TestCase): - def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_logs_defaults(self): # test with empty section for default values diff --git a/smoketest/scripts/cli/test_system_option.py b/smoketest/scripts/cli/test_system_option.py index 48935f555..ce53b6498 100755 --- a/smoketest/scripts/cli/test_system_option.py +++ b/smoketest/scripts/cli/test_system_option.py @@ -32,6 +32,8 @@ class TestSystemOption(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.cli_delete(base_path) self.cli_commit() + # always forward to base class + super().tearDown() def test_ctrl_alt_delete(self): self.cli_set(base_path + ['ctrl-alt-delete', 'reboot']) diff --git a/smoketest/scripts/cli/test_system_resolvconf.py b/smoketest/scripts/cli/test_system_resolvconf.py index 45c2331e5..ad31e1f21 100755 --- a/smoketest/scripts/cli/test_system_resolvconf.py +++ b/smoketest/scripts/cli/test_system_resolvconf.py @@ -60,6 +60,8 @@ class TestSystemResolvConf(VyOSUnitTestSHIM.TestCase): self.cli_delete(base_path_domainname) self.cli_delete(base_path_domainsearch) self.cli_commit() + # always forward to base class + super().tearDown() def test_nameserver(self): # Check if server is added to resolv.conf diff --git a/smoketest/scripts/cli/test_system_sflow.py b/smoketest/scripts/cli/test_system_sflow.py index 6a933ab88..c6606e116 100755 --- a/smoketest/scripts/cli/test_system_sflow.py +++ b/smoketest/scripts/cli/test_system_sflow.py @@ -42,13 +42,13 @@ class TestSystemFlowAccounting(VyOSUnitTestSHIM.TestCase): def tearDown(self): # after service removal process must no longer run self.assertTrue(process_named_running(PROCESS_NAME)) - self.cli_delete(base_path) self.cli_delete(['vrf', 'name', vrf]) self.cli_commit() - # after service removal process must no longer run self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_sflow(self): agent_address = '192.0.2.5' diff --git a/smoketest/scripts/cli/test_system_syslog.py b/smoketest/scripts/cli/test_system_syslog.py index a1a75605c..4f3164bde 100755 --- a/smoketest/scripts/cli/test_system_syslog.py +++ b/smoketest/scripts/cli/test_system_syslog.py @@ -103,6 +103,8 @@ class TestRSYSLOGService(VyOSUnitTestSHIM.TestCase): # Check for running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def _set_tls_certificates(self): self.cli_set( diff --git a/smoketest/scripts/cli/test_vpn_ipsec.py b/smoketest/scripts/cli/test_vpn_ipsec.py index 9e01be02f..4cb23fbc0 100755 --- a/smoketest/scripts/cli/test_vpn_ipsec.py +++ b/smoketest/scripts/cli/test_vpn_ipsec.py @@ -134,6 +134,9 @@ class TestVPNIPsec(VyOSUnitTestSHIM.TestCase): cls.cli_delete(cls, base_path + ['interface', f'{interface}.{vif}']) def setUp(self): + # always forward to base class + super().setUp() + # Set IKE/ESP Groups self.cli_set(base_path + ['esp-group', esp_group, 'proposal', '1', 'encryption', 'aes128']) self.cli_set(base_path + ['esp-group', esp_group, 'proposal', '1', 'hash', 'sha1']) @@ -155,6 +158,8 @@ class TestVPNIPsec(VyOSUnitTestSHIM.TestCase): # Check for no longer running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def setupPKI(self): self.cli_set(['pki', 'ca', ca_name, 'certificate', ca_pem.replace('\n','')]) diff --git a/smoketest/scripts/cli/test_vpn_openconnect.py b/smoketest/scripts/cli/test_vpn_openconnect.py index 34e6036c2..6ca4295c1 100755 --- a/smoketest/scripts/cli/test_vpn_openconnect.py +++ b/smoketest/scripts/cli/test_vpn_openconnect.py @@ -166,11 +166,12 @@ class TestVPNOpenConnect(VyOSUnitTestSHIM.TestCase): def tearDown(self): self.assertTrue(process_named_running(PROCESS_NAME)) - self.cli_delete(base_path) self.cli_commit() - + # Check for no longer running process self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_ocserv(self): user = 'vyos_user' diff --git a/smoketest/scripts/cli/test_vpn_sstp.py b/smoketest/scripts/cli/test_vpn_sstp.py index 07b6a82a4..14114fd77 100755 --- a/smoketest/scripts/cli/test_vpn_sstp.py +++ b/smoketest/scripts/cli/test_vpn_sstp.py @@ -87,6 +87,5 @@ class TestVPNSSTPServer(BasicAccelPPPTest.TestCase): config = read_file(self._config_file) self.assertIn(f'host-name={host_name}', config) - if __name__ == '__main__': unittest.main(verbosity=2, failfast=VyOSUnitTestSHIM.TestCase.debug_on()) diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py index 6b8f3061d..e6b85bd8d 100755 --- a/smoketest/scripts/cli/test_vpp.py +++ b/smoketest/scripts/cli/test_vpp.py @@ -16,7 +16,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - import os import re import unittest @@ -39,7 +38,6 @@ base_path = ['vpp'] driver = 'dpdk' interface = 'eth1' - def get_vpp_config(): config = defaultdict(dict) current_section = None @@ -91,6 +89,9 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): cls.cli_delete(cls, base_path) def setUp(self): + # always forward to base class + super().setUp() + self.cli_set(base_path + ['settings', 'interface', interface, 'driver', driver]) self.cli_set(base_path + ['settings', 'unix', 'poll-sleep-usec', '10']) @@ -109,6 +110,8 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): self.assertFalse(os.path.exists(VPP_CONF)) self.assertFalse(process_named_running(PROCESS_NAME)) + # always forward to base class + super().tearDown() def test_01_vpp_basic(self): main_core = '0' diff --git a/smoketest/scripts/cli/test_vrf.py b/smoketest/scripts/cli/test_vrf.py index 3a3f0e5b9..456295b49 100755 --- a/smoketest/scripts/cli/test_vrf.py +++ b/smoketest/scripts/cli/test_vrf.py @@ -61,6 +61,9 @@ class VRFTest(VyOSUnitTestSHIM.TestCase): super(VRFTest, cls).setUpClass() def setUp(self): + # always forward to base class + super().setUp() + # VRF strict_most ist always enabled tmp = read_file('/proc/sys/net/vrf/strict_mode') self.assertEqual(tmp, '1') @@ -71,6 +74,8 @@ class VRFTest(VyOSUnitTestSHIM.TestCase): self.cli_commit() for vrf in vrfs: self.assertFalse(interface_exists(vrf)) + # always forward to base class + super().tearDown() def walk_path(self, obj, path): current = obj |
