diff options
Diffstat (limited to 'smoketest')
48 files changed, 331 insertions, 287 deletions
diff --git a/smoketest/scripts/cli/base_accel_ppp_test.py b/smoketest/scripts/cli/base_accel_ppp_test.py index e46a16137..705c932b4 100644 --- a/smoketest/scripts/cli/base_accel_ppp_test.py +++ b/smoketest/scripts/cli/base_accel_ppp_test.py @@ -56,8 +56,8 @@ class BasicAccelPPPTest: def verify(self, conf): self.assertEqual(conf['core']['thread-count'], str(get_half_cpus())) - def test_name_servers(self): - """ Verify proper Name-Server configuration for IPv4 and IPv6 """ + def test_accel_name_servers(self): + # Verify proper Name-Server configuration for IPv4 and IPv6 self.basic_config() nameserver = ['192.0.2.1', '192.0.2.2', '2001:db8::1'] @@ -78,8 +78,8 @@ class BasicAccelPPPTest: else: self.assertEqual(conf['ipv6-dns'][ns], None) - def test_authentication_local(self): - """ Test configuration of local authentication """ + def test_accel_local_authentication(self): + # Test configuration of local authentication self.basic_config() # upload / download limit @@ -134,8 +134,8 @@ class BasicAccelPPPTest: # Check for running process self.assertTrue(process_named_running(self._process_name)) - def test_authentication_radius(self): - """ Test configuration of RADIUS authentication for PPPoE server """ + def test_accel_radius_authentication(self): + # Test configuration of RADIUS authentication for PPPoE server self.basic_config() radius_server = '192.0.2.22' diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py index 0ae55a22a..a784140f3 100644 --- a/smoketest/scripts/cli/base_interfaces_test.py +++ b/smoketest/scripts/cli/base_interfaces_test.py @@ -68,25 +68,16 @@ class BasicInterfaceTest: self._options = {} def tearDown(self): - # we should not remove ethernet from the overall CLI - if 'ethernet' in self._base_path: - for interface in self._interfaces: - # when using a dedicated interface to test via TEST_ETH environment - # variable only this one will be cleared in the end - usable to test - # ethernet interfaces via SSH - self.session.delete(self._base_path + [interface]) - self.session.set(self._base_path + [interface, 'duplex', 'auto']) - self.session.set(self._base_path + [interface, 'speed', 'auto']) - else: + # Ethernet is handled in its derived class + if 'ethernet' not in self._base_path: self.session.delete(self._base_path) self.session.commit() del self.session - def test_add_description(self): - """ - Check if description can be added to interface - """ + def test_interface_description(self): + # Check if description can be added to interface and + # can be read back for intf in self._interfaces: test_string=f'Description-Test-{intf}' self.session.set(self._base_path + [intf, 'description', test_string]) @@ -98,14 +89,10 @@ class BasicInterfaceTest: # Validate interface description for intf in self._interfaces: test_string=f'Description-Test-{intf}' - with open(f'/sys/class/net/{intf}/ifalias', 'r') as f: - tmp = f.read().rstrip() - self.assertTrue(tmp, test_string) - - def test_add_address_single(self): - """ - Check if a single address can be added to interface. - """ + tmp = read_file(f'/sys/class/net/{intf}/ifalias') + self.assertTrue(tmp, test_string) + + def test_add_single_ip_address(self): addr = '192.0.2.0/31' for intf in self._interfaces: self.session.set(self._base_path + [intf, 'address', addr]) @@ -117,11 +104,7 @@ class BasicInterfaceTest: for intf in self._interfaces: self.assertTrue(is_intf_addr_assigned(intf, addr)) - def test_add_address_multi(self): - """ - Check if IPv4/IPv6 addresses can be added to interface. - """ - + def test_add_multiple_ip_addresses(self): # Add address for intf in self._interfaces: for addr in self._test_addr: @@ -141,8 +124,8 @@ class BasicInterfaceTest: self.assertTrue(is_intf_addr_assigned(intf, addr['addr'])) - def test_ipv6_link_local(self): - """ Common function for IPv6 link-local address assignemnts """ + def test_ipv6_link_local_address(self): + # Common function for IPv6 link-local address assignemnts if not self._test_ipv6: return None @@ -169,14 +152,7 @@ class BasicInterfaceTest: for interface in self._interfaces: self.assertTrue(AF_INET6 not in ifaddresses(interface)) - def _mtu_test(self, intf): - """ helper function to verify MTU size """ - with open(f'/sys/class/net/{intf}/mtu', 'r') as f: - tmp = f.read().rstrip() - self.assertEqual(tmp, self._mtu) - - def test_change_mtu(self): - """ Testcase if MTU can be changed on interface """ + def test_interface_mtu(self): if not self._test_mtu: return None @@ -191,10 +167,12 @@ class BasicInterfaceTest: # verify changed MTU for intf in self._interfaces: - self._mtu_test(intf) + tmp = read_file(f'/sys/class/net/{intf}/mtu') + self.assertEqual(tmp, self._mtu) - def test_change_mtu_1200(self): - """ Testcase if MTU can be changed to 1200 on non IPv6 enabled interfaces """ + def test_mtu_1200_no_ipv6_interface(self): + # Testcase if MTU can be changed to 1200 on non IPv6 + # enabled interfaces if not self._test_mtu: return None @@ -214,12 +192,12 @@ class BasicInterfaceTest: # verify changed MTU for intf in self._interfaces: - self._mtu_test(intf) + tmp = read_file(f'/sys/class/net/{intf}/mtu') + self.assertEqual(tmp, self._mtu) self._mtu = old_mtu - def test_8021q_vlan(self): - """ Testcase for 802.1q VLAN interfaces """ + def test_8021q_vlan_interfaces(self): if not self._test_vlan: return None @@ -235,16 +213,18 @@ class BasicInterfaceTest: self.session.set(base + ['address', address]) self.session.commit() + for intf in self._interfaces: for vlan in self._vlan_range: vif = f'{intf}.{vlan}' for address in self._test_addr: self.assertTrue(is_intf_addr_assigned(vif, address)) - self._mtu_test(vif) + tmp = read_file(f'/sys/class/net/{vif}/mtu') + self.assertEqual(tmp, self._mtu) - def test_8021ad_qinq_vlan(self): - """ Testcase for 802.1ad Q-in-Q VLAN interfaces """ + + def test_8021ad_qinq_vlan_interfaces(self): if not self._test_qinq: return None @@ -271,10 +251,11 @@ class BasicInterfaceTest: vif = f'{interface}.{vif_s}.{vif_c}' for address in self._test_addr: self.assertTrue(is_intf_addr_assigned(vif, address)) - self._mtu_test(vif) - def test_ip_options(self): - """ Test interface base IPv4 options """ + tmp = read_file(f'/sys/class/net/{vif}/mtu') + self.assertEqual(tmp, self._mtu) + + def test_interface_ip_options(self): if not self._test_ip: return None @@ -325,8 +306,7 @@ class BasicInterfaceTest: tmp = read_file(f'/proc/sys/net/ipv4/conf/{interface}/rp_filter') self.assertEqual('2', tmp) - def test_ipv6_options(self): - """ Test interface base IPv6 options """ + def test_interface_ipv6_options(self): if not self._test_ipv6: return None @@ -350,8 +330,7 @@ class BasicInterfaceTest: self.assertEqual(dad_transmits, tmp) - def test_ipv6_dhcpv6_pd(self): - """ Test interface base IPv6 options """ + def test_ipv6_dhcpv6_prefix_delegation(self): if not self._test_ipv6: return None diff --git a/smoketest/scripts/cli/test_configd_inspect.py b/smoketest/scripts/cli/test_configd_inspect.py index 4ebee8cc5..af46c6148 100755 --- a/smoketest/scripts/cli/test_configd_inspect.py +++ b/smoketest/scripts/cli/test_configd_inspect.py @@ -107,4 +107,4 @@ class TestConfigdInclude(unittest.TestCase): self.assertEqual(n, 0, f"'{s}' modifies config") if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py index 93ed1ced5..d38e11a63 100755 --- a/smoketest/scripts/cli/test_interfaces_bonding.py +++ b/smoketest/scripts/cli/test_interfaces_bonding.py @@ -51,27 +51,24 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest): self._options['bond0'].append(f'member interface {member}') - def test_add_address_single(self): - """ derived method to check if member interfaces are enslaved properly """ - super().test_add_address_single() + def test_add_single_ip_address(self): + super().test_add_single_ip_address() for interface in self._interfaces: slaves = read_file(f'/sys/class/net/{interface}/bonding/slaves').split() self.assertListEqual(slaves, self._members) - def test_8021q_vlan(self): - """ Testcase for 802.1q VLAN interfaces created on top of a lacp / bond - interface. This is the testcase for T2894 """ - super().test_8021q_vlan() + def test_8021q_vlan_interfaces(self): + super().test_8021q_vlan_interfaces() for interface in self._interfaces: slaves = read_file(f'/sys/class/net/{interface}/bonding/slaves').split() self.assertListEqual(slaves, self._members) - def test_remove_member(self): - """ T2515: when removing a bond member the previously enslaved/member - interface must be in its former admin-up/down state. Here we ensure that - it is admin-up as it was admin-up before. """ + def test_bonding_remove_member(self): + # T2515: when removing a bond member the previously enslaved/member + # interface must be in its former admin-up/down state. Here we ensure + # that it is admin-up as it was admin-up before. # configure member interfaces for interface in self._interfaces: @@ -94,4 +91,4 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest): self.assertEqual('up', state) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_bridge.py b/smoketest/scripts/cli/test_interfaces_bridge.py index 6c1efaf75..04a117edf 100755 --- a/smoketest/scripts/cli/test_interfaces_bridge.py +++ b/smoketest/scripts/cli/test_interfaces_bridge.py @@ -45,7 +45,7 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest): for tmp in Section.interfaces("ethernet"): if not '.' in tmp: self._members.append(tmp) - + self.session.set(['interfaces','dummy','dum0']) self.session.set(['interfaces','dummy','dum1']) self.session.set(['interfaces','bonding','bond1','member','interface','dum0']) @@ -55,14 +55,14 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest): self._options['br0'] = [] for member in self._members: self._options['br0'].append(f'member interface {member}') - + def tearDown(self): self.session.delete(['interfaces','bonding']) self.session.delete(['interfaces','dummy']) super().tearDown() - def test_add_remove_member(self): - """ Add member interfaces to bridge and set STP cost/priority """ + def test_add_remove_bridge_member(self): + # Add member interfaces to bridge and set STP cost/priority for interface in self._interfaces: base = self._base_path + [interface] self.session.set(base + ['stp']) @@ -94,9 +94,9 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest): self.session.delete(self._base_path + [interface, 'member']) self.session.commit() - - def test_vlan_filter(self): - """ Add member interface to bridge and set VLAN filter """ + + def test_bridge_vlan_filter(self): + # Add member interface to bridge and set VLAN filter for interface in self._interfaces: base = self._base_path + [interface] self.session.set(base + ['vif', '1','address', '192.0.2.1/24']) @@ -115,22 +115,22 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest): # commit config self.session.commit() - + # Detect the vlan filter function for interface in self._interfaces: with open(f'/sys/class/net/{interface}/bridge/vlan_filtering', 'r') as f: flags = f.read() self.assertEqual(int(flags), 1) - + # Execute the program to obtain status information - + json_data = cmd('bridge -j vlan show', shell=True) - + vlan_filter_status = None - + vlan_filter_status = json.loads(json_data) - - + + if vlan_filter_status is not None: for interface_status in vlan_filter_status: ifname = interface_status['ifname'] @@ -160,15 +160,15 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest): self.assertTrue(True) else: self.assertTrue(False) - + else: self.assertTrue(False) - - - + + + # check member interfaces are added on the bridge - + for interface in self._interfaces: bridge_members = [] for tmp in glob(f'/sys/class/net/{interface}/lower_*'): @@ -183,8 +183,8 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest): self.session.commit() - def test_vlan_members(self): - """ T2945: ensure that VIFs are not dropped from bridge """ + def test_bridge_vlan_members(self): + # T2945: ensure that VIFs are not dropped from bridge self.session.set(['interfaces', 'ethernet', 'eth0', 'vif', '300']) self.session.set(['interfaces', 'bridge', 'br0', 'member', 'interface', 'eth0.300']) @@ -207,5 +207,5 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_dummy.py b/smoketest/scripts/cli/test_interfaces_dummy.py index 01942fc89..97f5344ac 100755 --- a/smoketest/scripts/cli/test_interfaces_dummy.py +++ b/smoketest/scripts/cli/test_interfaces_dummy.py @@ -25,4 +25,4 @@ class DummyInterfaceTest(BasicInterfaceTest.BaseTest): self._interfaces = ['dum0', 'dum1', 'dum2'] if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_ethernet.py b/smoketest/scripts/cli/test_interfaces_ethernet.py index bdb20a5c7..d5dcdc536 100755 --- a/smoketest/scripts/cli/test_interfaces_ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_ethernet.py @@ -15,10 +15,23 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import os +import re import unittest from base_interfaces_test import BasicInterfaceTest from vyos.ifconfig import Section +from vyos.util import cmd +from vyos.util import process_named_running +from vyos.util import read_file + +ca_cert = '/config/auth/eapol_test_ca.pem' +ssl_cert = '/config/auth/eapol_test_server.pem' +ssl_key = '/config/auth/eapol_test_server.key' + +def get_wpa_supplicant_value(interface, key): + tmp = read_file(f'/run/wpa_supplicant/{interface}.conf') + tmp = re.findall(r'\n?{}=(.*)'.format(key), tmp) + return tmp[0] class EthernetInterfaceTest(BasicInterfaceTest.BaseTest): def setUp(self): @@ -43,27 +56,103 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest): if not '.' in tmp: self._interfaces.append(tmp) - def test_dhcp_disable(self): - """ - When interface is configured as admin down, it must be admin down even - """ - for interface in self._interfaces: - self.session.set(self._base_path + [interface, 'disable']) - for option in self._options.get(interface, []): - self.session.set(self._base_path + [interface] + option.split()) + self._macs = {} + for interface in self._interfaces: + try: + mac = self.session.show_config(self._base_path + + [interface, 'hw-id']).split()[1] + except: + # during initial system startup there is no hw-id node + mac = read_file(f'/sys/class/net/{interface}/address') + self._macs[interface] = mac + + + def tearDown(self): + for interface in self._interfaces: + # when using a dedicated interface to test via TEST_ETH environment + # variable only this one will be cleared in the end - usable to test + # ethernet interfaces via SSH + self.session.delete(self._base_path + [interface]) + self.session.set(self._base_path + [interface, 'duplex', 'auto']) + self.session.set(self._base_path + [interface, 'speed', 'auto']) + self.session.set(self._base_path + [interface, 'hw-id', self._macs[interface]]) + + super().tearDown() + + + def test_dhcp_disable_interface(self): + # When interface is configured as admin down, it must be admin down + # even when dhcpc starts on the given interface + for interface in self._interfaces: + self.session.set(self._base_path + [interface, 'disable']) + + # Also enable DHCP (ISC DHCP always places interface in admin up + # state so we check that we do not start DHCP client. + # https://phabricator.vyos.net/T2767 + self.session.set(self._base_path + [interface, 'address', 'dhcp']) + + self.session.commit() + + # Validate interface state + for interface in self._interfaces: + with open(f'/sys/class/net/{interface}/flags', 'r') as f: + flags = f.read() + self.assertEqual(int(flags, 16) & 1, 0) + - # Also enable DHCP (ISC DHCP always places interface in admin up - # state so we check that we do not start DHCP client. - # https://phabricator.vyos.net/T2767 - self.session.set(self._base_path + [interface, 'address', 'dhcp']) + def test_eapol_support(self): + for interface in self._interfaces: + # Enable EAPoL + self.session.set(self._base_path + [interface, 'eapol', 'ca-cert-file', ca_cert]) + self.session.set(self._base_path + [interface, 'eapol', 'cert-file', ssl_cert]) + self.session.set(self._base_path + [interface, 'eapol', 'key-file', ssl_key]) - self.session.commit() + self.session.commit() - # Validate interface state - for interface in self._interfaces: - with open(f'/sys/class/net/{interface}/flags', 'r') as f: - flags = f.read() - self.assertEqual(int(flags, 16) & 1, 0) + # Check for running process + self.assertTrue(process_named_running('wpa_supplicant')) + + # Validate interface config + for interface in self._interfaces: + tmp = get_wpa_supplicant_value(interface, 'key_mgmt') + self.assertEqual('IEEE8021X', tmp) + + tmp = get_wpa_supplicant_value(interface, 'eap') + self.assertEqual('TLS', tmp) + + tmp = get_wpa_supplicant_value(interface, 'eapol_flags') + self.assertEqual('0', tmp) + + tmp = get_wpa_supplicant_value(interface, 'ca_cert') + self.assertEqual(f'"{ca_cert}"', tmp) + + tmp = get_wpa_supplicant_value(interface, 'client_cert') + self.assertEqual(f'"{ssl_cert}"', tmp) + + tmp = get_wpa_supplicant_value(interface, 'private_key') + self.assertEqual(f'"{ssl_key}"', tmp) + + mac = read_file(f'/sys/class/net/{interface}/address') + tmp = get_wpa_supplicant_value(interface, 'identity') + self.assertEqual(f'"{mac}"', tmp) if __name__ == '__main__': - unittest.main() + # Our SSL certificates need a subject ... + subject = '/C=DE/ST=BY/O=VyOS/localityName=Cloud/commonName=vyos/' \ + 'organizationalUnitName=VyOS/emailAddress=maintainers@vyos.io/' + + if not (os.path.isfile(ssl_key) and os.path.isfile(ssl_cert)): + # Generate mandatory SSL certificate + tmp = f'openssl req -newkey rsa:4096 -new -nodes -x509 -days 3650 '\ + f'-keyout {ssl_key} -out {ssl_cert} -subj {subject}' + print(cmd(tmp)) + + if not os.path.isfile(ca_cert): + # Generate "CA" + tmp = f'openssl req -new -x509 -key {ssl_key} -out {ca_cert} -subj {subject}' + print(cmd(tmp)) + + for file in [ca_cert, ssl_cert, ssl_key]: + cmd(f'sudo chown radius_priv_user:vyattacfg {file}') + + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_geneve.py b/smoketest/scripts/cli/test_interfaces_geneve.py index f84a55f86..7e0389a63 100755 --- a/smoketest/scripts/cli/test_interfaces_geneve.py +++ b/smoketest/scripts/cli/test_interfaces_geneve.py @@ -34,4 +34,4 @@ class GeneveInterfaceTest(BasicInterfaceTest.BaseTest): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_l2tpv3.py b/smoketest/scripts/cli/test_interfaces_l2tpv3.py index d8655d157..be9565d00 100755 --- a/smoketest/scripts/cli/test_interfaces_l2tpv3.py +++ b/smoketest/scripts/cli/test_interfaces_l2tpv3.py @@ -38,8 +38,8 @@ class GeneveInterfaceTest(BasicInterfaceTest.BaseTest): } self._interfaces = list(self._options) - def test_add_address_single(self): - super().test_add_address_single() + def test_add_single_ip_address(self): + super().test_add_single_ip_address() command = 'sudo ip -j l2tp show session' json_out = json.loads(cmd(command)) @@ -56,4 +56,4 @@ class GeneveInterfaceTest(BasicInterfaceTest.BaseTest): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_loopback.py b/smoketest/scripts/cli/test_interfaces_loopback.py index ba428b5d3..79225a1bd 100755 --- a/smoketest/scripts/cli/test_interfaces_loopback.py +++ b/smoketest/scripts/cli/test_interfaces_loopback.py @@ -27,15 +27,15 @@ class LoopbackInterfaceTest(BasicInterfaceTest.BaseTest): self._base_path = ['interfaces', 'loopback'] self._interfaces = ['lo'] - def test_add_address_single(self): - super().test_add_address_single() + def test_add_single_ip_address(self): + super().test_add_single_ip_address() for addr in self._loopback_addresses: self.assertTrue(is_intf_addr_assigned('lo', addr)) - def test_add_address_multi(self): - super().test_add_address_multi() + def test_add_multiple_ip_addresses(self): + super().test_add_multiple_ip_addresses() for addr in self._loopback_addresses: self.assertTrue(is_intf_addr_assigned('lo', addr)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_macsec.py b/smoketest/scripts/cli/test_interfaces_macsec.py index 177d2b946..d9635951f 100755 --- a/smoketest/scripts/cli/test_interfaces_macsec.py +++ b/smoketest/scripts/cli/test_interfaces_macsec.py @@ -43,10 +43,10 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest): self._interfaces = list(self._options) - def test_encryption(self): - """ MACsec can be operating in authentication and encryption mode - both - using different mandatory settings, lets test encryption as the basic - authentication test has been performed using the base class tests """ + def test_macsec_encryption(self): + # MACsec can be operating in authentication and encryption mode - both + # using different mandatory settings, lets test encryption as the basic + # authentication test has been performed using the base class tests mak_cak = '232e44b7fda6f8e2d88a07bf78a7aff4' mak_ckn = '40916f4b23e3d548ad27eedd2d10c6f98c2d21684699647d63d41b500dfe8836' @@ -105,7 +105,7 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest): # Check for running process self.assertTrue(process_named_running('wpa_supplicant')) - def test_mandatory_options(self): + def test_macsec_mandatory_options(self): interface = 'macsec1' self.session.set(self._base_path + [interface]) @@ -123,8 +123,8 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest): self.session.commit() self.assertIn(interface, interfaces()) - def test_source_interface(self): - """ Ensure source-interface can bot be part of any other bond or bridge """ + def test_macsec_source_interface(self): + # Ensure source-interface can bot be part of any other bond or bridge base_bridge = ['interfaces', 'bridge', 'br200'] base_bond = ['interfaces', 'bonding', 'bond200'] @@ -152,5 +152,5 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest): self.assertIn(interface, interfaces()) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_openvpn.py b/smoketest/scripts/cli/test_interfaces_openvpn.py index e636e107d..00db3f667 100755 --- a/smoketest/scripts/cli/test_interfaces_openvpn.py +++ b/smoketest/scripts/cli/test_interfaces_openvpn.py @@ -71,10 +71,8 @@ class TestInterfacesOpenVPN(unittest.TestCase): self.session.commit() del self.session - def test_client_verify(self): - """ - Create OpenVPN client interface and test verify() steps. - """ + def test_openvpn_client_verify(self): + # Create OpenVPN client interface and test verify() steps. interface = 'vtun2000' path = base_path + [interface] self.session.set(path + ['mode', 'client']) @@ -144,11 +142,9 @@ class TestInterfacesOpenVPN(unittest.TestCase): self.assertIn(interface, interfaces()) - def test_client_interfaces(self): - """ - Create OpenVPN client interfaces connecting to different - server IP addresses. Validate configuration afterwards. - """ + def test_openvpn_client_interfaces(self): + # Create OpenVPN client interfaces connecting to different + # server IP addresses. Validate configuration afterwards. num_range = range(10, 15) for ii in num_range: interface = f'vtun{ii}' @@ -211,10 +207,8 @@ class TestInterfacesOpenVPN(unittest.TestCase): interface = f'vtun{ii}' self.assertNotIn(interface, interfaces()) - def test_server_verify(self): - """ - Create one OpenVPN server interface and check required verify() stages - """ + def test_openvpn_server_verify(self): + # Create one OpenVPN server interface and check required verify() stages interface = 'vtun5000' path = base_path + [interface] @@ -321,11 +315,10 @@ class TestInterfacesOpenVPN(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) self.assertIn(interface, interfaces()) - def test_server_subnet_topology(self): - """ - Create OpenVPN server interfaces using different client subnets. - Validate configuration afterwards. - """ + def test_openvpn_server_subnet_topology(self): + # Create OpenVPN server interfaces using different client subnets. + # Validate configuration afterwards. + auth_hash = 'sha256' num_range = range(20, 25) port = '' @@ -418,11 +411,9 @@ class TestInterfacesOpenVPN(unittest.TestCase): interface = f'vtun{ii}' self.assertNotIn(interface, interfaces()) - def test_server_net30_topology(self): - """ - Create OpenVPN server interfaces (net30) using different client - subnets. Validate configuration afterwards. - """ + def test_openvpn_server_net30_topology(self): + # Create OpenVPN server interfaces (net30) using different client + # subnets. Validate configuration afterwards. auth_hash = 'sha256' num_range = range(20, 25) port = '' @@ -495,10 +486,10 @@ class TestInterfacesOpenVPN(unittest.TestCase): interface = f'vtun{ii}' self.assertNotIn(interface, interfaces()) - def test_site2site_verify(self): - """ - Create one OpenVPN site2site interface and check required verify() stages - """ + def test_openvpn_site2site_verify(self): + # Create one OpenVPN site2site interface and check required + # verify() stages + interface = 'vtun5000' path = base_path + [interface] @@ -554,10 +545,9 @@ class TestInterfacesOpenVPN(unittest.TestCase): self.session.commit() - def test_site2site_interfaces_tun(self): - """ - Create two OpenVPN site-to-site interfaces - """ + def test_openvpn_site2site_interfaces_tun(self): + # Create two OpenVPN site-to-site interfaces + num_range = range(30, 35) port = '' local_address = '' @@ -660,4 +650,4 @@ if __name__ == '__main__': for file in [ca_cert, ssl_cert, ssl_key, dh_pem, s2s_key, auth_key]: cmd(f'sudo chown openvpn:openvpn {file}') - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_pppoe.py b/smoketest/scripts/cli/test_interfaces_pppoe.py index dc63a14a0..6bfe35d86 100755 --- a/smoketest/scripts/cli/test_interfaces_pppoe.py +++ b/smoketest/scripts/cli/test_interfaces_pppoe.py @@ -53,8 +53,8 @@ class PPPoEInterfaceTest(unittest.TestCase): self.session.commit() del self.session - def test_pppoe(self): - """ Check if PPPoE dialer can be configured and runs """ + def test_pppoe_client(self): + # Check if PPPoE dialer can be configured and runs for interface in self._interfaces: user = 'VyOS-user-' + interface passwd = 'VyOS-passwd-' + interface @@ -98,7 +98,7 @@ class PPPoEInterfaceTest(unittest.TestCase): self.assertTrue(running) def test_pppoe_dhcpv6pd(self): - """ Check if PPPoE dialer can be configured with DHCPv6-PD """ + # Check if PPPoE dialer can be configured with DHCPv6-PD address = '1' sla_id = '0' sla_len = '8' @@ -159,4 +159,4 @@ class PPPoEInterfaceTest(unittest.TestCase): self.assertTrue(tmp) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py index 62a97fc34..c1711c5a3 100755 --- a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py +++ b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py @@ -37,4 +37,4 @@ class PEthInterfaceTest(BasicInterfaceTest.BaseTest): self._interfaces = list(self._options) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_tunnel.py b/smoketest/scripts/cli/test_interfaces_tunnel.py index aaff92dea..45679e280 100755 --- a/smoketest/scripts/cli/test_interfaces_tunnel.py +++ b/smoketest/scripts/cli/test_interfaces_tunnel.py @@ -156,9 +156,9 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): self.assertEqual(self.local_v6, conf['linkinfo']['info_data']['local']) self.assertEqual(remote_ip6, conf['linkinfo']['info_data']['remote']) - def test_verify_ipv4_local_remote_addr(self): - """ When running tests ensure that for certain encapsulation types the - local and remote IP address is actually an IPv4 address """ + def test_tunnel_verify_ipv4_local_remote_addr(self): + # When running tests ensure that for certain encapsulation types the + # local and remote IP address is actually an IPv4 address interface = f'tun1000' local_if_addr = f'10.10.200.1/24' @@ -185,9 +185,9 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): self.session.delete(self._base_path + [interface]) self.session.commit() - def test_verify_ipv6_local_remote_addr(self): - """ When running tests ensure that for certain encapsulation types the - local and remote IP address is actually an IPv6 address """ + def test_tunnel_verify_ipv6_local_remote_addr(self): + # When running tests ensure that for certain encapsulation types the + # local and remote IP address is actually an IPv6 address interface = f'tun1010' local_if_addr = f'10.10.200.1/24' @@ -214,8 +214,8 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): self.session.delete(self._base_path + [interface]) self.session.commit() - def test_verify_local_dhcp(self): - """ We can not use local-ip and dhcp-interface at the same time """ + def test_tunnel_verify_local_dhcp(self): + # We can not use local-ip and dhcp-interface at the same time interface = f'tun1020' local_if_addr = f'10.0.0.1/24' @@ -234,7 +234,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): # Check if commit is ok self.session.commit() - def test_ip6ip6(self): + def test_tunnel_ip6ip6(self): interface = 'tun120' encapsulation = 'ip6ip6' local_if_addr = '2001:db8:f00::1/24' @@ -270,7 +270,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): self.assertEqual(self.local_v6, conf['linkinfo']['info_data']['local']) self.assertEqual(remote_ip6, conf['linkinfo']['info_data']['remote']) - def test_gre_ipv4(self): + def test_tunnel_gre_ipv4(self): interface = 'tun200' encapsulation = 'gre' local_if_addr = '172.16.1.1/24' @@ -340,7 +340,7 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): self.assertEqual(remote_ip6, conf['linkinfo']['info_data']['remote']) - def test_sit(self): + def test_tunnel_sit(self): interface = 'tun300' encapsulation = 'sit' local_if_addr = '172.16.2.1/24' @@ -378,4 +378,4 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_vxlan.py b/smoketest/scripts/cli/test_interfaces_vxlan.py index 2628e0285..f41c180ad 100755 --- a/smoketest/scripts/cli/test_interfaces_vxlan.py +++ b/smoketest/scripts/cli/test_interfaces_vxlan.py @@ -32,4 +32,4 @@ class VXLANInterfaceTest(BasicInterfaceTest.BaseTest): self._interfaces = list(self._options) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_wireguard.py b/smoketest/scripts/cli/test_interfaces_wireguard.py index 726405780..d9a51b146 100755 --- a/smoketest/scripts/cli/test_interfaces_wireguard.py +++ b/smoketest/scripts/cli/test_interfaces_wireguard.py @@ -38,8 +38,8 @@ class WireGuardInterfaceTest(unittest.TestCase): self.session.commit() del self.session - def test_peer(self): - """ Create WireGuard interfaces with associated peers """ + def test_wireguard_peer(self): + # Create WireGuard interfaces with associated peers for intf in self._interfaces: peer = 'foo-' + intf psk = 'u2xdA70hkz0S1CG0dZlOh0aq2orwFXRIVrKo4DCvHgM=' @@ -63,9 +63,9 @@ class WireGuardInterfaceTest(unittest.TestCase): self.assertTrue(os.path.isdir(f'/sys/class/net/{intf}')) - def test_add_remove_peer(self): - """ Create WireGuard interfaces with associated peers. Remove one of - the configured peers. Bug reported as T2939 """ + def test_wireguard_add_remove_peer(self): + # T2939: Create WireGuard interfaces with associated peers. + # Remove one of the configured peers. interface = 'wg0' port = '12345' pubkey_1 = 'n1CUsmR0M2LUUsyicBd6blZICwUqqWWHbu4ifZ2/9gk=' @@ -92,7 +92,5 @@ class WireGuardInterfaceTest(unittest.TestCase): self.session.delete(base_path + [interface, 'peer', 'PEER01']) self.session.commit() - - if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_wireless.py b/smoketest/scripts/cli/test_interfaces_wireless.py index 70cb5190c..9d2f4ea59 100755 --- a/smoketest/scripts/cli/test_interfaces_wireless.py +++ b/smoketest/scripts/cli/test_interfaces_wireless.py @@ -48,9 +48,9 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest): } self._interfaces = list(self._options) - def test_add_address_single(self): - """ derived method to check if member interfaces are enslaved properly """ - super().test_add_address_single() + def test_wireless_add_single_ip_address(self): + # derived method to check if member interfaces are enslaved properly + super().test_add_single_ip_address() for option, option_value in self._options.items(): if 'type access-point' in option_value: @@ -62,9 +62,7 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest): else: self.assertTrue(False) - def test_hostapd_config(self): - """ Check if hostapd config is properly generated """ - + def test_wireless_hostapd_config(self): # Only set the hostapd (access-point) options interface = 'wlan0' ssid = 'ssid' @@ -140,9 +138,7 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest): # Check for running process self.assertTrue(process_named_running('hostapd')) - def test_hostapd_wpa_config(self): - """ Check if hostapd config is properly generated """ - + def test_wireless_hostapd_wpa_config(self): # Only set the hostapd (access-point) options interface = 'wlan0' phy = 'phy0' @@ -208,7 +204,7 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest): # Check for running process self.assertTrue(process_named_running('hostapd')) - def test_access_point_bridge(self): + def test_wireless_access_point_bridge(self): interface = 'wlan0' ssid = 'VyOS-Test' bridge = 'br42477' @@ -238,4 +234,4 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest): if __name__ == '__main__': check_kmod('mac80211_hwsim') - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_interfaces_wirelessmodem.py b/smoketest/scripts/cli/test_interfaces_wirelessmodem.py index efc9c0e98..45cd069f4 100755 --- a/smoketest/scripts/cli/test_interfaces_wirelessmodem.py +++ b/smoketest/scripts/cli/test_interfaces_wirelessmodem.py @@ -79,4 +79,4 @@ class WWANInterfaceTest(unittest.TestCase): self.assertTrue(running) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_nat.py b/smoketest/scripts/cli/test_nat.py index 43392bde3..7ca82f86f 100755 --- a/smoketest/scripts/cli/test_nat.py +++ b/smoketest/scripts/cli/test_nat.py @@ -40,8 +40,6 @@ class TestNAT(unittest.TestCase): self.session.commit() def test_snat(self): - """ Test source NAT (SNAT) rules """ - rules = ['100', '110', '120', '130', '200', '210', '220', '230'] outbound_iface_100 = 'eth0' outbound_iface_200 = 'eth1' @@ -92,8 +90,6 @@ class TestNAT(unittest.TestCase): self.assertEqual(f'{address}/{mask}', network) def test_dnat(self): - """ Test destination NAT (DNAT) rules """ - rules = ['100', '110', '120', '130', '200', '210', '220', '230'] inbound_iface_100 = 'eth0' inbound_iface_200 = 'eth1' @@ -143,8 +139,8 @@ class TestNAT(unittest.TestCase): self.assertEqual(iface, inbound_iface_200) - def test_validation_logic(self): - """ T2813: Ensure translation address is specified """ + def test_snat_required_translation_address(self): + # T2813: Ensure translation address is specified rule = '5' self.session.set(src_path + ['rule', rule, 'source', 'address', '192.0.2.0/24']) @@ -161,4 +157,4 @@ class TestNAT(unittest.TestCase): self.session.commit() if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_policy_local-route.py b/smoketest/scripts/cli/test_policy_local-route.py index 490bf6b47..de1882a65 100755 --- a/smoketest/scripts/cli/test_policy_local-route.py +++ b/smoketest/scripts/cli/test_policy_local-route.py @@ -58,4 +58,4 @@ class PolicyLocalRouteTest(unittest.TestCase): self.assertEqual(tmp, original) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_protocols_igmp-proxy.py b/smoketest/scripts/cli/test_protocols_igmp-proxy.py index f78581fea..6aaad739d 100755 --- a/smoketest/scripts/cli/test_protocols_igmp-proxy.py +++ b/smoketest/scripts/cli/test_protocols_igmp-proxy.py @@ -80,4 +80,4 @@ class TestProtocolsIGMPProxy(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_bcast-relay.py b/smoketest/scripts/cli/test_service_bcast-relay.py index fe4531c3b..c28509714 100755 --- a/smoketest/scripts/cli/test_service_bcast-relay.py +++ b/smoketest/scripts/cli/test_service_bcast-relay.py @@ -39,8 +39,7 @@ class TestServiceBroadcastRelay(unittest.TestCase): self.session.commit() del self.session - def test_service(self): - """ Check if broadcast relay service can be configured and runs """ + def test_broadcast_relay_service(self): ids = range(1, 5) for id in ids: base = base_path + ['id', str(id)] @@ -68,4 +67,4 @@ class TestServiceBroadcastRelay(unittest.TestCase): self.assertTrue(running) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_dhcp-relay.py b/smoketest/scripts/cli/test_service_dhcp-relay.py index 4b020db72..676c4a481 100755 --- a/smoketest/scripts/cli/test_service_dhcp-relay.py +++ b/smoketest/scripts/cli/test_service_dhcp-relay.py @@ -89,5 +89,5 @@ class TestServiceDHCPRelay(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_dhcp-server.py b/smoketest/scripts/cli/test_service_dhcp-server.py index e13896095..5bf4b100e 100755 --- a/smoketest/scripts/cli/test_service_dhcp-server.py +++ b/smoketest/scripts/cli/test_service_dhcp-server.py @@ -321,4 +321,4 @@ class TestServiceDHCPServer(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_dhcpv6-relay.py b/smoketest/scripts/cli/test_service_dhcpv6-relay.py index ccc849a4f..e36c237bc 100755 --- a/smoketest/scripts/cli/test_service_dhcpv6-relay.py +++ b/smoketest/scripts/cli/test_service_dhcpv6-relay.py @@ -108,5 +108,5 @@ if __name__ == '__main__': if '.' not in tmp: interfaces.append(tmp) - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_dhcpv6-server.py b/smoketest/scripts/cli/test_service_dhcpv6-server.py index 56fc16d2b..319891a94 100755 --- a/smoketest/scripts/cli/test_service_dhcpv6-server.py +++ b/smoketest/scripts/cli/test_service_dhcpv6-server.py @@ -152,4 +152,4 @@ class TestServiceDHCPServer(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_dns_dynamic.py b/smoketest/scripts/cli/test_service_dns_dynamic.py index c7ac87135..83eede64a 100755 --- a/smoketest/scripts/cli/test_service_dns_dynamic.py +++ b/smoketest/scripts/cli/test_service_dns_dynamic.py @@ -45,8 +45,7 @@ class TestServiceDDNS(unittest.TestCase): del self.session - def test_service(self): - """ Check individual DDNS service providers """ + def test_dyndns_service(self): ddns = ['interface', 'eth0', 'service'] services = ['cloudflare', 'afraid', 'dyndns', 'zoneedit'] @@ -97,8 +96,8 @@ class TestServiceDDNS(unittest.TestCase): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - def test_rfc2136(self): - """ Check if DDNS service can be configured and runs """ + def test_dyndns_rfc2136(self): + # Check if DDNS service can be configured and runs ddns = ['interface', 'eth0', 'rfc2136', 'vyos'] ddns_key_file = '/config/auth/my.key' @@ -128,4 +127,4 @@ class TestServiceDDNS(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py index 5e2f3dfbd..ada53e8dd 100755 --- a/smoketest/scripts/cli/test_service_dns_forwarding.py +++ b/smoketest/scripts/cli/test_service_dns_forwarding.py @@ -48,7 +48,7 @@ class TestServicePowerDNS(unittest.TestCase): del self.session def test_basic_forwarding(self): - """ Check basic DNS forwarding settings """ + # Check basic DNS forwarding settings cache_size = '20' negative_ttl = '120' @@ -100,7 +100,7 @@ class TestServicePowerDNS(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) def test_dnssec(self): - """ DNSSEC option testing """ + # DNSSEC option testing for network in allow_from: self.session.set(base_path + ['allow-from', network]) @@ -121,7 +121,7 @@ class TestServicePowerDNS(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) def test_external_nameserver(self): - """ Externe Domain Name Servers (DNS) addresses """ + # Externe Domain Name Servers (DNS) addresses for network in allow_from: self.session.set(base_path + ['allow-from', network]) @@ -147,8 +147,6 @@ class TestServicePowerDNS(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) def test_domain_forwarding(self): - """ Externe Domain Name Servers (DNS) addresses """ - for network in allow_from: self.session.set(base_path + ['allow-from', network]) for address in listen_adress: @@ -188,5 +186,5 @@ class TestServicePowerDNS(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py index 5f073b6d2..fd0f6bfbd 100755 --- a/smoketest/scripts/cli/test_service_https.py +++ b/smoketest/scripts/cli/test_service_https.py @@ -58,4 +58,4 @@ class TestHTTPSService(unittest.TestCase): self.assertEqual(ret, 0) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_mdns-repeater.py b/smoketest/scripts/cli/test_service_mdns-repeater.py index de73b9914..e6986b92a 100755 --- a/smoketest/scripts/cli/test_service_mdns-repeater.py +++ b/smoketest/scripts/cli/test_service_mdns-repeater.py @@ -48,4 +48,4 @@ class TestServiceMDNSrepeater(unittest.TestCase): self.assertTrue(process_named_running('mdns-repeater')) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_pppoe-server.py b/smoketest/scripts/cli/test_service_pppoe-server.py index c625d4312..a4bb6e9f9 100755 --- a/smoketest/scripts/cli/test_service_pppoe-server.py +++ b/smoketest/scripts/cli/test_service_pppoe-server.py @@ -73,8 +73,8 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest): super().basic_config() - def test_ppp_options(self): - """ Test configuration of local authentication for PPPoE server """ + def test_pppoe_server_ppp_options(self): + # Test configuration of local authentication for PPPoE server self.basic_config() # other settings @@ -116,8 +116,8 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest): # Check for running process self.assertTrue(process_named_running(self._process_name)) - def test_authentication_protocols(self): - """ Test configuration of local authentication for PPPoE server """ + def test_pppoe_server_authentication_protocols(self): + # Test configuration of local authentication for PPPoE server self.basic_config() # explicitly test mschap-v2 - no special reason @@ -135,8 +135,8 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest): # Check for running process self.assertTrue(process_named_running(self._process_name)) - def test_client_ip_pool(self): - """ Test configuration of IPv6 client pools """ + def test_pppoe_server_client_ip_pool(self): + # Test configuration of IPv6 client pools self.basic_config() subnet = '172.18.0.0/24' @@ -164,8 +164,8 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest): self.assertTrue(process_named_running(self._process_name)) - def test_client_ipv6_pool(self): - """ Test configuration of IPv6 client pools """ + def test_pppoe_server_client_ipv6_pool(self): + # Test configuration of IPv6 client pools self.basic_config() # Enable IPv6 @@ -207,7 +207,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest): self.assertTrue(process_named_running(self._process_name)) - def test_authentication_radius(self): + def test_accel_radius_authentication(self): radius_called_sid = 'ifname:mac' radius_acct_interim_jitter = '9' @@ -215,7 +215,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest): self.set(['authentication', 'radius', 'acct-interim-jitter', radius_acct_interim_jitter]) # run common tests - super().test_authentication_radius() + super().test_accel_radius_authentication() # Validate configuration values conf = ConfigParser(allow_no_value=True, delimiters='=') @@ -227,4 +227,4 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_router-advert.py b/smoketest/scripts/cli/test_service_router-advert.py index 238f59e6d..b80eb3c43 100755 --- a/smoketest/scripts/cli/test_service_router-advert.py +++ b/smoketest/scripts/cli/test_service_router-advert.py @@ -94,4 +94,4 @@ class TestServiceRADVD(unittest.TestCase): self.assertTrue(process_named_running('radvd')) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_snmp.py b/smoketest/scripts/cli/test_service_snmp.py index 2c2e2181b..81045d0b4 100755 --- a/smoketest/scripts/cli/test_service_snmp.py +++ b/smoketest/scripts/cli/test_service_snmp.py @@ -45,8 +45,8 @@ class TestSNMPService(unittest.TestCase): def tearDown(self): del self.session - def test_snmp(self): - """ Check if SNMP can be configured and service runs """ + def test_snmp_basic(self): + # Check if SNMP can be configured and service runs clients = ['192.0.2.1', '2001:db8::1'] networks = ['192.0.2.128/25', '2001:db8:babe::/48'] listen = ['127.0.0.1', '::1'] @@ -85,7 +85,8 @@ class TestSNMPService(unittest.TestCase): def test_snmpv3_sha(self): - """ Check if SNMPv3 can be configured with SHA authentication and service runs""" + # Check if SNMPv3 can be configured with SHA authentication + # and service runs self.session.set(base_path + ['v3', 'engineid', '000000000000000000000002']) self.session.set(base_path + ['v3', 'group', 'default', 'mode', 'ro']) @@ -119,7 +120,8 @@ class TestSNMPService(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) def test_snmpv3_md5(self): - """ Check if SNMPv3 can be configured with MD5 authentication and service runs""" + # Check if SNMPv3 can be configured with MD5 authentication + # and service runs self.session.set(base_path + ['v3', 'engineid', '000000000000000000000002']) self.session.set(base_path + ['v3', 'group', 'default', 'mode', 'ro']) @@ -153,5 +155,5 @@ class TestSNMPService(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_ssh.py b/smoketest/scripts/cli/test_service_ssh.py index ea70d8e03..0bb907c3a 100755 --- a/smoketest/scripts/cli/test_service_ssh.py +++ b/smoketest/scripts/cli/test_service_ssh.py @@ -53,8 +53,8 @@ class TestServiceSSH(unittest.TestCase): del self.session def test_ssh_default(self): - """ Check if SSH service runs with default settings - used for checking - behavior of <defaultValue> in XML definition """ + # Check if SSH service runs with default settings - used for checking + # behavior of <defaultValue> in XML definition self.session.set(base_path) # commit changes @@ -67,8 +67,8 @@ class TestServiceSSH(unittest.TestCase): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - def test_ssh_single(self): - """ Check if SSH service can be configured and runs """ + def test_ssh_single_listen_address(self): + # Check if SSH service can be configured and runs self.session.set(base_path + ['port', '1234']) self.session.set(base_path + ['disable-host-validation']) self.session.set(base_path + ['disable-password-authentication']) @@ -106,9 +106,9 @@ class TestServiceSSH(unittest.TestCase): # Check for running process self.assertTrue(process_named_running(PROCESS_NAME)) - def test_ssh_multi(self): - """ Check if SSH service can be configured and runs with multiple - listen ports and listen-addresses """ + def test_ssh_multiple_listen_addresses(self): + # Check if SSH service can be configured and runs with multiple + # listen ports and listen-addresses ports = ['22', '2222'] for port in ports: self.session.set(base_path + ['port', port]) @@ -134,7 +134,7 @@ class TestServiceSSH(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) def test_ssh_vrf(self): - """ Check if SSH service can be bound to given VRF """ + # Check if SSH service can be bound to given VRF port = '22' self.session.set(base_path + ['port', port]) self.session.set(base_path + ['vrf', vrf]) @@ -160,4 +160,4 @@ class TestServiceSSH(unittest.TestCase): self.assertIn(PROCESS_NAME, tmp) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_tftp-server.py b/smoketest/scripts/cli/test_service_tftp-server.py index 3210e622f..82e5811ff 100755 --- a/smoketest/scripts/cli/test_service_tftp-server.py +++ b/smoketest/scripts/cli/test_service_tftp-server.py @@ -102,4 +102,4 @@ class TestServiceTFTPD(unittest.TestCase): self.assertEqual(count, len(address)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_service_webproxy.py b/smoketest/scripts/cli/test_service_webproxy.py index 6f88a351d..3db2daa8f 100755 --- a/smoketest/scripts/cli/test_service_webproxy.py +++ b/smoketest/scripts/cli/test_service_webproxy.py @@ -204,7 +204,7 @@ class TestServiceWebProxy(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) def test_05_basic_squidguard(self): - """ Create very basic local SquidGuard blacklist and verify its contents" """ + # Create very basic local SquidGuard blacklist and verify its contents sg_db_dir = '/opt/vyatta/etc/config/url-filtering/squidguard/db' default_cache = '100' @@ -287,4 +287,4 @@ class TestServiceWebProxy(unittest.TestCase): if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_system_acceleration_qat.py b/smoketest/scripts/cli/test_system_acceleration_qat.py index c937c810e..cadb263f5 100755 --- a/smoketest/scripts/cli/test_system_acceleration_qat.py +++ b/smoketest/scripts/cli/test_system_acceleration_qat.py @@ -44,4 +44,4 @@ class TestSystemLCD(unittest.TestCase): self.session.commit() if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_system_ip.py b/smoketest/scripts/cli/test_system_ip.py index 4fcaaa465..8fc18ba88 100755 --- a/smoketest/scripts/cli/test_system_ip.py +++ b/smoketest/scripts/cli/test_system_ip.py @@ -32,8 +32,8 @@ class TestSystemIP(unittest.TestCase): del self.session def test_system_ip_forwarding(self): - """ Test if IPv4 forwarding can be disabled globally, default is '1' - which means forwearding enabled """ + # Test if IPv4 forwarding can be disabled globally, default is '1' + # which means forwearding enabled all_forwarding = '/proc/sys/net/ipv4/conf/all/forwarding' self.assertEqual(read_file(all_forwarding), '1') @@ -43,7 +43,7 @@ class TestSystemIP(unittest.TestCase): self.assertEqual(read_file(all_forwarding), '0') def test_system_ip_multipath(self): - """ test IPv4 multipathing options, options default to off -> '0' """ + # Test IPv4 multipathing options, options default to off -> '0' use_neigh = '/proc/sys/net/ipv4/fib_multipath_use_neigh' hash_policy = '/proc/sys/net/ipv4/fib_multipath_hash_policy' @@ -58,7 +58,8 @@ class TestSystemIP(unittest.TestCase): self.assertEqual(read_file(hash_policy), '1') def test_system_ip_arp_table_size(self): - """ Maximum number of entries to keep in the ARP cache, the default is 8k """ + # Maximum number of entries to keep in the ARP cache, the + # default is 8k gc_thresh3 = '/proc/sys/net/ipv4/neigh/default/gc_thresh3' gc_thresh2 = '/proc/sys/net/ipv4/neigh/default/gc_thresh2' @@ -76,4 +77,4 @@ class TestSystemIP(unittest.TestCase): self.assertEqual(read_file(gc_thresh1), str(size // 8)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_system_lcd.py b/smoketest/scripts/cli/test_system_lcd.py index 9385799b0..2bf601e3b 100755 --- a/smoketest/scripts/cli/test_system_lcd.py +++ b/smoketest/scripts/cli/test_system_lcd.py @@ -52,4 +52,4 @@ class TestSystemLCD(unittest.TestCase): self.assertTrue(process_named_running('LCDd')) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_system_login.py b/smoketest/scripts/cli/test_system_login.py index d3324b8aa..6188cf38b 100755 --- a/smoketest/scripts/cli/test_system_login.py +++ b/smoketest/scripts/cli/test_system_login.py @@ -43,7 +43,7 @@ class TestSystemLogin(unittest.TestCase): del self.session def test_local_user(self): - """ Check if user can be created and we can SSH to localhost """ + # Check if user can be created and we can SSH to localhost self.session.set(['service', 'ssh', 'port', '22']) for user in users: @@ -69,7 +69,7 @@ class TestSystemLogin(unittest.TestCase): self.assertTrue(len(stdout) > 40) def test_radius_kernel_features(self): - """ T2886: RADIUS requires some Kernel options to be present """ + # T2886: RADIUS requires some Kernel options to be present kernel = platform.release() kernel_config = read_file(f'/boot/config-{kernel}') @@ -83,7 +83,7 @@ class TestSystemLogin(unittest.TestCase): self.assertIn(f'{option}=y', kernel_config) def test_radius_config(self): - """ Verify generated RADIUS configuration files """ + # Verify generated RADIUS configuration files radius_key = 'VyOSsecretVyOS' radius_server = '172.16.100.10' @@ -131,4 +131,4 @@ class TestSystemLogin(unittest.TestCase): self.assertTrue(tmp) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_system_nameserver.py b/smoketest/scripts/cli/test_system_nameserver.py index 9040be072..5610c90c7 100755 --- a/smoketest/scripts/cli/test_system_nameserver.py +++ b/smoketest/scripts/cli/test_system_nameserver.py @@ -41,8 +41,8 @@ class TestSystemNameServer(unittest.TestCase): del self.session - def test_add_server(self): - """ Check if server is added to resolv.conf """ + def test_nameserver_add(self): + # Check if server is added to resolv.conf for s in test_servers: self.session.set(base_path + [s]) self.session.commit() @@ -51,8 +51,8 @@ class TestSystemNameServer(unittest.TestCase): for s in servers: self.assertTrue(s in servers) - def test_delete_server(self): - """ Test if a deleted server disappears from resolv.conf """ + def test_nameserver_delete(self): + # Test if a deleted server disappears from resolv.conf for s in test_servers: self.session.delete(base_path + [s]) self.session.commit() @@ -62,5 +62,5 @@ class TestSystemNameServer(unittest.TestCase): self.assertTrue(test_server_1 not in servers) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_system_ntp.py b/smoketest/scripts/cli/test_system_ntp.py index e2744c936..7d1bc144f 100755 --- a/smoketest/scripts/cli/test_system_ntp.py +++ b/smoketest/scripts/cli/test_system_ntp.py @@ -48,7 +48,7 @@ class TestSystemNTP(unittest.TestCase): del self.session def test_ntp_options(self): - """ Test basic NTP support with multiple servers and their options """ + # Test basic NTP support with multiple servers and their options servers = ['192.0.2.1', '192.0.2.2'] options = ['noselect', 'preempt', 'prefer'] ntp_pool = 'pool.vyos.io' @@ -76,7 +76,7 @@ class TestSystemNTP(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) def test_ntp_clients(self): - """ Test the allowed-networks statement """ + # Test the allowed-networks statement networks = ['192.0.2.0/24', '2001:db8:1000::/64'] for network in networks: self.session.set(base_path + ['allow-clients', 'address', network]) @@ -109,4 +109,4 @@ class TestSystemNTP(unittest.TestCase): self.assertTrue(process_named_running(PROCESS_NAME)) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_vpn_openconnect.py b/smoketest/scripts/cli/test_vpn_openconnect.py index 2ba6aabf9..e27216e09 100755 --- a/smoketest/scripts/cli/test_vpn_openconnect.py +++ b/smoketest/scripts/cli/test_vpn_openconnect.py @@ -53,4 +53,4 @@ class TestVpnOpenconnect(unittest.TestCase): self.assertTrue(process_named_running('ocserv-main')) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_vpn_sstp.py b/smoketest/scripts/cli/test_vpn_sstp.py index 9babb83dc..95fe38dd9 100755 --- a/smoketest/scripts/cli/test_vpn_sstp.py +++ b/smoketest/scripts/cli/test_vpn_sstp.py @@ -59,4 +59,4 @@ if __name__ == '__main__': f'-subj {subject}' cmd(tmp) - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/cli/test_vrf.py b/smoketest/scripts/cli/test_vrf.py index efa095b30..d8ed46f0b 100755 --- a/smoketest/scripts/cli/test_vrf.py +++ b/smoketest/scripts/cli/test_vrf.py @@ -49,4 +49,4 @@ class VRFTest(unittest.TestCase): self.session.commit() if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/system/test_kernel_options.py b/smoketest/scripts/system/test_kernel_options.py index 043567c4f..4d9cbacbe 100755 --- a/smoketest/scripts/system/test_kernel_options.py +++ b/smoketest/scripts/system/test_kernel_options.py @@ -29,13 +29,13 @@ class TestKernelModules(unittest.TestCase): available in the Kernel that is run. """ def test_bond_interface(self): - """ The bond/lacp interface must be enabled in the OS Kernel """ + # The bond/lacp interface must be enabled in the OS Kernel for option in ['CONFIG_BONDING']: tmp = re.findall(f'{option}=(y|m)', config) self.assertTrue(tmp) def test_bridge_interface(self): - """ The bridge interface must be enabled in the OS Kernel """ + # The bridge interface must be enabled in the OS Kernel for option in ['CONFIG_BRIDGE', 'CONFIG_BRIDGE_IGMP_SNOOPING', 'CONFIG_BRIDGE_VLAN_FILTERING']: @@ -43,7 +43,7 @@ class TestKernelModules(unittest.TestCase): self.assertTrue(tmp) def test_qemu_support(self): - """ The bond/lacp interface must be enabled in the OS Kernel """ + # The bond/lacp interface must be enabled in the OS Kernel for option in ['CONFIG_VIRTIO_BLK', 'CONFIG_SCSI_VIRTIO', 'CONFIG_VIRTIO_NET', 'CONFIG_VIRTIO_CONSOLE', 'CONFIG_VIRTIO', 'CONFIG_VIRTIO_PCI', @@ -53,11 +53,11 @@ class TestKernelModules(unittest.TestCase): self.assertTrue(tmp) def test_vmware_support(self): - """ The bond/lacp interface must be enabled in the OS Kernel """ + # The bond/lacp interface must be enabled in the OS Kernel for option in ['CONFIG_VMXNET3']: tmp = re.findall(f'{option}=(y|m)', config) self.assertTrue(tmp) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) diff --git a/smoketest/scripts/system/test_module_load.py b/smoketest/scripts/system/test_module_load.py index c3cf0ff92..c781e0199 100755 --- a/smoketest/scripts/system/test_module_load.py +++ b/smoketest/scripts/system/test_module_load.py @@ -40,4 +40,4 @@ class TestKernelModules(unittest.TestCase): self.assertTrue(success) if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) |