Beispiel #1
0
def test_v4_options_malformed_values_arp_cache_timeout():

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('arp-cache-timeout', '-1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('arp-cache-timeout', '4294967296')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('arp-cache-timeout', '0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('arp-cache-timeout', '4294967295')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
def test_v4_options_user_custom_option_using_standard_code():
    # This test it's kind of hack, to override scapy v4 restrictions.
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.10')
    srv_control.config_srv_custom_opt('foo', '12', 'uint8', '123')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #3
0
def test_v4_options_malformed_values_default_tcp_ttl():

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('default-tcp-ttl', '0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('default-tcp-ttl', '256')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('default-tcp-ttl', '255')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('default-tcp-ttl', '1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #4
0
def test_v6_options_inforequest_sip_servers_csv_incorrect_hex():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.add_line('"option-data": [{"code": 6, "data": "31 39 32 2x 31 30 2e 30 2e 31",'
                         ' "always-send": true, "csv-format": false}]')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configure')
Beispiel #5
0
def test_v6_options_inforequest_sip_servers_csv_incorrect():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.add_line({"option-data": [{"code": 6, "data": "192.167.12.2",
                                           "always-send": True, "csv-format": False}]})
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configure')
Beispiel #6
0
def test_v6_values_address2():

    misc.test_setup()
    srv_control.config_srv_subnet('::/64', '::1-::1')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')

    references.references_check('RFC3315')
Beispiel #7
0
def test_v6_values_address2():

    misc.test_setup()
    srv_control.config_srv_subnet('::/64', '::1-::1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    references.references_check('RFC3315')
Beispiel #8
0
def test_v4_options_user_custom_option_using_standard_code():
    # This test it's kind of hack, to override scapy v4 restrictions.
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_custom_opt('foo', '12', 'uint8', '123')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #9
0
def test_v6_host_reservation_duplicate_reservation():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10')
    srv_control.host_reservation_in_subnet('address', '3000::1', '0', 'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.host_reservation_in_subnet('address', '3000::2', '0', 'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
def test_v4_host_reservation_conflicts_duplicate_reservations():
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.50')
    srv_control.host_reservation_in_subnet('address', '192.168.50.10', '0',
                                           'hw-address', 'ff:01:02:03:ff:04')
    srv_control.host_reservation_in_subnet('address', '192.168.50.12', '0',
                                           'hw-address', 'ff:01:02:03:ff:04')
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #11
0
def test_v4_options_domain_name_servers_csv_incorrect_address():
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.add_line(
        '"option-data": [{"code": 6, "data": "199.0.2.1", "csv-format": false}]'
    )
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configure')
Beispiel #12
0
def test_v6_values_address1():
    # that test will probably fail in step 'server is configured in case servers like ISC-DHCPv6, OS wont assign multicast address

    misc.test_setup()
    srv_control.config_srv_subnet('ff02::/64', 'ff02::1-ff02::ff')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    references.references_check('RFC3315')
Beispiel #13
0
def test_v6_values_address1():
    # that test will probably fail in step 'server is configured in case servers like ISC-DHCPv6, OS wont assign multicast address

    misc.test_setup()
    srv_control.config_srv_subnet('ff02::/64', 'ff02::1-ff02::ff')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')

    references.references_check('RFC3315')
def test_v6_relay_interface_local_and_relay_interface_in_the_same_subnet():

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::10')
    srv_control.add_line_to_subnet('0', ',"relay": {"ip-address": "3000::1005"}')
    srv_control.add_line_to_subnet('0', ',"interface":"$(SERVER_IFACE)"')
    srv_control.set_conf_parameter_subnet('interface-id', '"abc"', '0')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')

    references.references_check('Kea')
def test_user_check_IA_NA_no_registry():
    # Without a user registry and multiple subnets
    # Subnet selection will use subnet interface for subnet selection hint

    misc.test_setup()
    srv_msg.remove_file_from_server('/tmp/user_chk_registry.txt')
    srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
    srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.5-192.168.50.5')
    srv_control.config_srv_another_subnet_no_interface('10.0.0.0/24', '10.0.0.5-10.0.0.5')
    srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_user_chk.so')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #16
0
def test_user_check_hook_IA_NA_no_registry():
    # Without a user registry and multiple subnets
    # Subnet selection will use subnet interface for subnet selection hint

    misc.test_setup()
    srv_msg.remove_file_from_server('/tmp/user_chk_registry.txt')
    srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
    srv_control.config_srv_subnet('3000::/64', '3000::5-3000::5')
    srv_control.config_srv_another_subnet_no_interface('1000::/64',
                                                       '1000::5-1000::5')
    srv_control.add_hooks('libdhcp_user_chk.so')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')
def test_v6_relay_interface_local_and_relay_interface_in_the_same_subnet():

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:1::/64',
                                  '2001:db8:1::1-2001:db8:1::10')
    srv_control.add_line_to_subnet('0',
                                   ',"relay": {"ip-address": "3000::1005"}')
    srv_control.add_line_to_subnet('0', ',"interface":"$(SERVER_IFACE)"')
    srv_control.set_conf_parameter_subnet('interface-id', '"abc"', '0')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')

    references.references_check('Kea')
Beispiel #18
0
def test_v4_host_reservation_hostname_duplicated_entries():
    misc.test_setup()
    # outside of the pool
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.30-192.168.50.30')
    srv_control.add_ddns_server('127.0.0.1', '53001')
    srv_control.add_ddns_server_options('enable-updates', 'true')
    srv_control.add_ddns_server_options('qualifying-suffix', 'my.domain.com')
    srv_control.host_reservation_in_subnet('hostname', 'reserved-name', '0',
                                           'hw-address', 'ff:01:02:03:ff:04')
    srv_control.host_reservation_in_subnet('hostname', 'resderved-name', '0',
                                           'hw-address', 'ff:01:02:03:ff:04')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
def test_user_check_hook_IA_NA_no_registry_logging():
    # Without a user registry and multiple subnets
    # Subnet selection will use subnet interface for subnet selection hint

    misc.test_setup()
    srv_msg.remove_file_from_server('/tmp/user_chk_registry.txt')
    srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
    srv_control.config_srv_subnet('3000::/64', '3000::5-3000::5')
    srv_control.config_srv_another_subnet_no_interface('1000::/64', '1000::5-1000::5')
    srv_control.configure_loggers('kea-dhcp6.callouts', 'ERROR', 'None', 'kea.log')
    srv_control.configure_loggers('kea-dhcp6.hooks', 'ERROR', 'None', 'kea.log')
    srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_user_chk.so')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
def test_v4_host_reservation_conflicts_duplicate_reservations():
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.50')
    srv_control.host_reservation_in_subnet('address',
                                           '192.168.50.10',
                                           '0',
                                           'hw-address',
                                           'ff:01:02:03:ff:04')
    srv_control.host_reservation_in_subnet('address',
                                           '192.168.50.12',
                                           '0',
                                           'hw-address',
                                           'ff:01:02:03:ff:04')
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #21
0
def test_v4_options_malformed_values_time_offset():

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('time-offset', '-2147483649')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('time-offset', '-2147483648')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('time-offset', '2147483647')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('time-offset', '2147483648')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('time-offset', '50')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('time-offset', '0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #22
0
def test_v4_options_malformed_values_subnet_mask():

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('subnet-mask', '255.255.266.0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('subnet-mask', '255.255.255.0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #23
0
def test_v6_host_reservation_conflicts_duplicate_duid_reservations():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10')
    srv_control.host_reservation_in_subnet(
        'ip-address', '3000::1', 0, 'duid',
        '00:03:00:01:f6:f5:f4:f3:f2:01')  # the same DUID
    srv_control.host_reservation_in_subnet(
        'ip-address', '3000::2', 0, 'duid',
        '00:03:00:01:f6:f5:f4:f3:f2:01')  # the same DUID
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    # expected error logs
    srv_msg.log_contains(r'ERROR \[kea-dhcp6.dhcp6')
    srv_msg.log_contains(r'failed to add new host using the DUID')
def test_v6_host_reservation_duplicate_reservation():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10')
    srv_control.host_reservation_in_subnet('address',
                                           '3000::1',
                                           '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.host_reservation_in_subnet('address',
                                           '3000::2',
                                           '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #25
0
def test_v4_options_malformed_values_ip_forwarding():

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('ip-forwarding', '2')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('ip-forwarding', '1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #26
0
def test_user_check_IA_NA_no_registry_logging():
    # Without a user registry and multiple subnets
    # Subnet selection will use subnet interface for subnet selection hint

    misc.test_setup()
    srv_msg.remove_file_from_server('/tmp/user_chk_registry.txt')
    srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.5-192.168.50.5')
    srv_control.config_srv_another_subnet_no_interface('10.0.0.0/24',
                                                       '10.0.0.5-10.0.0.5')
    srv_control.add_hooks('libdhcp_user_chk.so')
    srv_control.configure_loggers('kea-dhcp4.callouts', 'ERROR', 'None')
    srv_control.configure_loggers('kea-dhcp4.hooks', 'ERROR', 'None')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #27
0
def test_v6_relay_interface_local_and_relay_interface_in_the_same_subnet():

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:1::/64',
                                  '2001:db8:1::1-2001:db8:1::10')
    world.dhcp_cfg["subnet6"][0].update({
        "interface-id": "abc",
        "interface": '$(SERVER_IFACE)',
        "relay": {
            "ip-address": "3000::1005"
        }
    })
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    references.references_check('Kea')
Beispiel #28
0
def test_v4_options_malformed_values_pool():

    misc.test_setup()
    srv_control.config_srv_subnet('256.0.2.0/24', '256.0.2.1-256.0.2.10')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    # Test Setup:
    # Server is configured with 127.0.0.1/24 subnet with 127.0.0.1-127.0.0.1 pool.
    # Send server configuration using SSH and config-file.
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #29
0
def test_v6_options_user_defined_option_standard_code():
    #  Testing server ability to configure it with user custom option
    #  in this case: option code 100, value unit8 123.
    #  with client via Advertise and Reply message.
    #  					Client		Server
    #  request option	SOLICIT -->
    #  custom option 			<--	ADVERTISE
    #  request option	REQUEST -->
    #  custom option			<--	REPLY
    #  Pass Criteria:
    #  				REPLY/ADVERTISE MUST include option:
    # 					custom option with value 123

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_custom_opt('foo', 12, 'uint8', 123)
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')
def test_v4_host_reservation_hostname_duplicated_entries():
    misc.test_setup()
    # outside of the pool
    srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.30-192.168.50.30')
    srv_control.add_ddns_server('127.0.0.1', '53001')
    srv_control.add_ddns_server_options('enable-updates', 'true')
    srv_control.add_ddns_server_options('qualifying-suffix', 'my.domain.com')
    srv_control.host_reservation_in_subnet('hostname',
                                           'reserved-name',
                                           '0',
                                           'hw-address',
                                           'ff:01:02:03:ff:04')
    srv_control.host_reservation_in_subnet('hostname',
                                           'resderved-name',
                                           '0',
                                           'hw-address',
                                           'ff:01:02:03:ff:04')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')
Beispiel #31
0
def test_v4_host_reservation_conflicts_duplicate_mac_reservations(backend):
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.50')
    if backend == 'memfile':
        srv_control.host_reservation_in_subnet(
            'ip-address', '192.168.50.10', 0, 'hw-address',
            'ff:01:02:03:ff:04')  # the same MAC address
        srv_control.host_reservation_in_subnet(
            'ip-address', '192.168.50.12', 0, 'hw-address',
            'ff:01:02:03:ff:04')  # the same MAC address
        srv_control.build_and_send_config_files()
        srv_control.start_srv_during_process('DHCP', 'configuration')

        # expected error logs
        srv_msg.log_contains(r'ERROR \[kea-dhcp4.dhcp4')
        srv_msg.log_contains(r'failed to add new host using the HW address')
    else:
        srv_control.add_hooks('libdhcp_host_cmds.so')
        srv_control.open_control_channel()
        srv_control.dump_db_reservation(backend)
        srv_control.new_db_backend_reservation(backend, 'hw-address',
                                               'ff:01:02:03:ff:11')
        srv_control.update_db_backend_reservation('hostname',
                                                  'reserved-hostname', backend,
                                                  1)
        srv_control.update_db_backend_reservation('ipv4_address',
                                                  '192.168.50.2', backend, 1)
        srv_control.update_db_backend_reservation('dhcp4_subnet_id', 1,
                                                  backend, 1)

        srv_control.new_db_backend_reservation(backend, 'hw-address',
                                               'ff:01:02:03:ff:11')
        srv_control.update_db_backend_reservation('hostname',
                                                  'reserved-hostname', backend,
                                                  2)
        srv_control.update_db_backend_reservation('ipv4_address',
                                                  '192.168.50.3', backend, 2)
        srv_control.update_db_backend_reservation('dhcp4_subnet_id', 1,
                                                  backend, 2)

        # expect failure due to db constrain on unique hw-address
        srv_control.upload_db_reservation(backend, exp_failed=True)
Beispiel #32
0
def test_v4_host_reservation_conflicts_duplicate_ip_reservations():
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.50')
    srv_control.host_reservation_in_subnet(
        'ip-address',
        '192.168.50.10',  # the same IP address
        0,
        'hw-address',
        'aa:aa:aa:aa:aa:aa')
    srv_control.host_reservation_in_subnet(
        'ip-address',
        '192.168.50.10',  # the same IP address
        0,
        'hw-address',
        'bb:bb:bb:bb:bb:bb')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')
    # expected error logs
    srv_msg.log_contains(r'ERROR \[kea-dhcp4.dhcp4')
    srv_msg.log_contains(r'failed to add new host using the HW address')
Beispiel #33
0
def test_v4_options_malformed_values_dhcp_option_overload():

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('dhcp-option-overload', '0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('dhcp-option-overload', '4')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('dhcp-option-overload', '1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('dhcp-option-overload', '2')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('dhcp-option-overload', '3')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #34
0
def test_v4_options_malformed_values_static_routes():
    # pair of addresses 0.0.0.0 forbidden

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('static-routes', '199.199.199.1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('static-routes',
                               '199.199.199.1,70.70.70.5,80.80.80.80')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('static-routes', '199.199.199.1,0.0.0.0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt(
        'static-routes', '199.199.199.1,70.70.70.5,80.80.80.80,10.10.10.5')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #35
0
def test_v4_options_malformed_values_boot_size():

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('boot-size', '65536')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('boot-size', '-1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('boot-size', '655')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #36
0
def test_v4_options_malformed_values_policy_filter():
    # Allowed only pairs of addresses
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('policy-filter', '199.199.199.1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('policy-filter',
                               '199.199.199.1,50.50.50.1,60.60.60.5')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('policy-filter', '199.199.199.1,50.50.50.1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #37
0
def test_v6_host_reservation_conflicts_duplicate_ip_reservations():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10')
    srv_control.host_reservation_in_subnet(
        'ip-address',
        '3000::1',  # the same IP address
        0,
        'duid',
        '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.host_reservation_in_subnet(
        'ip-address',
        '3000::1',  # the same IP address
        0,
        'duid',
        '00:03:00:01:f6:f5:f4:f3:f2:02')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    # expected error logs
    srv_msg.log_contains(r'ERROR \[kea-dhcp6.dhcp6')
    srv_msg.log_contains(
        r'failed to add address reservation for host using the HW address')
    srv_msg.log_contains(
        r"There's already reservation for this address/prefix")
Beispiel #38
0
def test_v4_options_malformed_values_max_dgram_reassembly():
    # Unsigned integer (0 to 65535) minimum value: 576

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('max-dgram-reassembly', '-1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('max-dgram-reassembly', '0')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('max-dgram-reassembly', '575')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('max-dgram-reassembly', '65536')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('max-dgram-reassembly', '576')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('max-dgram-reassembly', '65535')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
Beispiel #39
0
def test_v4_options_malformed_values_path_mtu_aging_timeout():
    # Unsigned integer (0 to 65535) minimum: 68

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('path-mtu-aging-timeout', '67')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('path-mtu-aging-timeout', '-1')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('path-mtu-aging-timeout', '65536')
    srv_control.build_and_send_config_files()
    srv_control.start_srv_during_process('DHCP', 'configuration')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('path-mtu-aging-timeout', '65535')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    srv_control.start_srv('DHCP', 'stopped')

    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24',
                                  '192.168.50.1-192.168.50.10')
    srv_control.config_srv_opt('path-mtu-aging-timeout', '68')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')
def test_v4_options_domain_name_servers_csv_incorrect_address():
    misc.test_setup()
    srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.10')
    srv_control.add_line('"option-data": [{"code": 6, "data": "199.0.2.1", "csv-format": false}]')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configure')
Beispiel #41
0
def test_v6_rapid_commit_as_global_parameter():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.set_conf_parameter_global('rapid-commit', 'true')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv_during_process('DHCP', 'configuration')