def test_v6_server_id_ll(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_id('LL', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_option_content('Response', '2', None, 'duid', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_option_content('Response', '1', 'NOT ', 'duid', '00:03:00:01:ff:ff:ff:ff:ff:01')
def test_v6_host_reservation_conflicts_two_entries_for_one_host_different_subnets(): misc.test_setup() srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10') srv_control.config_srv_another_subnet_no_interface('3001::/30', '3001::1-3001::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::3', '1', 'hw-address', 'f6:f5:f4:f3:f2:01') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
def test_v6_stateless_with_subnet_empty_pool_inforequest(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '$(EMPTY)') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.config_srv_opt('nis-servers', '2001:db8::abc,3000::1,2000::1234') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_requests_option('27') srv_msg.client_requests_option('24') srv_msg.client_requests_option('7') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('INFOREQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '27') srv_msg.response_check_option_content('Response', '27', None, 'addresses', '2001:db8::abc,3000::1,2000::1234') srv_msg.response_check_include_option('Response', None, '24') srv_msg.response_check_option_content('Response', '24', None, 'domains', 'domain1.example.com.,domain2.isc.org.') srv_msg.response_check_include_option('Response', None, '7') srv_msg.response_check_option_content('Response', '7', None, 'prefval', '123')
def test_user_check_hook_IA_NA_with_registry_known_user(): # With a user registry and multiple subnets # an known user should get first subnet misc.test_setup() srv_msg.send_file_to_server('tests/dhcpv6/kea_only/user_chk/registry_1.txt', '/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('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_user_chk.so') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() # Send a query from a registered user srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:11:02:03:04:05:06') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::5') # Check the outcome file for correct content srv_msg.copy_remote('/tmp/user_chk_outcome.txt') srv_msg.compare_file('tests/dhcpv6/kea_only/user_chk/outcome_2.txt')
def test_v6_mac_in_dhcp6_docsis_modem(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.run_command('"mac-sources": [ "docsis-modem" ]') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'enterprisenum', '4491') srv_msg.client_does_include('Client', None, 'vendor-class') srv_msg.add_vendor_suboption('Client', '36', 'f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'vendor-specific-info') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv', None, ',f6:f5:f4:f3:f2:01') srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea.log', None, 'Hardware addr: f6:f5:f4:f3:f2:01')
def test_v6_host_reservation_mysql_duid_llt_matching(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.enable_db_backend_reservation('MySQL') srv_control.new_db_backend_reservation('MySQL', 'duid', '00:01:00:01:52:7b:a8:f0:f6:f5:f4:f3:f2:01') # Create new MySQL reservation identified by hw-address f6:f5:f4:f3:f2:01. srv_control.update_db_backend_reservation('dhcp6_subnet_id', '1', 'MySQL', '1') srv_control.ipv6_address_db_backend_reservation('3000::100', '$(EMPTY)', 'MySQL', '1') srv_control.upload_db_reservation('MySQL') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:01:00:01:52:7b:a8:f0:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::100')
def test_v6_client_classification_onesubnet_docsis3_request_success(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::1') srv_control.config_client_classification('0', 'VENDOR_CLASS_docsis3.0') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'vendor_class_data', 'docsis3.0') srv_msg.client_does_include('Client', None, 'vendor-class') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'vendor_class_data', 'docsis3.0') srv_msg.client_does_include('Client', None, 'vendor-class') srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::1')
def send_decline6(): misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('DECLINE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY')
def test_hook_v6_lease_cmds_get_using_address(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1') srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket') srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '2001:db8:1::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:11:22:33:44:55:66') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', '{"command":"lease6-get","arguments":{"ip-address": "2001:db8:1::1"}}')
def test_v6_relay_interface_two_subnets_direct_client(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1') srv_control.set_conf_parameter_subnet('interface-id', '"abc"', '0') srv_control.config_srv_another_subnet_no_interface('2001:db8:2::/64', '2001:db8:2::1-2001:db8:2::10') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') srv_msg.client_sets_value('RelayAgent', 'ifaceid', 'xyz') srv_msg.client_does_include('RelayAgent', None, 'interface-id') srv_msg.create_relay_forward() misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'RELAYREPLY') srv_msg.response_check_include_option('Response', None, '18') srv_msg.response_check_include_option('Response', None, '9') srv_msg.response_check_option_content('Response', '9', None, 'Relayed', 'Message') srv_msg.response_check_include_option('Relayed Message', None, '1') srv_msg.response_check_include_option('Relayed Message', None, '2') srv_msg.response_check_include_option('Relayed Message', None, '3') srv_msg.response_check_option_content('Relayed Message', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Relayed Message', '13', '3', None, 'statuscode', '2') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', 'NOT ', 'addr', '2001:db8:1::1') references.references_check('Kea')
def test_v6_host_reservation_mysql_all_values_duid_2(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_prefix('3001::', '0', '32', '33') srv_control.enable_db_backend_reservation('MySQL') srv_control.new_db_backend_reservation('MySQL', 'duid', '00:01:00:01:52:7b:a8:f0:f6:f5:f4:f3:f2:01') srv_control.update_db_backend_reservation('hostname', 'reserved-hostname', 'MySQL', '1') srv_control.update_db_backend_reservation('dhcp6_subnet_id', '1', 'MySQL', '1') srv_control.ipv6_prefix_db_backend_reservation('3001::', '40', '$(EMPTY)', 'MySQL', '1') srv_control.ipv6_address_db_backend_reservation('3000::100', '$(EMPTY)', 'MySQL', '1') srv_control.upload_db_reservation('MySQL') 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.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:01:00:01:52:7b:a8:f0:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('IA_PD') srv_msg.client_sets_value('Client', 'DUID', '00:01:00:01:52:7b:a8:f0:f6:f5:f4:f3:f2:01') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'some-different-name') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', None, 'fqdn') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::100') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') srv_msg.response_check_suboption_content('Response', '26', '25', None, 'prefix', '3001::') srv_msg.response_check_include_option('Response', None, '39') srv_msg.response_check_option_content('Response', '39', None, 'fqdn', 'reserved-hostname.my.domain.com.')
def test_prefix_delegation_release_nobinding2(): misc.test_setup() srv_control.config_srv_subnet('3000::/32', '3000::1-3000::2') srv_control.config_srv_prefix('2001:db8:1::', '0', '32', '33') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '25') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_save_option('IA_PD') srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RELEASE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') # must not contain status code == 3. misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RELEASE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '25', None, 'statuscode', '3') references.references_check('RFC')
def test_hook_v6_network_cmds_add_on_relay_addr(): misc.test_setup() srv_control.config_srv_subnet('$(EMPTY)', '$(EMPTY)') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket') srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_subnet_cmds.so') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', '{"command":"network6-add","arguments":{"shared-networks":[{"name": "name-abc","relay":{"ip-address":"2001:db8::abcd"},"preferred-lifetime": 3000,"rebind-timer": 2000,"renew-timer": 1000,"valid-lifetime": 4000,"subnet6":[{"id":1,"pools": [{"pool": "2001:db8:1::1-2001:db8:1::10"}],"preferred-lifetime": 3000,"rebind-timer": 2000,"renew-timer": 1000,"reservation-mode": "all","subnet": "2001:db8:1::/64","valid-lifetime": 4000}]}]}}') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', '{"command":"network6-get","arguments":{"name": "name-abc"}}') srv_msg.forge_sleep('5', 'seconds') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') srv_msg.client_sets_value('RelayAgent', 'ifaceid', 'interface-abc') srv_msg.client_does_include('RelayAgent', None, 'interface-id') srv_msg.client_sets_value('RelayAgent', 'linkaddr', '2001:db8::abcd') srv_msg.create_relay_forward() misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'RELAYREPLY') srv_msg.response_check_include_option('Response', None, '18') srv_msg.response_check_include_option('Response', None, '9') srv_msg.response_check_option_content('Response', '9', None, 'Relayed', 'Message') srv_msg.response_check_include_option('Relayed Message', None, '1') srv_msg.response_check_include_option('Relayed Message', None, '2') srv_msg.response_check_include_option('Relayed Message', None, '3') srv_msg.response_check_option_content('Relayed Message', '3', None, 'sub-option', '5')
def test_v6_IPXE_1(): misc.test_setup() srv_control.config_srv_subnet('2001:db8::/64', '$(EMPTY)') srv_control.create_new_class('a-ipxe') srv_control.add_test_to_class('1', 'test', 'substring(option[15].hex,2,4) == \'iPXE\'') srv_control.add_option_to_defined_class('1', 'bootfile-url', 'http://[2001:db8::1]/ubuntu.cfg') # Server is configured with client-classification option in subnet 0 with name a-ipxe. srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'archtypes', '7') srv_msg.client_does_include('Client', None, 'client-arch-type') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_sets_value('Client', 'user_class_data', 'iPXE') srv_msg.client_does_include('Client', None, 'user-class') srv_msg.client_requests_option('59') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '59') srv_msg.response_check_option_content('Response', '59', None, 'optdata', 'http://[2001:db8::1]/ubuntu.cfg') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2')
def test_prefix_delegation_IA_and_PD_renew_nobindig(): # this tests will be disabled after RFC 7550 tests will be added misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::3') srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '92') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RENEW') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') # Response sub-option 13 from option 25 MUST contain statuscode 3. changed after rfc7550 srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '3') references.references_check('RFC')
def test_v6_basic_message_unicast_local_solicit(): # Server MUST discard any Solicit it receives with # a unicast address destination # Message details Client Server # LINK_LOCAL_UNICAST dest SOLICIT --> # X ADVERTISE # correct message SOLICIT --> # <-- ADVERTISE misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_requests_option('7') srv_msg.unicast_addres(None, 'LINK_LOCAL') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_dont_wait_for_message() misc.test_procedure() srv_msg.client_requests_option('7') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') references.references_check('RFC3315')
def test_v6_host_reservation_duid_hostname_without_ddns(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.host_reservation_in_subnet('hostname', 'reserved-hostname', '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('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'some-different-name') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', None, 'fqdn') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '39') srv_msg.response_check_option_content('Response', '39', None, 'fqdn', 'reserved-hostname.')
def test_v6_statuscode_nobinding_release_nobinding(): # Testing server ability server ability perform RELEASE - REPLY message exchange. # Message details Client Server # SOLICIT --> # <-- ADVERTISE # REQUEST --> # <-- REPLY # Clear leases by restarting server # RELEASE --> # <-- REPLY # Pass Criteria: # REPLY MUST include option: # client-id # server-id # IA_NA with suboption status-code with code NoBinding misc.test_setup() srv_control.set_time('renew-timer', '5') srv_control.set_time('rebind-timer', '6') srv_control.set_time('preferred-lifetime', '7') srv_control.set_time('valid-lifetime', '8') srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.forge_sleep('10', 'seconds') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RELEASE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '3') references.references_check('RFC3315')
def test_v6_relay_message_decline_reply(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_requests_option('7') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('DECLINE') srv_msg.client_does_include('RelayAgent', None, 'interface-id') srv_msg.create_relay_forward() misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'RELAYREPLY') srv_msg.response_check_include_option('Response', None, '18') srv_msg.response_check_include_option('Response', None, '9') # Response MUST include REPLY message. references.references_check('RFC3315')
def test_prefix_delegation_IA_and_PD_confirm(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::2-3000::2') srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') srv_msg.response_check_suboption_content('Response', '26', '25', None, 'prefix', '2001:db8:1::') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::2') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('IA_PD') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('IA_PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('CONFIRM') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', 'NOT ', '25') references.references_check('RFC')
def test_v6_message_rebind_reply_newtime(): # Testing server ability server ability perform REBIND - REPLY message exchange. # Additional server configuration: # renew-timer = 111 # rebind-timer = 222 # Message details Client Server # SOLICIT --> # <-- ADVERTISE # REQUEST --> # <-- REPLY # correct message REBIND --> # <-- REPLY # Pass Criteria: # REPLY MUST include option: # client-id # server-id # IA-NA (with time T1 = 111 T2 = 222) # IA-Address misc.test_setup() srv_control.set_time('renew-timer', '111') srv_control.set_time('rebind-timer', '222') srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REBIND') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_option_content('Response', '3', None, 'T1', '111') srv_msg.response_check_option_content('Response', '3', None, 'T2', '222') references.references_check('RFC3315')
def test_prefix_delegation_IA_and_PD_renew(): # this tests will be disabled after RFC 7550 tests will be added misc.test_setup() # Server is configured with 3000::/64 subnet with 3000::1-3000::3 pool. srv_control.config_srv_subnet('3000::/64', '3000::ffff:ffff:1-3000::ffff:ffff:3') srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '92') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_save_option('IA_PD') srv_msg.client_add_saved_option(None) srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('RENEW') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'validlft', '4000') references.references_check('RFC')
def test_prefix_delegation_IA_and_PD_request_release(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::3') srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '91') # pool of two prefixes srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '25') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_PD') srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_copy_option('IA_PD') srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RELEASE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_include_option('Response', None, '3') # tests MUST NOT include 'NoBinding'... references.references_check('RFC')
def test_v6_message_renew_reply(): # Testing server ability to perform message exchange RENEW - REPLY # Message details Client Server # SOLICIT --> # <-- ADVERTISE # REQUEST --> # <-- REPLY # correct message RENEW --> # <-- REPLY # Pass Criteria: # REPLY MUST include option: # client-id # server-id # IA-NA with suboption IA-Address # misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::5-3000::55') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RENEW') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') references.references_check('RFC')
def test_v4_host_reservation_hostname_fqdn_option(): misc.test_setup() 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.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', None, 'fqdn') srv_msg.client_send_msg('DISCOVER') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'OFFER') srv_msg.response_check_include_option('Response', None, '81') srv_msg.response_check_option_content('Response', '81', None, 'fqdn', 'reserved-name.my.domain.com.') misc.test_procedure() srv_msg.client_copy_option('server_id') srv_msg.client_does_include_with_value('requested_addr', '192.168.50.30') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', None, 'fqdn') srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ACK') srv_msg.response_check_include_option('Response', None, '81') srv_msg.response_check_option_content('Response', '81', None, 'fqdn', 'reserved-name.my.domain.com.')
def test_hook_v6_lease_cmds_add_valid_with_options(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket') srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '2001:db8:1::1') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', '{"command": "lease6-add","arguments": {"subnet-id": 1,"ip-address": "2001:db8:1::1","duid": "1a:1b:1c:1d:1e:1f:20:21:22:23:24","iaid": 1234,"hw-address": "1a:2b:3c:4d:5e:6f","preferred-lft": 500,"valid-lft": 11111,"fqdn-fwd": true,"fqdn-rev": true,"hostname": "urania.example.org"}}') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2') srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv', None, '1a:2b:3c:4d:5e:6f') srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv', None, '1a:1b:1c:1d:1e:1f:20:21:22:23:24') srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv', None, '11111') srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv', None, 'urania.example.org')
def test_hook_v6_lease_cmds_legal_logging_add(): misc.test_procedure() srv_msg.remove_file_from_server('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-legal*.txt') misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket') srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so') srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_legal_log.so') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '2001:db8:1::1') srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket', '{"command": "lease6-add","arguments": {"subnet-id": 1,"ip-address": "2001:db8:1::1","duid": "1a:1b:1c:1d:1e:1f:20:21:22:23:24","iaid": 1234}}') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2') srv_msg.copy_remote('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-legal*.txt') srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-legal*.txt', None, 'Administrator added a lease of address: 2001:db8:1::1 to a device with DUID: 1a:1b:1c:1d:1e:1f:20:21:22:23:24')
def test_v6_basic_message_information_request_reply(): # Basic message test, testing only server ability to respond with 'REPLY' # to received 'INFOREQUEST'. Without testing content of a message. misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_requests_option('7') srv_msg.client_send_msg('INFOREQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') references.references_check('RFC3315')
def test_v6_server_id_en(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_id('EN', '00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '2') # Response option 2 MUST contain duid 00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45. srv_msg.response_check_include_option('Response', None, '1')
def test_v6_client_classification_onesubnet_advertise_fail(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::1') srv_control.config_client_classification('0', 'VENDOR_CLASS_firstclass') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2')
def test_v6_host_reservation_duid_requesting_reserved_address_outside_the_pool( ): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::10') srv_control.host_reservation_in_subnet('address', '3000::ff', '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('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', 'NOT ', 'addr', '3000::ff') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::ff')
def test_ddns4_notsig_expire(): misc.test_setup() srv_control.set_time('renew-timer', 8) srv_control.set_time('rebind-timer', 9) srv_control.set_time('valid-lifetime', 10) srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.10-192.168.50.10') 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('generated-prefix', 'four') srv_control.add_ddns_server_options('qualifying-suffix', 'example.com') srv_control.add_forward_ddns('four.example.com.', 'EMPTY_KEY') srv_control.add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') srv_control.use_dns_set_number(20) srv_control.start_srv('DNS', 'started') misc.test_procedure() srv_msg.client_requests_option(1) srv_msg.client_send_msg('DISCOVER') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'OFFER') srv_msg.response_check_include_option(1) srv_msg.response_check_content('yiaddr', '192.168.50.10') srv_msg.response_check_option_content(1, 'value', '255.255.255.0') misc.test_procedure() srv_msg.client_copy_option('server_id') srv_msg.client_does_include_with_value('requested_addr', '192.168.50.10') srv_msg.client_requests_option(1) srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'aa.four.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ACK') srv_msg.response_check_content('yiaddr', '192.168.50.10') srv_msg.response_check_include_option(1) srv_msg.response_check_option_content(1, 'value', '255.255.255.0') srv_msg.response_check_include_option(81) srv_msg.response_check_option_content(81, 'flags', 1) srv_msg.response_check_option_content(81, 'fqdn', 'aa.four.example.com.') misc.test_procedure() srv_msg.dns_question_record('aa.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', '192.168.50.10') srv_msg.dns_option_content('ANSWER', 'rrname', 'aa.four.example.com.') misc.test_procedure() srv_msg.dns_question_record('10.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', 'aa.four.example.com.') srv_msg.dns_option_content('ANSWER', 'rrname', '10.50.168.192.in-addr.arpa.') srv_msg.forge_sleep(10, 'seconds') misc.test_procedure() srv_msg.dns_question_record('aa.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.dns_question_record('10.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False)
def test_v6_host_reservation_all_values_duid_2(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_prefix('2001:db8:1::', 0, 32, 33) srv_control.host_reservation_in_subnet('hostname', 'reserved-hostname', 0, 'duid', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_control.host_reservation_in_subnet_add_value(0, 0, 'ip-address', '3000::100') srv_control.host_reservation_in_subnet_add_value(0, 0, 'prefixes', '2001:db8:1::/40') 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.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:01:00:01:52:7b:a8:f0:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('IA_PD') srv_msg.client_sets_value('Client', 'DUID', '00:01:00:01:52:7b:a8:f0:f6:f5:f4:f3:f2:01') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'some-different-name') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::100', expect_include=False) srv_msg.response_check_include_option(25) srv_msg.response_check_option_content(25, 'sub-option', 26) srv_msg.response_check_suboption_content(26, 25, 'prefix', '2001:db8:1::', expect_include=False) srv_msg.response_check_include_option(39) srv_msg.response_check_option_content(39, 'fqdn', 'reserved-hostname.my.domain.com.', expect_include=False)
def test_hook_v6_subnet_cmds_add_and_del(): misc.test_setup() srv_control.config_srv_subnet('$(EMPTY)', '$(EMPTY)') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.open_control_channel() srv_control.add_hooks('libdhcp_subnet_cmds.so') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2) srv_msg.send_ctrl_cmd_via_socket( '{"command":"subnet6-list","arguments":{}}', exp_result=3) srv_msg.send_ctrl_cmd_via_socket( '{"command": "subnet6-add","arguments":{"subnet6":[{"id": 234,"interface":"$(SERVER_IFACE)","subnet": "2001:db8:1::/64","pools":[{"pool":"2001:db8:1::1-2001:db8:1::2"}]}]}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command":"subnet6-get","arguments":{"id": 234}}') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:1::1') srv_msg.send_ctrl_cmd_via_socket( '{"command": "subnet6-del","arguments":{"id":234}}') # Using UNIX socket on server in path control_socket send {"command": "subnet6-add","arguments":{"subnet6":[{"id": 234,"interface":"$(SERVER_IFACE)","subnet": "2001:db8:1::/64","pools":[{"pool":"2001:db8:1::1-2001:db8:1::2"}]}]}} response = srv_msg.send_ctrl_cmd_via_socket( '{"command":"subnet6-get","arguments":{"id": 234}}', exp_result=3) assert response['text'] == 'No subnet with id 234 found' misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2)
def test_ddns4_notsig_forw_and_rev_dhci_conflicts_Sflag(): misc.test_setup() srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.10-192.168.50.11') 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('generated-prefix', 'four') srv_control.add_ddns_server_options('qualifying-suffix', 'example.com') srv_control.add_forward_ddns('four.example.com.', 'EMPTY_KEY') srv_control.add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') srv_control.use_dns_set_number(20) srv_control.start_srv('DNS', 'started') misc.test_procedure() srv_msg.dns_question_record('client1.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.dns_question_record('10.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.dns_question_record('client2.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.dns_question_record('11.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:11') srv_msg.client_send_msg('DISCOVER') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'OFFER') srv_msg.response_check_include_option(1) srv_msg.response_check_content('yiaddr', '192.168.50.10') srv_msg.response_check_option_content(1, 'value', '255.255.255.0') misc.test_procedure() srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:11') srv_msg.client_copy_option('server_id') srv_msg.client_does_include_with_value('requested_addr', '192.168.50.10') srv_msg.client_requests_option(1) srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'client1.four.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ACK') srv_msg.response_check_content('yiaddr', '192.168.50.10') srv_msg.response_check_include_option(1) srv_msg.response_check_option_content(1, 'value', '255.255.255.0') srv_msg.response_check_include_option(81) srv_msg.response_check_option_content(81, 'flags', 1) srv_msg.response_check_option_content(81, 'fqdn', 'client1.four.example.com.') misc.test_procedure() srv_msg.dns_question_record('client1.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', '192.168.50.10') srv_msg.dns_option_content('ANSWER', 'rrname', 'client1.four.example.com.') misc.test_procedure() srv_msg.dns_question_record('10.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', 'client1.four.example.com.') srv_msg.dns_option_content('ANSWER', 'rrname', '10.50.168.192.in-addr.arpa.') # Client 2 add misc.test_procedure() srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:12') srv_msg.client_send_msg('DISCOVER') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'OFFER') srv_msg.response_check_include_option(1) srv_msg.response_check_content('yiaddr', '192.168.50.11') srv_msg.response_check_option_content(1, 'value', '255.255.255.0') misc.test_procedure() srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:12') srv_msg.client_copy_option('server_id') srv_msg.client_does_include_with_value('requested_addr', '192.168.50.11') srv_msg.client_requests_option(1) srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'client2.four.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ACK') srv_msg.response_check_content('yiaddr', '192.168.50.11') srv_msg.response_check_include_option(1) srv_msg.response_check_option_content(1, 'value', '255.255.255.0') srv_msg.response_check_include_option(81) srv_msg.response_check_option_content(81, 'flags', 1) srv_msg.response_check_option_content(81, 'fqdn', 'client2.four.example.com.') misc.test_procedure() srv_msg.dns_question_record('client2.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', '192.168.50.11') srv_msg.dns_option_content('ANSWER', 'rrname', 'client2.four.example.com.') misc.test_procedure() srv_msg.dns_question_record('11.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', 'client2.four.example.com.') srv_msg.dns_option_content('ANSWER', 'rrname', '11.50.168.192.in-addr.arpa.') # Client 2 try to update client's 1 domain misc.test_procedure() srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:12') srv_msg.client_send_msg('DISCOVER') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'OFFER') srv_msg.response_check_include_option(1) srv_msg.response_check_content('yiaddr', '192.168.50.11') srv_msg.response_check_option_content(1, 'value', '255.255.255.0') misc.test_procedure() srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:12') srv_msg.client_copy_option('server_id') srv_msg.client_does_include_with_value('requested_addr', '192.168.50.11') srv_msg.client_requests_option(1) srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'client1.four.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ACK') srv_msg.response_check_content('yiaddr', '192.168.50.11') srv_msg.response_check_include_option(1) srv_msg.response_check_option_content(1, 'value', '255.255.255.0') srv_msg.response_check_include_option(81) srv_msg.response_check_option_content(81, 'flags', 1) srv_msg.response_check_option_content(81, 'fqdn', 'client1.four.example.com.') # address and domain name should not be changed! misc.test_procedure() srv_msg.dns_question_record('client1.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', '192.168.50.10') srv_msg.dns_option_content('ANSWER', 'rrname', 'client1.four.example.com.') misc.test_procedure() srv_msg.dns_question_record('10.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', 'client1.four.example.com.') srv_msg.dns_option_content('ANSWER', 'rrname', '10.50.168.192.in-addr.arpa.') misc.test_procedure() srv_msg.dns_question_record('client2.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.dns_question_record('11.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False)
def test_2019_6472_client_id(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_does_include('Client', 'client-id') # let's get one exchange correct to save server-id correct_id = "\x00\x19\x00\x0c\x27\xfe\x0c\x00\xff\x6f\x95\x00\x00\x02\x00\x00" srv_msg.send_raw_message(msg_type='SOLICIT', raw_append=correct_id) misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.client_save_option('server-id') # All messages below are send with too long client-id, and should remain unanswered misc.test_procedure() srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_send_msg('SOLICIT') invalid_data = "\x00\x01\x01\x2C\x00\x04\x00\x01\x5d\x31\xce\x05\x08\x00\x27\x6d\xee\x67" + 800 * "\x12" srv_msg.send_raw_message(raw_append=invalid_data) srv_msg.client_does_include('RelayAgent', 'interface-id') srv_msg.create_relay_forward() srv_msg.send_wait_for_message('MUST', None, expect_response=False) misc.test_procedure() srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_add_saved_option('DONT ') invalid_data = "\x00\x01\x01\x2C\x00\x04\x00\x01\x5d\x31\xce\x05\x08\x00\x27\x6d\xee\x67" + 800 * "\x12" srv_msg.send_raw_message(msg_type='REQUEST', raw_append=invalid_data) misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, expect_response=False) misc.test_procedure() srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_add_saved_option('DONT ') srv_msg.client_send_msg('REQUEST') invalid_data = "\x00\x01\x01\x2C\x00\x04\x00\x01\x5d\x31\xce\x05\x08\x00\x27\x6d\xee\x67" + 800 * "\x12" srv_msg.send_raw_message(raw_append=invalid_data) misc.pass_criteria() srv_msg.client_does_include('RelayAgent', 'interface-id') srv_msg.create_relay_forward() srv_msg.send_wait_for_message('MUST', None, expect_response=False) misc.test_procedure() srv_msg.client_does_include('Client', 'IA-PD') invalid_data = "\x00\x01\x01\x2C\x00\x04\x00\x01\x5d\x31\xce\x05\x08\x00\x27\x6d\xee\x67" + 800 * "\x12" srv_msg.send_raw_message(msg_type='REBIND', raw_append=invalid_data) misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, expect_response=False) misc.test_procedure() srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_send_msg('REBIND') invalid_data = "\x00\x01\x01\x2C\x00\x04\x00\x01\x5d\x31\xce\x05\x08\x00\x27\x6d\xee\x67" + 800 * "\x12" srv_msg.send_raw_message(raw_append=invalid_data) misc.pass_criteria() srv_msg.client_does_include('RelayAgent', 'interface-id') srv_msg.create_relay_forward() srv_msg.send_wait_for_message('MUST', None, expect_response=False) misc.test_procedure() srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', 'IA-PD') invalid_data = "\x00\x01\x01\x2C\x00\x04\x00\x01\x5d\x31\xce\x05\x08\x00\x27\x6d\xee\x67" + 800 * "\x12" srv_msg.send_raw_message(msg_type='RENEW', raw_append=invalid_data) misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, expect_response=False) misc.test_procedure() srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_send_msg('RENEW') invalid_data = "\x00\x01\x01\x2C\x00\x04\x00\x01\x5d\x31\xce\x05\x08\x00\x27\x6d\xee\x67" + 800 * "\x12" srv_msg.send_raw_message(raw_append=invalid_data) misc.pass_criteria() srv_msg.client_does_include('RelayAgent', 'interface-id') srv_msg.create_relay_forward() srv_msg.send_wait_for_message('MUST', None, expect_response=False)
def test_hook_v6_subnet_cmds_add_with_options(): misc.test_setup() srv_control.config_srv_subnet('$(EMPTY)', '$(EMPTY)') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.open_control_channel() srv_control.add_hooks('libdhcp_subnet_cmds.so') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2) misc.test_procedure() srv_msg.client_requests_option(7) srv_msg.client_requests_option(24) srv_msg.client_send_msg('INFOREQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(7) srv_msg.response_check_option_content(7, 'value', 123) srv_msg.response_check_include_option(24) srv_msg.response_check_option_content( 24, 'domains', 'domain1.example.com.,domain2.isc.org.') srv_msg.send_ctrl_cmd_via_socket( '{"command":"subnet6-list","arguments":{}}', exp_result=3) srv_msg.send_ctrl_cmd_via_socket( '{"command": "subnet6-add","arguments":{"subnet6":[{"id": 234,"interface":"$(SERVER_IFACE)","subnet": "2001:db8:1::/64","pools":[{"pool":"2001:db8:1::1-2001:db8:1::2"}],"option-data":[{"csv-format":true,"code":7,"data":"55","name":"preference","space":"dhcp6"}]}]}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command":"subnet6-get","arguments":{"id": 234}}') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_requests_option(7) srv_msg.client_requests_option(24) srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:1::1') srv_msg.response_check_include_option(7) srv_msg.response_check_option_content(7, 'value', 55) srv_msg.response_check_include_option(24) srv_msg.response_check_option_content( 24, 'domains', 'domain1.example.com.,domain2.isc.org.')
def test_v6_host_reservation_cql_conflicts_reconfigure_server_with_reservation_of_used_address_renew_after_expire( ): misc.test_setup() srv_control.set_time('renew-timer', 5) srv_control.set_time('rebind-timer', 6) srv_control.set_time('preferred-lifetime', 7) srv_control.set_time('valid-lifetime', 8) srv_control.config_srv_subnet('3000::/30', '3000::1-3000::2') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'ia_id', '6661') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') misc.test_procedure() srv_msg.client_sets_value('Client', 'ia_id', '6662') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') # SAVE VALUES srv_msg.client_save_option('IA_NA') misc.test_procedure() srv_msg.client_sets_value('Client', 'ia_id', '6663') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2) # bigger prefix pool + reservation srv_msg.forge_sleep(10, 'seconds') misc.test_setup() srv_control.set_time('renew-timer', 5) srv_control.set_time('rebind-timer', 6) srv_control.set_time('preferred-lifetime', 7) srv_control.set_time('valid-lifetime', 8) srv_control.config_srv_subnet('3000::/30', '3000::1-3000::2') srv_control.enable_db_backend_reservation('Cassandra') srv_control.new_db_backend_reservation('Cassandra', 'duid', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_control.update_db_backend_reservation('dhcp6_subnet_id', 1, 'Cassandra', 1) srv_control.ipv6_address_db_backend_reservation('3000::2', '$(EMPTY)', 'Cassandra', 1) srv_control.upload_db_reservation('Cassandra') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'reconfigured') misc.test_procedure() srv_msg.client_sets_value('Client', 'ia_id', 666) srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RENEW') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'validlft', 0) srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.response_check_suboption_content(5, 3, 'validlft', 8) srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2')
def test_v6_host_reservation_cql_conflicts_two_entries_for_one_host_different_subnets( ): misc.test_setup() srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10') srv_control.enable_db_backend_reservation('Cassandra') srv_control.new_db_backend_reservation('Cassandra', 'duid', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_control.update_db_backend_reservation('dhcp6_subnet_id', 1, 'Cassandra', 1) srv_control.ipv6_address_db_backend_reservation('3000::1', '$(EMPTY)', 'Cassandra', 1) srv_control.new_db_backend_reservation('Cassandra', 'hw-address', 'f6:f5:f4:f3:f2:01') srv_control.update_db_backend_reservation('dhcp6_subnet_id', 2, 'Cassandra', 2) srv_control.ipv6_address_db_backend_reservation('3000::3', '$(EMPTY)', 'Cassandra', 2) srv_control.upload_db_reservation('Cassandra') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'ia_id', 666) srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_sets_value('Client', 'ia_id', 666) srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'ia_id', '667') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'ia_id', '667') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::3', expect_include=False)
def test_v6_host_reservation_cql_conflicts_reconfigure_server_with_reservation_of_used_address_2( ): misc.test_setup() srv_control.config_srv_subnet('3000::/30', '3000::1-3000::2') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2) # bigger prefix pool + reservation misc.test_setup() srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10') srv_control.enable_db_backend_reservation('Cassandra') srv_control.new_db_backend_reservation('Cassandra', 'hw-address', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_control.update_db_backend_reservation('dhcp6_subnet_id', 1, 'Cassandra', 1) srv_control.ipv6_address_db_backend_reservation('3000::1', '$(EMPTY)', 'Cassandra', 1) srv_control.upload_db_reservation('Cassandra') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'reconfigured') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::1', expect_include=False)
def _check_if_ddns_is_working_correctly(): misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(39) srv_msg.response_check_option_content(39, 'flags', 'S') srv_msg.response_check_option_content(39, 'fqdn', 'sth6.six.example.com.') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', '2001:db8:1::50') misc.test_procedure() srv_msg.dns_question_record( '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', 'sth6.six.example.com.') srv_msg.dns_option_content( 'ANSWER', 'rrname', '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.' )
def test_ddns6_tsig_sha1_rev_release(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::50-2001:db8:1::50') 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('generated-prefix', 'six') srv_control.add_ddns_server_options('qualifying-suffix', 'example.com') srv_control.add_forward_ddns('six.example.com.', 'forge.sha1.key') srv_control.add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha1.key') srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') srv_control.use_dns_set_number('3') srv_control.start_srv('DNS', 'started') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER') misc.test_procedure() srv_msg.dns_question_record( '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_save_option_count('1', 'IA_NA') srv_msg.client_save_option_count('1', 'server-id') srv_msg.client_add_saved_option_count('1', 'DONT ') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_does_include('Client', None, 'fqdn') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') srv_msg.response_check_include_option('Response', None, '39') srv_msg.response_check_option_content('Response', '39', "NOT", 'flags', 'S') srv_msg.response_check_option_content('Response', '39', "NOT", 'flags', 'N') srv_msg.response_check_option_content('Response', '39', "NOT", 'flags', 'O') srv_msg.response_check_option_content('Response', '39', None, 'fqdn', 'sth6.six.example.com.') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER') misc.test_procedure() srv_msg.dns_question_record( '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option('NOT ', 'ANSWER') srv_msg.dns_option_content('ANSWER', None, 'rdata', 'sth6.six.example.com.') srv_msg.dns_option_content( 'ANSWER', None, 'rrname', '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.' ) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_add_saved_option_count('1', 'DONT ') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RELEASE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_include_option('Response', None, '2') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER') misc.test_procedure() srv_msg.dns_question_record( '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER')
def test_prefix_delegation_rebind_fail(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::3') srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '92') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_copy_option('server-id') srv_msg.client_save_option('IA_PD') srv_msg.client_add_saved_option('DONT ') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_sets_value('Client', 'plen', '90') srv_msg.client_sets_value('Client', 'prefix', '3001::') srv_msg.client_does_include('Client', None, 'IA_Prefix') srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_send_msg('REBIND') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'T1', '0') references.references_check('RFC')
def test_v6_client_classification_multiple_subnets(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:a::/64', '2001:db8:a::1-2001:db8:a::1') srv_control.config_srv_another_subnet_no_interface( '2001:db8:b::/64', '2001:db8:b::1-2001:db8:b::1') srv_control.config_srv_another_subnet_no_interface( '2001:db8:c::/64', '2001:db8:c::1-2001:db8:c::1') srv_control.create_new_class('Client_Class_1') srv_control.add_test_to_class(1, 'test', 'substring(option[1].hex,8,2) == 0xf2f1') # To class no 1 add option dns-servers with value 2001:db8::666. srv_control.config_client_classification(0, 'Client_Class_1') srv_control.create_new_class('Client_Class_2') srv_control.add_test_to_class(2, 'test', 'substring(option[1].hex,8,2) == 0xf2f2') srv_control.config_client_classification(1, 'Client_Class_2') srv_control.create_new_class('Client_Class_3') srv_control.add_test_to_class(3, 'test', 'substring(option[1].hex,8,2) == 0xf299') srv_control.config_client_classification(2, 'Client_Class_3') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:11:11:11:11:11:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:f1') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:a::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:f2') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:b::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:99') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:c::1')
def test_hook_v6_network_cmds_add_and_del(): misc.test_setup() srv_control.config_srv_subnet('$(EMPTY)', '$(EMPTY)') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.open_control_channel() srv_control.add_hooks('libdhcp_subnet_cmds.so') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2) srv_msg.send_ctrl_cmd_via_socket( '{"command": "network6-add","arguments": {"shared-networks": [{"name": "name-abc","preferred-lifetime": 3000,"rebind-timer": 2000,"renew-timer": 1000,"valid-lifetime": 4000,"subnet6":[{"subnet":"2001:db8:a::/64","interface": "$(SERVER_IFACE)","pools":[{"pool":"2001:db8:a::1-2001:db8:a::1"}]}]}]}}' ) srv_msg.forge_sleep(5, 'seconds') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:a::1') srv_msg.send_ctrl_cmd_via_socket( '{"command": "network6-del","arguments":{"name":"name-abc","subnets-action": "delete"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command":"network6-list","arguments":{}}', exp_result=3) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2)
def test_v6_client_classification_multiple_subnets_options_override_global(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:a::/64', '2001:db8:a::1-2001:db8:a::1') srv_control.config_srv_another_subnet_no_interface( '2001:db8:b::/64', '2001:db8:b::1-2001:db8:b::1') srv_control.config_srv_another_subnet_no_interface( '2001:db8:c::/64', '2001:db8:c::1-2001:db8:c::1') srv_control.config_srv_another_subnet_no_interface( '2001:db8:d::/64', '2001:db8:d::1-2001:db8:d::1') srv_control.config_srv_opt('dns-servers', '2001:db8::1,2001:db8::2') srv_control.create_new_class('Client_Class_1') srv_control.add_test_to_class(1, 'test', 'substring(option[1].hex,8,2) == 0xf2f1') srv_control.add_option_to_defined_class(1, 'dns-servers', '2001:db8::888') srv_control.config_client_classification(0, 'Client_Class_1') srv_control.create_new_class('Client_Class_2') srv_control.add_test_to_class(2, 'test', 'substring(option[1].hex,8,2) == 0xf2f2') srv_control.add_option_to_defined_class(2, 'dns-servers', '2001:db8::777') srv_control.config_client_classification(1, 'Client_Class_2') srv_control.create_new_class('Client_Class_3') srv_control.add_test_to_class(3, 'test', 'substring(option[1].hex,8,2) == 0xf299') srv_control.add_option_to_defined_class(3, 'dns-servers', '2001:db8::999') srv_control.config_client_classification(2, 'Client_Class_3') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:11:11:11:11:11:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_requests_option(23) srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(23) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::1,2001:db8::2') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:d::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:f1') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_requests_option(23) srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(23) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::888') srv_msg.response_check_option_content(23, 'addresses', '2001:db8::2', expect_include=False) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::1', expect_include=False) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:a::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:f2') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_requests_option(23) srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(23) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::777') srv_msg.response_check_option_content(23, 'addresses', '2001:db8::2', expect_include=False) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::1', expect_include=False) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:b::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:99') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_requests_option(23) srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(23) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::999') srv_msg.response_check_option_content(23, 'addresses', '2001:db8::2', expect_include=False) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::1', expect_include=False) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:c::1')
def test_hook_v6_subnet_cmds_add_conflict(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1') srv_control.config_srv_opt('preference', '123') srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org') srv_control.open_control_channel() srv_control.add_hooks('libdhcp_subnet_cmds.so') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:1::1') srv_msg.send_ctrl_cmd_via_socket( '{"command":"subnet6-list","arguments":{}}') response = srv_msg.send_ctrl_cmd_via_socket( { "command": "subnet6-add", "arguments": { "subnet6": [{ "id": 1, "interface": "$(SERVER_IFACE)", "subnet": "2002:db8:1::/64", "pools": [{ "pool": "2002:db8:1::10-2002:db8:1::20" }] }] } }, exp_result=1) assert response[ 'text'] == "ID of the new IPv6 subnet '1' is already in use" response = srv_msg.send_ctrl_cmd_via_socket( '{"command":"subnet6-get","arguments":{"id": 1}}') assert response['arguments']['subnet6'][0]['subnet'] == '2001:db8:1::/64' misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:1::1')
def test_v6_client_classification_shared_subnet_options_override(): # we discussed classification on numerous occasions. This is actually working # as designed, I don't like this design, I still don't know why option defined # in shared-network should takes precedence before option defined in class and # it's only one level which does this (option in class takes precedence against # option defined globally, subnet and pool). # I gave up, I'm changing this test to reflect kea current operation. misc.test_setup() srv_control.config_srv_subnet('2001:db8:a::/64', '2001:db8:a::1-2001:db8:a::10') srv_control.config_srv_another_subnet_no_interface( '2001:db8:b::/64', '2001:db8:b::1-2001:db8:b::1') srv_control.create_new_class('Client_Class_1') srv_control.add_test_to_class(1, 'test', 'substring(option[1].hex,8,2) == 0xf2f1') srv_control.add_option_to_defined_class(1, 'dns-servers', '2001:db8::888') srv_control.config_client_classification(0, 'Client_Class_1') srv_control.shared_subnet('2001:db8:a::/64', 0) srv_control.shared_subnet('2001:db8:b::/64', 0) srv_control.set_conf_parameter_shared_subnet('name', '"name-abc"', 0) srv_control.set_conf_parameter_shared_subnet('interface', '"$(SERVER_IFACE)"', 0) srv_control.set_conf_parameter_shared_subnet( 'option-data', '{"csv-format":true,"code":23,"data":"2001:db8::1","name":"dns-servers","space":"dhcp6"}', 0) srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:f2') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_requests_option(23) srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(23) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::888', expect_include=False) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::1') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:b::1') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:f2:f1') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_requests_option(23) srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(23) # the way this test worked previously # srv_msg.response_check_option_content(23, 'addresses', '2001:db8::888') # srv_msg.response_check_option_content(23, 'addresses', '2001:db8::1', expect_include=False) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::888', expect_include=False) srv_msg.response_check_option_content(23, 'addresses', '2001:db8::1') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) srv_msg.response_check_suboption_content(5, 3, 'addr', '2001:db8:a::1')
def test_ddns6_notsig_forw_and_rev_release(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::50-2001:db8:1::50') 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('generated-prefix', 'six') srv_control.add_ddns_server_options('qualifying-suffix', 'example.com') srv_control.add_forward_ddns('six.example.com.', 'EMPTY_KEY') srv_control.add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') srv_control.use_dns_set_number(1) srv_control.start_srv('DNS', 'started') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_save_option_count(1, 'IA_NA') srv_msg.client_save_option_count(1, 'server-id') srv_msg.client_add_saved_option_count(1, 'DONT ') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(39) srv_msg.response_check_option_content(39, 'flags', 'S') srv_msg.response_check_option_content(39, 'fqdn', 'sth6.six.example.com.') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', '2001:db8:1::50') misc.test_procedure() srv_msg.dns_question_record('0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', 'sth6.six.example.com.') srv_msg.dns_option_content('ANSWER', 'rrname', '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_add_saved_option_count(1, 'DONT ') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RELEASE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.dns_question_record('0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False)
def test_v6_mac_in_dhcp6_client_link_addr_1(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.add_line({"mac-sources": ["client-link-addr-option"]}) srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-link-layer-addr') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') srv_msg.client_does_include('RelayAgent', 'client-link-layer-addr') srv_msg.client_sets_value('RelayAgent', 'peeraddr', '$(CLI_LINK_LOCAL)') srv_msg.client_does_include('RelayAgent', 'interface-id') srv_msg.create_relay_forward() misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'RELAYREPLY') srv_msg.response_check_include_option(18) srv_msg.response_check_include_option(9) srv_msg.lease_file_contains(',$(CLI_MAC)') srv_msg.log_contains('Hardware addr: $(CLI_MAC)')
def send_solicit_and_check_response(duid=None, relay_addr=None, req_ia='IA-NA', rapid_commit=False, interface_id=None, exp_ia_na_t1=None, exp_ia_na_t2=None, exp_ia_na_status_code=None, exp_ia_na_iaaddr_addr=None, exp_ia_na_iaaddr_preflft=None, exp_ia_na_iaaddr_validlft=None, exp_ia_pd_iaprefix_prefix=None, exp_ia_pd_iaprefix_plen=None, req_opts=None, exp_option=None, no_exp_option=None): # send SOLICIT misc.test_procedure() srv_msg.client_requests_option(1) if duid is not None: srv_msg.client_sets_value('Client', 'DUID', duid) #if client_id is not None: # srv_msg.client_does_include_with_value('client_id', client_id) srv_msg.client_does_include('Client', 'client-id') if req_ia is not None: srv_msg.client_does_include('Client', req_ia) if req_opts is not None: for opt in req_opts: srv_msg.client_requests_option(opt) if rapid_commit: srv_msg.client_does_include('Client', 'rapid-commit') srv_msg.client_send_msg('SOLICIT') # add relay agent stuff if relay_addr is not None: srv_msg.client_sets_value('RelayAgent', 'linkaddr', relay_addr) if interface_id is not None: srv_msg.client_sets_value('RelayAgent', 'ifaceid', interface_id) srv_msg.client_does_include('RelayAgent', 'interface-id') if relay_addr is not None or interface_id is not None: srv_msg.create_relay_forward() # check response if relay_addr is not None or interface_id is not None: exp_msg_type = 'RELAYREPLY' elif rapid_commit: exp_msg_type = 'REPLY' else: exp_msg_type = 'ADVERTISE' _send_and_check_response(req_ia, exp_msg_type, exp_ia_na_t1, exp_ia_na_t2, exp_ia_na_status_code, exp_ia_na_iaaddr_addr, exp_ia_na_iaaddr_preflft, exp_ia_na_iaaddr_validlft, exp_ia_pd_iaprefix_prefix, exp_ia_pd_iaprefix_plen, rapid_commit, exp_option, no_exp_option) # srv_msg.response_check_include_option(1) # srv_msg.response_check_include_option(54) # srv_msg.response_check_option_content(1, 'value', '255.255.255.0') # srv_msg.response_check_option_content(54, 'value', '$(SRV4_ADDR)') # if exp_client_id is not None: # if exp_client_id == 'missing': # srv_msg.response_check_include_option(61, expect_include=False) # else: # srv_msg.response_check_include_option(61) # srv_msg.response_check_option_content(61, 'value', exp_client_id) #return rcvd_yiaddr return None
def test_v6_mac_in_dhcp6_docsic_cmts(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.add_line({"mac-sources": ["docsis-cmts"]}) srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') srv_msg.client_sets_value('RelayAgent', 'enterprisenum', '4491') srv_msg.client_does_include('RelayAgent', 'vendor-class') srv_msg.add_vendor_suboption('RelayAgent', 1026, '00:f5:f4:00:f2:01') srv_msg.client_does_include('RelayAgent', 'vendor-specific-info') srv_msg.client_does_include('RelayAgent', 'interface-id') srv_msg.create_relay_forward() misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'RELAYREPLY') srv_msg.response_check_include_option(18) srv_msg.response_check_include_option(9) srv_msg.lease_file_contains(',00:f5:f4:00:f2:01') srv_msg.log_contains('Hardware addr: 00:f5:f4:00:f2:01')
def test_v6_relay_invalid_options_status_code(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') # add options to relay message srv_msg.client_does_include('RelayAgent', None, 'status-code') srv_msg.client_does_include('RelayAgent', None, 'interface-id') srv_msg.create_relay_forward() misc.pass_criteria() srv_msg.send_dont_wait_for_message() misc.test_procedure() srv_msg.client_requests_option('7') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') srv_msg.client_does_include('RelayAgent', None, 'interface-id') srv_msg.create_relay_forward() misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'RELAYREPLY') srv_msg.response_check_include_option('Response', None, '18') srv_msg.response_check_include_option('Response', None, '9') references.references_check('RFC3315')
def test_stats_6(): misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_prefix('3001::', 0, 90, 92) srv_control.open_control_channel() srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() # message wont contain client-id option srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_dont_wait_for_message() srv_msg.loops('SOLICIT', 'ADVERTISE', 50) srv_msg.send_ctrl_cmd_via_socket( '{"command": "list-commands","arguments": {}}') srv_msg.send_ctrl_cmd_via_socket( '{"command":"statistic-get-all","arguments":{}}') srv_msg.loops('SOLICIT', 'ADVERTISE', 50) srv_msg.send_ctrl_cmd_via_socket( '{"command":"statistic-get-all","arguments":{}}') srv_msg.loops('SOLICIT', 'ADVERTISE', 50) misc.test_procedure() srv_msg.client_requests_option(7) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_requests_option(7) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('CONFIRM') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-received"}}') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-receive-drop"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-parse-failed"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-solicit-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-confirm-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-advertise-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-reply-received"}}' ) misc.test_procedure() srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RENEW') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-renew-received"}}' ) misc.test_procedure() srv_msg.client_requests_option(7) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REBIND') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-rebind-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-release-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-decline-received"}}' ) misc.test_procedure() srv_msg.client_requests_option(7) srv_msg.client_send_msg('INFOREQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-infrequest-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-unknown-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-sent"}}') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-advertise-sent"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-reply-sent"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].total-nas"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].assigned-nas"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].total-pds"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].assigned-pds"}}' ) srv_msg.loops('REQUEST', 'REPLY', 50) misc.test_procedure() srv_msg.client_does_include('Client', 'IA-PD') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_PD') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_PD') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RENEW') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-advertise-sent"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-reply-sent"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].total-nas"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].assigned-nas"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].total-pds"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].assigned-pds"}}' ) srv_msg.loops('REQUEST', 'REPLY', 50) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get-all","arguments":{}}') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].total-nas"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "subnet[1].assigned-nas"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-reset","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.loops('SOLICIT', 'ADVERTISE', 50) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.loops('REQUEST', 'REPLY', 50) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-remove","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.loops('SOLICIT', 'ADVERTISE', 50) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) srv_msg.loops('REQUEST', 'REPLY', 50) srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-request-received"}}' ) misc.test_procedure() srv_msg.client_requests_option(7) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_requests_option(7) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') misc.test_procedure() srv_msg.client_save_option('IA_NA') srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('DECLINE') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.send_ctrl_cmd_via_socket( '{"command": "statistic-get","arguments": {"name": "pkt6-decline-received"}}' ) misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_another_subnet_no_interface( '3000:100::/64', '3000:100::5-3000:100::ff') srv_control.config_srv_prefix('2001:db8:1::', 0, 90, 92) srv_control.open_control_channel('control_socket2') srv_control.start_srv('DHCP', 'reconfigured') srv_msg.send_ctrl_cmd_via_socket( '{"command":"statistic-get-all","arguments":{}}', socket_name='control_socket2') misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_prefix('2001:db8:1::', 0, 90, 92) srv_control.start_srv('DHCP', 'reconfigured') srv_msg.send_ctrl_cmd_via_socket( '{"command":"statistic-get-all","arguments":{}}') misc.test_setup() srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff') srv_control.config_srv_prefix('2001:db8:1::', 0, 90, 92) srv_control.open_control_channel('control_socket2') srv_control.start_srv('DHCP', 'reconfigured') srv_msg.send_ctrl_cmd_via_socket( '{"command":"statistic-get-all","arguments":{}}', socket_name='control_socket2') srv_control.start_srv('DHCP', 'restarted') srv_msg.send_ctrl_cmd_via_socket( '{"command":"statistic-get-all","arguments":{}}', socket_name='control_socket2')
def test_ddns4_tsig_sha1_rev_release(): misc.test_setup() srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.10-192.168.50.10') 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('generated-prefix', 'four') srv_control.add_ddns_server_options('qualifying-suffix', 'example.com') srv_control.add_forward_ddns('four.example.com.', 'forge.sha1.key') srv_control.add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha1.key') srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') srv_control.use_dns_set_number('21') srv_control.start_srv('DNS', 'started') misc.test_procedure() srv_msg.dns_question_record('aa.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER') misc.test_procedure() srv_msg.client_requests_option('1') srv_msg.client_send_msg('DISCOVER') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'OFFER') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.10') srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0') misc.test_procedure() srv_msg.client_save_option_count('1', 'server_id') srv_msg.client_add_saved_option_count('1', 'DONT ') srv_msg.client_does_include_with_value('requested_addr', '192.168.50.10') srv_msg.client_requests_option('1') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'aa.four.example.com.') srv_msg.client_does_include('Client', None, 'fqdn') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ACK') srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.10') srv_msg.response_check_include_option('Response', None, '1') srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0') srv_msg.response_check_include_option('Response', None, '81') srv_msg.response_check_option_content('Response', '81', None, 'fqdn', 'aa.four.example.com.') misc.test_procedure() srv_msg.client_save_option('server_id') srv_msg.dns_question_record('aa.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER') misc.test_procedure() srv_msg.dns_question_record('10.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option('NOT ', 'ANSWER') srv_msg.dns_option_content('ANSWER', None, 'rdata', 'aa.four.example.com.') srv_msg.dns_option_content('ANSWER', None, 'rrname', '10.50.168.192.in-addr.arpa.') misc.test_procedure() srv_msg.client_add_saved_option_count('1', 'DONT ') srv_msg.client_sets_value('Client', 'ciaddr', '192.168.50.10') srv_msg.client_send_msg('RELEASE') misc.pass_criteria() srv_msg.send_dont_wait_for_message() misc.test_procedure() srv_msg.dns_question_record('aa.four.example.com', 'A', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER') misc.test_procedure() srv_msg.dns_question_record('10.50.168.192.in-addr.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST', None) srv_msg.dns_option(None, 'ANSWER')
def send_request_and_check_reply(duid=None, req_ia=None, interface_id=None, exp_ia_na_t1=None, exp_ia_na_t2=None, exp_ia_na_status_code=None, exp_ia_na_iaaddr_addr=None, exp_ia_na_iaaddr_preflft=None, exp_ia_na_iaaddr_validlft=None, exp_ia_pd_iaprefix_prefix=None, exp_ia_pd_iaprefix_plen=None, req_opts=None, exp_option=None, no_exp_option=None): # send REQUEST misc.test_procedure() world.sender_type = "Client" if duid is not None: srv_msg.client_sets_value('Client', 'DUID', duid) # if client_id is not None: # srv_msg.client_does_include_with_value('client_id', client_id) # if server_id is not None: # srv_msg.client_copy_option('server_id') # if requested_addr is not None: # srv_msg.client_does_include_with_value('requested_addr', requested_addr) # if ciaddr is not None: # srv_msg.client_sets_value('Client', 'ciaddr', ciaddr) # srv_msg.client_requests_option(1) if req_ia == 'IA-NA': srv_msg.client_copy_option('IA_NA') if req_ia == 'IA-PD': srv_msg.client_copy_option('IA_PD') srv_msg.client_copy_option('server-id') #srv_msg.client_save_option('server-id') #srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', 'client-id') if req_opts is not None: for opt in req_opts: srv_msg.client_requests_option(opt) srv_msg.client_send_msg('REQUEST') if interface_id is not None: srv_msg.client_sets_value('RelayAgent', 'ifaceid', interface_id) srv_msg.client_does_include('RelayAgent', 'interface-id') srv_msg.create_relay_forward() # srv_msg.response_check_include_option(1) # srv_msg.response_check_option_content(1, 'value', '255.255.255.0') # srv_msg.response_check_include_option(54) # srv_msg.response_check_option_content(54, 'value', '$(SRV4_ADDR)') # srv_msg.response_check_include_option(51) # if exp_renew_timer is not None: # missing = 'NOT ' if exp_renew_timer == 'missing' else None # srv_msg.response_check_include_option('Response', missing, 58) # if not missing: # srv_msg.response_check_option_content(58, 'value', exp_renew_timer) # if exp_rebind_timer is not None: # missing = 'NOT ' if exp_rebind_timer == 'missing' else None # srv_msg.response_check_include_option('Response', missing, 59) # if not missing: # srv_msg.response_check_option_content(59, 'value', exp_rebind_timer) # if exp_client_id is not None: # if exp_client_id == 'missing': # srv_msg.response_check_include_option(61, expect_include=False) # else: # srv_msg.response_check_include_option(61) # srv_msg.response_check_option_content(61, 'value', exp_client_id) # if exp_next_server is not None: # srv_msg.response_check_content('siaddr', exp_next_server) # if exp_server_hostname is not None: # srv_msg.response_check_content('sname', exp_server_hostname) # if exp_boot_file_name is not None: # srv_msg.response_check_content('file', exp_boot_file_name) if interface_id is not None: exp_msg_type = 'RELAYREPLY' else: exp_msg_type = 'REPLY' _send_and_check_response(req_ia, exp_msg_type, exp_ia_na_t1, exp_ia_na_t2, exp_ia_na_status_code, exp_ia_na_iaaddr_addr, exp_ia_na_iaaddr_preflft, exp_ia_na_iaaddr_validlft, exp_ia_pd_iaprefix_prefix, exp_ia_pd_iaprefix_plen, False, # exp_rapid_commit=False exp_option, no_exp_option)
def test_v6_host_reservation_duid_requesting_reserved_prefix_inside_empty_pool( ): misc.test_setup() srv_control.config_srv_subnet('3000::/30', '3000::1-3000::10') srv_control.config_srv_prefix('2001:db8:1::', '0', '32', '33') srv_control.host_reservation_in_subnet('prefix', '2001:db8:1:0:4000::/34', '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('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') srv_msg.response_check_suboption_content('Response', '26', '25', 'NOT ', 'prefix', '2001:db8:1:0:4000::') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') srv_msg.response_check_suboption_content('Response', '26', '25', 'NOT ', 'prefix', '2001:db8:1:0:4000::') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:33') srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:33') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '25', None, 'statuscode', '6') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_does_include('Client', None, 'IA-PD') srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '25') srv_msg.response_check_option_content('Response', '25', None, 'sub-option', '26') srv_msg.response_check_suboption_content('Response', '26', '25', None, 'prefix', '2001:db8:1:0:4000::') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
def test_hook_v6_network_cmds_add_conflict(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:a::/64', '2001:db8:a::1-2001:db8:a::1') srv_control.config_srv_another_subnet_no_interface( '2001:db8:b::/64', '2001:db8:b::1-2001:db8:b::1') # first shared subnet srv_control.shared_subnet('2001:db8:a::/64', 0) srv_control.shared_subnet('2001:db8:b::/64', 0) srv_control.set_conf_parameter_shared_subnet('name', '"name-xyz"', 0) srv_control.set_conf_parameter_shared_subnet('interface', '"$(SERVER_IFACE)"', 0) srv_control.open_control_channel() srv_control.add_hooks('libdhcp_subnet_cmds.so') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') srv_msg.send_ctrl_cmd_via_socket( '{"command":"network6-list","arguments":{}}') response = srv_msg.send_ctrl_cmd_via_socket( '{"command":"network6-add","arguments":{"shared-networks": [{"interface": "$(SERVER_IFACE)","name": "name-xyz","option-data": [],"preferred-lifetime": 0,"rapid-commit": false,"rebind-timer": 0,"relay": {"ip-address": "::"},"renew-timer": 0,"reservation-mode": "all","subnet6": [{"id": 3,"interface": "$(SERVER_IFACE)","option-data": [],"pd-pools": [],"pools": [{"option-data": [],"pool": "2001:db8:c::1/128"}],"preferred-lifetime": 3000,"rapid-commit": false,"rebind-timer": 2000,"relay": {"ip-address": "::"},"renew-timer": 1000,"reservation-mode": "all","subnet": "2001:db8:c::/64","valid-lifetime": 4000},{"id": 4,"interface": "$(SERVER_IFACE)","option-data": [],"pd-pools": [],"pools": [{"option-data": [],"pool": "2001:db8:d::1/128"}],"preferred-lifetime": 3000,"rapid-commit": false,"rebind-timer": 2000,"relay": {"ip-address": "::"},"renew-timer": 1000,"reservation-mode": "all","subnet": "2001:db8:d::/64","valid-lifetime": 4000}],"valid-lifetime": 0}]}}', exp_result=1) assert response[ 'text'] == "duplicate network 'name-xyz' found in the configuration" misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_copy_option('IA_NA') srv_msg.client_save_option('server-id') srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_copy_option('IA_NA') srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 5) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:44:44') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(3) srv_msg.response_check_option_content(3, 'sub-option', 13) srv_msg.response_check_suboption_content(13, 3, 'statuscode', 2)
def test_ddns6_tsig_multi_key_forw_and_rev(): misc.test_setup() srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::50-2001:db8:1::50') 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('generated-prefix', 'six') srv_control.add_ddns_server_options('qualifying-suffix', 'example.com') srv_control.add_forward_ddns('six.example.com.', 'forge.md5.key') srv_control.add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha512.key') srv_control.add_keys('forge.sha512.key', 'HMAC-SHA512', 'jBng5D6QL4f8cfLUUwE7OQ==') srv_control.add_keys('forge.md5.key', 'HMAC-MD5', 'bX3Hs+fG/tThidQPuhK1mA==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') srv_control.use_dns_set_number(9) srv_control.start_srv('DNS', 'started') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_does_include('Client', 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'ADVERTISE') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:ff:ff:ff:ff:ff:01') srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', 'REPLY') srv_msg.response_check_include_option(1) srv_msg.response_check_include_option(2) srv_msg.response_check_include_option(39) srv_msg.response_check_option_content(39, 'flags', 'S') srv_msg.response_check_option_content(39, 'fqdn', 'sth6.six.example.com.') misc.test_procedure() srv_msg.dns_question_record('sth6.six.example.com', 'AAAA', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', '2001:db8:1::50') misc.test_procedure() srv_msg.dns_question_record( '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'PTR', 'IN') srv_msg.client_send_dns_query() misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER') srv_msg.dns_option_content('ANSWER', 'rdata', 'sth6.six.example.com.') srv_msg.dns_option_content( 'ANSWER', 'rrname', '0.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.' )
def test_v6_host_reservation_pgsql_conflicts_reconfigure_server_with_reservation_of_used_address_renew_before_expire(): misc.test_setup() srv_control.config_srv_subnet('3000::/30', '3000::1-3000::2') # Use PostgreSQL reservation system. srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'started') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('IA_NA') srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') # SAVE VALUES srv_msg.client_save_option('IA_NA') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13') srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2') # bigger prefix pool + reservation misc.test_setup() srv_control.set_time('renew-timer', '105') srv_control.set_time('rebind-timer', '106') srv_control.set_time('valid-lifetime', '107') srv_control.set_time('preferred-lifetime', '108') srv_control.config_srv_subnet('3000::/30', '3000::1-3000::3') srv_control.enable_db_backend_reservation('PostgreSQL') srv_control.new_db_backend_reservation('PostgreSQL', 'duid', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_control.update_db_backend_reservation('dhcp6_subnet_id', '1', 'PostgreSQL', '1') srv_control.ipv6_address_db_backend_reservation('3000::2', '$(EMPTY)', 'PostgreSQL', '1') srv_control.upload_db_reservation('PostgreSQL') srv_control.build_and_send_config_files('SSH', 'config-file') srv_control.start_srv('DHCP', 'reconfigured') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:22') srv_msg.client_add_saved_option('DONT ') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('RENEW') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'validlft', '0') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::2') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'validlft', '107') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::3') misc.test_procedure() srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_does_include('Client', None, 'IA-NA') srv_msg.client_send_msg('SOLICIT') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE') misc.test_procedure() srv_msg.client_copy_option('server-id') srv_msg.client_copy_option('IA_NA') srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:f6:f5:f4:f3:f2:01') srv_msg.client_does_include('Client', None, 'client-id') srv_msg.client_send_msg('REQUEST') misc.pass_criteria() srv_msg.send_wait_for_message('MUST', None, 'REPLY') srv_msg.response_check_include_option('Response', None, '3') srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5') srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::2')