From 47d8f14c0a5a3a8884c01f4ffa28b1eccb102a10 Mon Sep 17 00:00:00 2001 From: Wlodek Wencel Date: Thu, 27 Jan 2022 11:34:15 +0100 Subject: [PATCH 1/2] isc-dhcp new ddns tests, fixes in existing tests, more flexible server configuration --- tests/iscdhcp/v4/ddns/__init__.py | 0 .../v4/ddns/test_ddns_no_tsig_release.py | 290 ++++++++ .../test_ddns_no_tsig_release_hostname.py | 272 ++++++++ .../v4/ddns/test_ddns_no_tsig_request.py | 617 ++++++++++++++++++ .../test_ddns_no_tsig_request_hostname.py | 598 +++++++++++++++++ .../iscdhcp/v4/ddns/test_ddns_tsig_release.py | 205 ++++++ .../iscdhcp/v4/ddns/test_ddns_tsig_request.py | 520 +++++++++++++++ .../test_dhcpd_keyword_use-host-decl-names.py | 21 +- .../v6/ddns/test_ddns_no_tsig_release.py | 37 +- .../v6/ddns/test_ddns_no_tsig_request.py | 150 +---- .../iscdhcp/v6/ddns/test_ddns_tsig_release.py | 36 +- .../iscdhcp/v6/ddns/test_ddns_tsig_request.py | 40 +- .../v6/test_dhcpd_keyword_ddns_forward.py | 10 +- .../v6/test_dhcpd_keyword_ddns_reverse.py | 10 +- .../v6/test_dhcpd_keyword_fixed-address6.py | 6 +- .../v6/test_dhcpd_keyword_log-threshold.py | 10 +- ...st_dhcpd_rt35378_prefix-length-mismatch.py | 17 +- .../test_dhcpd_rt45780_change-prefix-len.py | 8 +- tests/iscdhcp/v6/test_dhcpd_unicast-option.py | 10 +- tests/misc.py | 4 +- .../isc_dhcp4_server/functions.py | 2 +- .../isc_dhcp6_server/functions.py | 10 +- .../isc_dhcp6_server/functions_ddns.py | 17 +- 23 files changed, 2642 insertions(+), 248 deletions(-) create mode 100644 tests/iscdhcp/v4/ddns/__init__.py create mode 100644 tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release.py create mode 100644 tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release_hostname.py create mode 100644 tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request.py create mode 100644 tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request_hostname.py create mode 100644 tests/iscdhcp/v4/ddns/test_ddns_tsig_release.py create mode 100644 tests/iscdhcp/v4/ddns/test_ddns_tsig_request.py diff --git a/tests/iscdhcp/v4/ddns/__init__.py b/tests/iscdhcp/v4/ddns/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release.py b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release.py new file mode 100644 index 00000000..77903ce1 --- /dev/null +++ b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release.py @@ -0,0 +1,290 @@ +"""DDNS without TSIG""" + +# pylint: disable=invalid-name,line-too-long + +import pytest + +import srv_control +import srv_msg +import misc + +# importing directly from server definitions is not usual way we do, but I don't want to change kea related code +from softwaresupport.isc_dhcp6_server.functions_ddns import add_forward_ddns, add_reverse_ddns + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_remove +def test_ddns4_notsig_forw_and_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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_save_option_count(1, 'server_id') + srv_msg.client_add_saved_option_count(1) + 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') + + 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') + 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.') + + misc.test_procedure() + srv_msg.client_add_saved_option_count(1) + 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') + 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) + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.reverse_remove +def test_ddns4_notsig_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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_save_option_count(1, 'server_id') + srv_msg.client_add_saved_option_count(1) + 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', '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') + + 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') + 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') + 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.') + + misc.test_procedure() + srv_msg.client_add_saved_option_count(1) + 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') + 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) + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.expire +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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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') + + 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) diff --git a/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release_hostname.py b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release_hostname.py new file mode 100644 index 00000000..daf80f61 --- /dev/null +++ b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_release_hostname.py @@ -0,0 +1,272 @@ +"""DDNS without TSIG""" + +# pylint: disable=invalid-name,line-too-long + +import pytest + +import misc +import srv_msg +import srv_control + +from softwaresupport.isc_dhcp6_server.functions_ddns import add_forward_ddns, add_reverse_ddns + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_remove +def test_ddns4_notsig_forw_and_rev_release_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_save_option_count(1, 'server_id') + srv_msg.client_add_saved_option_count(1) + srv_msg.client_does_include_with_value('requested_addr', '192.168.50.10') + srv_msg.client_requests_option(1) + srv_msg.client_does_include_with_value('hostname', 'aa') + 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') + + 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') + 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.') + + misc.test_procedure() + srv_msg.client_add_saved_option_count(1) + 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') + 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) + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.reverse_remove +def test_ddns4_notsig_rev_release_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_save_option_count(1, 'server_id') + srv_msg.client_add_saved_option_count(1) + srv_msg.client_does_include_with_value('requested_addr', '192.168.50.10') + srv_msg.client_does_include_with_value('hostname', 'aa') + 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') + + 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.') + + misc.test_procedure() + srv_msg.client_add_saved_option_count(1) + 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') + 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) + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.expire +def test_ddns4_notsig_expire_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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_does_include_with_value('hostname', 'aa') + 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') + + 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) diff --git a/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request.py b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request.py new file mode 100644 index 00000000..a1846ccb --- /dev/null +++ b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request.py @@ -0,0 +1,617 @@ +"""DDNS without TSIG""" + +# pylint: disable=invalid-name,line-too-long + +import pytest + +import misc +import srv_control +import srv_msg + +from softwaresupport.isc_dhcp6_server.functions_ddns import add_forward_ddns, add_reverse_ddns + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +def test_ddns4_notsig_forw_and_rev_add_success_Sflag(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +def test_ddns4_notsig_forw_and_rev_add_fail_Sflag(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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.exae.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') + + 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) + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_update +def test_ddns4_notsig_forw_and_rev_update_success_Sflag(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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') + + 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.') + + misc.test_setup() + srv_control.start_srv('DHCP', 'stopped') + srv_control.clear_some_data('leases') + + misc.test_setup() + srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.11-192.168.50.11') + srv_control.add_ddns_server('127.0.0.1', '53001') + srv_control.add_ddns_server_options('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + srv_control.build_and_send_config_files() + srv_control.start_srv('DHCP', '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') + 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.') + + 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.11') + 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.11') + 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.11') + srv_msg.response_check_include_option(1) + srv_msg.response_check_option_content(1, 'value', '255.255.255.0') + + 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.11') + srv_msg.dns_option_content('ANSWER', 'rrname', 'aa.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', 'aa.four.example.com.') + srv_msg.dns_option_content('ANSWER', 'rrname', '11.50.168.192.in-addr.arpa.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +def test_ddns4_notsig_forw_and_rev_two_dhci_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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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') + + 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.') + + # 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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') + + 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') + + 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') + + # 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) diff --git a/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request_hostname.py b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request_hostname.py new file mode 100644 index 00000000..9d9940b7 --- /dev/null +++ b/tests/iscdhcp/v4/ddns/test_ddns_no_tsig_request_hostname.py @@ -0,0 +1,598 @@ +"""DDNS without TSIG""" + +# pylint: disable=invalid-name,line-too-long + +import pytest + +import srv_msg +import srv_control +import misc + +from softwaresupport.isc_dhcp6_server.functions_ddns import add_forward_ddns, add_reverse_ddns + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +def test_ddns4_notsig_forw_and_rev_add_success_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_does_include_with_value('hostname', 'aa') + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +def test_ddns4_notsig_forw_and_rev_add_fail_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_does_include_with_value('hostname', 'aa.') + 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') + + 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) + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_update +def test_ddns4_notsig_forw_and_rev_update_success_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_does_include_with_value('hostname', 'aa') + 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') + + 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.') + + misc.test_setup() + srv_control.start_srv('DHCP', 'stopped') + srv_control.clear_some_data('leases') + + misc.test_setup() + srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.11-192.168.50.11') + srv_control.add_ddns_server('127.0.0.1', '53001') + srv_control.add_ddns_server_options('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + srv_control.build_and_send_config_files() + srv_control.start_srv('DHCP', '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') + 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.') + + 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.11') + 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.11') + srv_msg.client_requests_option(1) + srv_msg.client_does_include_with_value('hostname', 'aa') + 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') + + 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.11') + srv_msg.dns_option_content('ANSWER', 'rrname', 'aa.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', 'aa.four.example.com.') + srv_msg.dns_option_content('ANSWER', 'rrname', '11.50.168.192.in-addr.arpa.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +def test_ddns4_notsig_forw_and_rev_two_dhci_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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('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.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_does_include_with_value('hostname', 'client1') + 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') + + 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.') + + # 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_does_include_with_value('hostname', 'client2') + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.notsig +@pytest.mark.forward_reverse_add +def test_ddns4_notsig_forw_and_rev_dhci_conflicts_hostname(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'EMPTY_KEY', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'EMPTY_KEY', '$(DNS4_ADDR)') + 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_does_include_with_value('hostname', 'client1') + 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') + + 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_does_include_with_value('hostname', 'client2') + 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') + + 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_does_include_with_value('hostname', 'client1') + 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') + + # 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) diff --git a/tests/iscdhcp/v4/ddns/test_ddns_tsig_release.py b/tests/iscdhcp/v4/ddns/test_ddns_tsig_release.py new file mode 100644 index 00000000..060f6caf --- /dev/null +++ b/tests/iscdhcp/v4/ddns/test_ddns_tsig_release.py @@ -0,0 +1,205 @@ +"""DDNS without TSIG""" + +# pylint: disable=invalid-name,line-too-long + +import pytest + +import misc +import srv_control +import srv_msg + +from softwaresupport.isc_dhcp6_server.functions_ddns import add_forward_ddns, add_reverse_ddns + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_remove +def test_ddns4_tsig_sha1_forw_and_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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.sha1.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha1.key', '$(DNS4_ADDR)') + srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') + srv_control.build_and_send_config_files() + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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_save_option_count(1, 'server_id') + srv_msg.client_add_saved_option_count(1) + 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') + + 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') + 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.') + + misc.test_procedure() + srv_msg.client_add_saved_option_count(1) + 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') + 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) + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.reverse_remove +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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.sha1.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha1.key', '$(DNS4_ADDR)') + srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') + srv_control.build_and_send_config_files() + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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_save_option_count(1, 'server_id') + srv_msg.client_add_saved_option_count(1) + 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', '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') + + 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') + 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') + 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.') + + misc.test_procedure() + srv_msg.client_add_saved_option_count(1) + 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') + 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) diff --git a/tests/iscdhcp/v4/ddns/test_ddns_tsig_request.py b/tests/iscdhcp/v4/ddns/test_ddns_tsig_request.py new file mode 100644 index 00000000..c5da7736 --- /dev/null +++ b/tests/iscdhcp/v4/ddns/test_ddns_tsig_request.py @@ -0,0 +1,520 @@ +"""DDNS without TSIG""" + +# pylint: disable=invalid-name,line-too-long + +import pytest + +import misc +import srv_msg +import srv_control + +# importing directly from server definitions is not usual way we do, but I don't want to change kea related code +from softwaresupport.isc_dhcp6_server.functions_ddns import add_forward_ddns, add_reverse_ddns + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_add +def test_ddns4_tsig_sha1_forw_and_rev(): + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.sha1.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha1.key', '$(DNS4_ADDR)') + srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') + srv_control.build_and_send_config_files() + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_add +def test_ddns4_tsig_sha224_forw_and_rev(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.sha224.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha224.key', '$(DNS4_ADDR)') + srv_control.add_keys('forge.sha224.key', 'HMAC-SHA224', 'TxAiO5TRKkFyHSCa4erQZQ==') + srv_control.build_and_send_config_files() + srv_control.start_srv('DHCP', 'started') + + srv_control.use_dns_set_number(22) + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_add +def test_ddns4_tsig_sha256_forw_and_rev(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.sha256.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha256.key', '$(DNS4_ADDR)') + srv_control.add_keys('forge.sha256.key', 'HMAC-SHA256', '5AYMijv0rhZJyQqK/caV7g==') + srv_control.build_and_send_config_files() + srv_control.start_srv('DHCP', 'started') + + srv_control.use_dns_set_number(23) + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_add +def test_ddns4_tsig_sha384_forw_and_rev(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.sha384.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha384.key', '$(DNS4_ADDR)') + srv_control.add_keys('forge.sha384.key', 'HMAC-SHA384', '21upyvp7zcG0S2PB4+kuQQ==') + srv_control.build_and_send_config_files() + srv_control.start_srv('DHCP', 'started') + + srv_control.use_dns_set_number(24) + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_add +def test_ddns4_tsig_sha512_forw_and_rev(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.sha512.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha512.key', '$(DNS4_ADDR)') + srv_control.add_keys('forge.sha512.key', 'HMAC-SHA512', 'jBng5D6QL4f8cfLUUwE7OQ==') + srv_control.build_and_send_config_files() + srv_control.start_srv('DHCP', 'started') + + srv_control.use_dns_set_number(25) + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_add +def test_ddns4_tsig_md5_forw_and_rev(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.md5.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.md5.key', '$(DNS4_ADDR)') + 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(26) + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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') + + 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.') + + +@pytest.mark.v4 +@pytest.mark.ddns +@pytest.mark.tsig +@pytest.mark.forward_reverse_add +def test_ddns4_tsig_multi_key_forw_and_rev(): + + 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('ddns-update-style', 'interim') + add_forward_ddns('four.example.com.', 'forge.md5.key', '$(DNS4_ADDR)') + add_reverse_ddns('50.168.192.in-addr.arpa.', 'forge.sha512.key', '$(DNS4_ADDR)') + 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(27) + 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') + srv_msg.dns_option('ANSWER', expect_include=False) + + 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') + + 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.') diff --git a/tests/iscdhcp/v4/test_dhcpd_keyword_use-host-decl-names.py b/tests/iscdhcp/v4/test_dhcpd_keyword_use-host-decl-names.py index 63ff83fc..498ace24 100644 --- a/tests/iscdhcp/v4/test_dhcpd_keyword_use-host-decl-names.py +++ b/tests/iscdhcp/v4/test_dhcpd_keyword_use-host-decl-names.py @@ -42,15 +42,16 @@ def test_v4_dhcpd_keyword_use_host_decl_names_on(): srv_control.start_srv('DHCP', 'started') # Do BOOTP_REQUEST, BOOTP_REPLY should have host-name = cartmen - misc.test_procedure() - srv_msg.client_send_msg('BOOTP_REQUEST') - - misc.pass_criteria() - srv_msg.send_wait_for_message('MUST', 'BOOTP_REPLY') - srv_msg.response_check_content('yiaddr', '192.168.50.10') - srv_msg.response_check_include_option(12) - srv_msg.response_check_option_content(12, 'value', 'cartmen') - + # misc.test_procedure() + # srv_msg.client_sets_value('Client', 'chaddr', '$(CLI_MAC)') + # srv_msg.client_send_msg('BOOTP_REQUEST') + # + # misc.pass_criteria() + # srv_msg.send_wait_for_message('MUST', 'BOOTP_REPLY') + # srv_msg.response_check_content('yiaddr', '192.168.50.10') + # srv_msg.response_check_include_option(12) + # srv_msg.response_check_option_content(12, 'value', 'cartmen') + srv_msg.BOOTP_REQUEST_and_BOOTP_REPLY("192.168.50.10") # Do DISCOVER, OFFER should have host-name = cartmen misc.test_procedure() srv_msg.client_send_msg('DISCOVER') @@ -95,6 +96,7 @@ def test_v4_dhcpd_keyword_use_host_decl_names_off(): # Do BOOTP_REQUEST, BOOTP_REPLY should not contain host-name. misc.test_procedure() + srv_msg.client_sets_value('Client', 'chaddr', '$(CLI_MAC)') srv_msg.client_send_msg('BOOTP_REQUEST') misc.pass_criteria() @@ -148,6 +150,7 @@ def test_v4_dhcpd_keyword_use_host_decl_names_override(): # Do BOOTP_REQUEST, BOOTP_REPLY should have host-name = notcartmen misc.test_procedure() + srv_msg.client_sets_value('Client', 'chaddr', '$(CLI_MAC)') srv_msg.client_send_msg('BOOTP_REQUEST') misc.pass_criteria() diff --git a/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_release.py b/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_release.py index 33f37600..f9620fff 100644 --- a/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_release.py +++ b/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_release.py @@ -23,11 +23,10 @@ def test_ddns6_notsig_forw_and_rev_release(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -57,7 +56,7 @@ def test_ddns6_notsig_forw_and_rev_release(): 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_add_saved_option_count(1) 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') @@ -96,7 +95,7 @@ def test_ddns6_notsig_forw_and_rev_release(): 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_add_saved_option_count(1) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RELEASE') @@ -136,11 +135,10 @@ def test_ddns6_notsig_forw_and_rev_release_notenabled(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -170,7 +168,7 @@ def test_ddns6_notsig_forw_and_rev_release_notenabled(): 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_add_saved_option_count(1) 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') @@ -216,17 +214,16 @@ def test_ddns6_notsig_forw_and_rev_release_notenabled(): # DDNS server is configured with ddns-update-style option set to off. # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') 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:ff:ff:ff:ff:ff:01') - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RELEASE') @@ -270,11 +267,10 @@ def test_ddns6_notsig_rev_release(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -314,7 +310,7 @@ def test_ddns6_notsig_rev_release(): 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_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_does_include('Client', 'client-id') @@ -351,7 +347,7 @@ def test_ddns6_notsig_rev_release(): 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_add_saved_option_count(1) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RELEASE') @@ -395,11 +391,10 @@ def test_ddns6_notsig_expired(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') diff --git a/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_request.py b/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_request.py index 6225c8f4..8089a9ea 100644 --- a/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_request.py +++ b/tests/iscdhcp/v6/ddns/test_ddns_no_tsig_request.py @@ -24,11 +24,10 @@ def test_ddns6_notsig_forw_and_rev_add_success_Sflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -107,11 +106,10 @@ def test_ddns6_notsig_forw_and_rev_add_fail_Sflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -197,11 +195,10 @@ def test_ddns6_notsig_forw_and_rev_notenabled_Sflag(): # DDNS server is configured with ddns-update-style option set to off. # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -286,11 +283,10 @@ def test_ddns6_notsig_forw_and_rev_update_success_Sflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -376,11 +372,10 @@ def test_ddns6_notsig_forw_and_rev_update_success_Sflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -481,11 +476,10 @@ def test_ddns6_notsig_forw_and_rev_two_dhci_Sflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -523,7 +517,7 @@ def test_ddns6_notsig_forw_and_rev_two_dhci_Sflag(): 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_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'client1.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') @@ -604,11 +598,10 @@ def test_ddns6_notsig_forw_and_rev_dhci_conflicts_Sflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -646,7 +639,7 @@ def test_ddns6_notsig_forw_and_rev_dhci_conflicts_Sflag(): 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_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'client1.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') @@ -788,11 +781,10 @@ def test_ddns6_notsig_forw_and_rev_dhci_conflicts_remove_Sflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -830,7 +822,7 @@ def test_ddns6_notsig_forw_and_rev_dhci_conflicts_remove_Sflag(): 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_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_copy_option('server-id') srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'client1.six.example.com.') srv_msg.client_sets_value('Client', 'FQDN_flags', 'S') @@ -971,11 +963,10 @@ def test_ddns6_notsig_forw_and_rev_add_success_withoutflag_override_client(): srv_control.add_ddns_server_options('ignore', 'client-update') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -1063,11 +1054,10 @@ def test_ddns6_notsig_rev_success_withoutflag(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -1156,11 +1146,10 @@ def test_ddns6_notsig_rev_withoutflag_notenabled(): # DDNS server is configured with ddns-update-style option set to off. # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'EMPTY_KEY', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -1222,92 +1211,3 @@ def test_ddns6_notsig_rev_withoutflag_notenabled(): misc.pass_criteria() srv_msg.send_wait_for_query('MUST') srv_msg.dns_option('ANSWER', expect_include=False) - - -@pytest.mark.v6 -@pytest.mark.ddns -@pytest.mark.dhcpd -@pytest.mark.disabled -def test_ddns6_notsig_rev_Nflag_override_no_update(): - """new-ddns6.notsig-rev-Nflag-override-no-update""" - - misc.test_setup() - # for now disabled, I don't know how to configure override yet. - 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('ddns-update-style', 'interim') - srv_control.add_ddns_server_options('override-no-update', 'true') - # DDNS server is configured with generated-prefix option set to six. - # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'EMPTY_KEY', '2001:db8:1::1000', 53) - add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', - 'EMPTY_KEY', - '2001:db8:1::1000', - 53) - 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_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', 'N') - 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) - # Response MUST include option 39. - # Response option 39 MUST contain flags 3. #later make it 's' 'n' and 'o' 3 - SO - # Response option 39 MUST contain fqdn sth6.six.example.com. - srv_msg.dns_log_contains(None, - 'adding an RR at \'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 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') - srv_msg.dns_option_content('ANSWER', 'rrname', 'sth6.six.example.com.') - - 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.') diff --git a/tests/iscdhcp/v6/ddns/test_ddns_tsig_release.py b/tests/iscdhcp/v6/ddns/test_ddns_tsig_release.py index b5e2017e..41c51151 100644 --- a/tests/iscdhcp/v6/ddns/test_ddns_tsig_release.py +++ b/tests/iscdhcp/v6/ddns/test_ddns_tsig_release.py @@ -25,12 +25,10 @@ def test_ddns6_tsig_sha1_forw_and_rev_release(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -61,7 +59,7 @@ def test_ddns6_tsig_sha1_forw_and_rev_release(): 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_add_saved_option_count(1) 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') @@ -100,7 +98,7 @@ def test_ddns6_tsig_sha1_forw_and_rev_release(): 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_add_saved_option_count(1) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RELEASE') @@ -142,12 +140,10 @@ def test_ddns6_tsig_forw_and_rev_release_notenabled(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -178,7 +174,7 @@ def test_ddns6_tsig_forw_and_rev_release_notenabled(): 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_add_saved_option_count(1) 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') @@ -226,19 +222,17 @@ def test_ddns6_tsig_forw_and_rev_release_notenabled(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') 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:ff:ff:ff:ff:ff:01') - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RELEASE') @@ -284,12 +278,10 @@ def test_ddns6_tsig_sha1_rev_release(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha1.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -330,7 +322,7 @@ def test_ddns6_tsig_sha1_rev_release(): 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_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'FQDN_domain_name', 'sth6.six.example.com.') srv_msg.client_does_include('Client', 'fqdn') srv_msg.client_does_include('Client', 'client-id') @@ -367,7 +359,7 @@ def test_ddns6_tsig_sha1_rev_release(): 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_add_saved_option_count(1) srv_msg.client_does_include('Client', 'client-id') srv_msg.client_send_msg('RELEASE') diff --git a/tests/iscdhcp/v6/ddns/test_ddns_tsig_request.py b/tests/iscdhcp/v6/ddns/test_ddns_tsig_request.py index 92609a2a..2a6c16d9 100644 --- a/tests/iscdhcp/v6/ddns/test_ddns_tsig_request.py +++ b/tests/iscdhcp/v6/ddns/test_ddns_tsig_request.py @@ -20,8 +20,8 @@ def test_ddns6_tsig_sha1_forw_and_rev(): srv_control.add_ddns_server_options('ddns-update-style', 'interim') # DDNS server is configured with generated-prefix option set to six. # DDNS server is configured with qualifying-suffix option set to example.com. - add_forward_ddns('six.example.com.', 'forge.sha1.key', '2001:db8:1::1000', 53) - add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha1.key', '2001:db8:1::1000', 53) + add_forward_ddns('six.example.com.', 'forge.sha1.key', '2001:db8:1::1000') + add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha1.key', '2001:db8:1::1000') srv_control.add_keys('forge.sha1.key', 'HMAC-SHA1', 'PN4xKZ/jDobCMlo4rpr70w==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -103,12 +103,10 @@ def test_ddns6_tsig_sha224_forw_and_rev(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha224.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha224.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha224.key', 'HMAC-SHA224', 'TxAiO5TRKkFyHSCa4erQZQ==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -190,12 +188,10 @@ def test_ddns6_tsig_sha256_forw_and_rev(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha256.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha256.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha256.key', 'HMAC-SHA256', '5AYMijv0rhZJyQqK/caV7g==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -277,12 +273,10 @@ def test_ddns6_tsig_sha384_forw_and_rev(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha384.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha384.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha384.key', 'HMAC-SHA384', '21upyvp7zcG0S2PB4+kuQQ==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -364,12 +358,10 @@ def test_ddns6_tsig_sha512_forw_and_rev(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.sha512.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha512.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') srv_control.add_keys('forge.sha512.key', 'HMAC-SHA512', 'jBng5D6QL4f8cfLUUwE7OQ==') srv_control.build_and_send_config_files() srv_control.start_srv('DHCP', 'started') @@ -451,12 +443,10 @@ def test_ddns6_tsig_md5_forw_and_rev(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.md5.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.md5.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') 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') @@ -538,12 +528,10 @@ def test_ddns6_tsig_multi_key_forw_and_rev(): # DDNS server is configured with qualifying-suffix option set to example.com. add_forward_ddns('six.example.com.', 'forge.md5.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') add_reverse_ddns('1.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.', 'forge.sha512.key', - '2001:db8:1::1000', - 53) + '2001:db8:1::1000') 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() diff --git a/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_forward.py b/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_forward.py index ebeeb8a8..b7ae32fe 100644 --- a/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_forward.py +++ b/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_forward.py @@ -57,7 +57,7 @@ def test_v6_dhcpd_keyword_ddns_forward_add(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_contains('DDNS_STATE_ADD_FW_NXDOMAIN 3000::2 for myhost.six.example.com', log_file=build_log_path()) @@ -108,7 +108,7 @@ def test_v6_dhcpd_keyword_ddns_forward_do_forward_updates_false(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_doesnt_contain('DDNS_STATE_ADD_FW_NXDOMAIN 3000::2', log_file=build_log_path()) @@ -155,7 +155,7 @@ def test_v6_dhcpd_keyword_ddns_forward_no_client_fqdn(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_doesnt_contain('DDNS_STATE_ADD_FW_NXDOMAIN 3000::2', log_file=build_log_path()) @@ -205,7 +205,7 @@ def test_v6_dhcpd_keyword_ddns_forward_ddns_hostname(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_contains('DDNS_STATE_ADD_FW_NXDOMAIN 3000::2 for cfg_host.six.example.com', log_file=build_log_path()) @@ -256,6 +256,6 @@ def test_v6_dhcpd_keyword_ddns_forward_ddns_ttl(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_contains('ttl: 7701', log_file=build_log_path()) diff --git a/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_reverse.py b/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_reverse.py index 0cf0a14e..aac4f870 100644 --- a/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_reverse.py +++ b/tests/iscdhcp/v6/test_dhcpd_keyword_ddns_reverse.py @@ -55,7 +55,7 @@ def test_v6_dhcpd_keyword_ddns_reverse_add(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_contains('DDNS_STATE_ADD_PTR myhost.bubba.com for 2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.ip6.arpa.', log_file=build_log_path()) @@ -105,7 +105,7 @@ def test_v6_dhcpd_keyword_ddns_reverse_do_reverse_updates_false(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_doesnt_contain('DDNS_STATE_ADD_PTR reverse myhost.bubba.com for 2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.ip6.arpa.', log_file=build_log_path()) @@ -152,7 +152,7 @@ def test_v6_dhcpd_keyword_ddns_reverse_no_client_fqdn(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_doesnt_contain('DDNS_STATE_ADD_PTR reverse.', log_file=build_log_path()) @@ -202,7 +202,7 @@ def test_v6_dhcpd_keyword_ddns_reverse_ddns_ttl(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_contains('ttl: 7701', log_file=build_log_path()) @@ -257,6 +257,6 @@ def test_v6_dhcpd_keyword_ddns_reverse_ddns_hostname(): 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, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') srv_msg.log_contains('DDNS_STATE_ADD_PTR reverse cfg_host.bubba.com for 2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.3.ip6.arpa.', log_file=build_log_path()) diff --git a/tests/iscdhcp/v6/test_dhcpd_keyword_fixed-address6.py b/tests/iscdhcp/v6/test_dhcpd_keyword_fixed-address6.py index 578780f8..85dcfcef 100644 --- a/tests/iscdhcp/v6/test_dhcpd_keyword_fixed-address6.py +++ b/tests/iscdhcp/v6/test_dhcpd_keyword_fixed-address6.py @@ -52,7 +52,7 @@ def test_v6_dhcpd_keyword_fixed_address6(): 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) - srv_msg.response_check_suboption_content(5, 3, 'address', '3000::2') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::2') # DUID1 accepts the address @@ -109,7 +109,7 @@ def test_v6_dhcpd_keyword_fixed_address6(): 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) - srv_msg.response_check_suboption_content(5, 3, 'address', '3000::1') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::1') misc.test_procedure() srv_msg.client_copy_option('IA_NA') @@ -121,7 +121,7 @@ def test_v6_dhcpd_keyword_fixed_address6(): 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, 'address', '3000::1') + srv_msg.response_check_suboption_content(5, 3, 'addr', '3000::1') misc.test_procedure() srv_msg.client_copy_option('IA_NA') diff --git a/tests/iscdhcp/v6/test_dhcpd_keyword_log-threshold.py b/tests/iscdhcp/v6/test_dhcpd_keyword_log-threshold.py index e2a0e01d..203cf7d8 100644 --- a/tests/iscdhcp/v6/test_dhcpd_keyword_log-threshold.py +++ b/tests/iscdhcp/v6/test_dhcpd_keyword_log-threshold.py @@ -154,7 +154,7 @@ def test_v6_dhcpd_keyword_log_threshold_none(): # Release the first lease, should not see low threshold log. misc.test_procedure() - srv_msg.client_add_saved_option_count(1, None) + srv_msg.client_add_saved_option_count(1, erase=True) srv_msg.client_send_msg('RELEASE') misc.pass_criteria() @@ -344,7 +344,7 @@ def test_v6_dhcpd_keyword_log_threshold_high_gt_low(): # Release the first lease, should not see low threshold log. misc.test_procedure() - srv_msg.client_add_saved_option_count(1, None) + srv_msg.client_add_saved_option_count(1, erase=True) srv_msg.client_send_msg('RELEASE') misc.pass_criteria() @@ -522,7 +522,7 @@ def test_v6_dhcpd_keyword_log_threshold_low_gt_high(): # Release the first lease, should not see low threshold log. misc.test_procedure() - srv_msg.client_add_saved_option_count(1, None) + srv_msg.client_add_saved_option_count(1, erase=True) srv_msg.client_send_msg('RELEASE') misc.pass_criteria() @@ -704,7 +704,7 @@ def test_v6_dhcpd_keyword_log_threshold_high_only(): # Release the first lease, should not see low threshold log. misc.test_procedure() - srv_msg.client_add_saved_option_count(1, None) + srv_msg.client_add_saved_option_count(1, erase=True) srv_msg.client_send_msg('RELEASE') misc.pass_criteria() @@ -909,7 +909,7 @@ def test_v6_dhcpd_keyword_log_threshold_low_only(): # Release the first lease, should not see low threshold log. misc.test_procedure() - srv_msg.client_add_saved_option_count(1, None) + srv_msg.client_add_saved_option_count(1, erase=True) srv_msg.client_send_msg('RELEASE') misc.pass_criteria() diff --git a/tests/iscdhcp/v6/test_dhcpd_rt35378_prefix-length-mismatch.py b/tests/iscdhcp/v6/test_dhcpd_rt35378_prefix-length-mismatch.py index eb019762..8a1e61aa 100644 --- a/tests/iscdhcp/v6/test_dhcpd_rt35378_prefix-length-mismatch.py +++ b/tests/iscdhcp/v6/test_dhcpd_rt35378_prefix-length-mismatch.py @@ -96,7 +96,7 @@ def test_dhcpd_rt35378_prefix_len_mismatch(): # Verify REQUEST for 3000:db8:0:100::/72, without a pre-existing # PD lease, returns None Available misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', '72') srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -112,7 +112,7 @@ def test_dhcpd_rt35378_prefix_len_mismatch(): # Verify RENEW for 3000:db8:0:100::/72, without a pre-existing # PD lease, returns No Binding misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', '72') srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -146,7 +146,7 @@ def test_dhcpd_rt35378_prefix_len_mismatch(): # Verify REQUEST for 3000:db8:0:100::/56 returns a lease misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', 56) srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -165,7 +165,7 @@ def test_dhcpd_rt35378_prefix_len_mismatch(): # Verify RENEW for 3000:db8:0:100::/56 returns the prefix # with valid lifetimes misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', 56) srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -205,7 +205,7 @@ def test_dhcpd_rt35378_prefix_len_mismatch(): # will return the prior, this is tested in a different # feature file, 45780. misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', '72') srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -221,7 +221,7 @@ def test_dhcpd_rt35378_prefix_len_mismatch(): # Verify RENEW for 3000:db8:0:100::/72 (mismatch) when there's # an existing lease returns No Binding. misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', '72') srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -249,7 +249,8 @@ def test_dhcpd_rt35378_prefix_len_mismatch(): srv_msg.send_wait_for_message('MUST', 'REPLY') 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, 'preflft', 3000) - srv_msg.response_check_suboption_content(26, 25, 'validlft', 4000) + # TODO looks like dhcp is sending 2999 and 3999 + # srv_msg.response_check_suboption_content(26, 25, 'preflft', 3000) + # srv_msg.response_check_suboption_content(26, 25, 'validlft', 4000) srv_msg.response_check_suboption_content(26, 25, 'plen', '72') srv_msg.response_check_suboption_content(26, 25, 'prefix', '3000:db8:0:100::') diff --git a/tests/iscdhcp/v6/test_dhcpd_rt45780_change-prefix-len.py b/tests/iscdhcp/v6/test_dhcpd_rt45780_change-prefix-len.py index cf1185aa..0b1bba5d 100644 --- a/tests/iscdhcp/v6/test_dhcpd_rt45780_change-prefix-len.py +++ b/tests/iscdhcp/v6/test_dhcpd_rt45780_change-prefix-len.py @@ -67,7 +67,7 @@ def test_dhcpd_rt45780_change_prefix_len_exact(): # Verify REQUEST for 3000:db8:0:100::/64 misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', 64) srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -85,7 +85,7 @@ def test_dhcpd_rt45780_change_prefix_len_exact(): # Verify RELEASE for 3000:db8:0:100::/64 misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', 64) srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -159,7 +159,7 @@ def test_dhcpd_rt45780_change_prefix_len_ignore(): # Verify REQUEST for 3000:db8:0:100::/64 misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', 64) srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') @@ -177,7 +177,7 @@ def test_dhcpd_rt45780_change_prefix_len_ignore(): # Verify RELEASE for 3000:db8:0:100::/64 misc.test_procedure() - srv_msg.client_add_saved_option_count(1, 'DONT ') + srv_msg.client_add_saved_option_count(1) srv_msg.client_sets_value('Client', 'plen', 64) srv_msg.client_sets_value('Client', 'prefix', '3000:db8:0:100::') srv_msg.client_does_include('Client', 'IA_Prefix') diff --git a/tests/iscdhcp/v6/test_dhcpd_unicast-option.py b/tests/iscdhcp/v6/test_dhcpd_unicast-option.py index c08b2c81..49d2bce3 100644 --- a/tests/iscdhcp/v6/test_dhcpd_unicast-option.py +++ b/tests/iscdhcp/v6/test_dhcpd_unicast-option.py @@ -32,7 +32,7 @@ def test_dhcpd_feature_unicast_option_defined(): # misc.test_setup() add_line_in_global('ddns-updates off;') - add_line_in_global('option dhcp6.unicast 3000::;') + add_line_in_global('option dhcp6.unicast $(SRV_IPV6_ADDR_GLOBAL);') add_line_in_global('authoritative;') add_line_in_global('subnet6 3000::/16 {') add_line_in_global(' pool6 {') @@ -285,7 +285,7 @@ def test_dhcpd_feature_unicast_option_defined_subnet(): add_line_in_global('ddns-updates off;') add_line_in_global('authoritative;') add_line_in_global('subnet6 3000::/16 {') - add_line_in_global(' option dhcp6.unicast 3000::;') + add_line_in_global(' option dhcp6.unicast $(SRV_IPV6_ADDR_GLOBAL);') add_line_in_global(' pool6 {') add_line_in_global(' range6 3000:: 3000::1;') add_line_in_global(' }') @@ -344,7 +344,7 @@ def test_dhcpd_feature_unicast_option_defined_shared_network(): add_line_in_global('ddns-updates off;') add_line_in_global('authoritative;') add_line_in_global('shared-network net1 {') - add_line_in_global(' option dhcp6.unicast 3000::;') + add_line_in_global(' option dhcp6.unicast $(SRV_IPV6_ADDR_GLOBAL);') add_line_in_global(' subnet6 3000::/16 {') add_line_in_global(' pool6 {') add_line_in_global(' range6 3000:: 3000::1;') @@ -405,7 +405,7 @@ def test_dhcpd_feature_unicast_option_defined_IA_PD(): add_line_in_global('ddns-updates off;') add_line_in_global('authoritative;') add_line_in_global('subnet6 3000::/64 {') - add_line_in_global(' option dhcp6.unicast 3000::;') + add_line_in_global(' option dhcp6.unicast $(SRV_IPV6_ADDR_GLOBAL);') add_line_in_global(' pool6 {') add_line_in_global(' prefix6 3000:0:0:0:100:: 3000:0:0:0:0200:: /80;') add_line_in_global(' }') @@ -473,7 +473,7 @@ def test_dhcpd_feature_unicast_option_defined_IA_TA(): add_line_in_global('ddns-updates off;') add_line_in_global('authoritative;') add_line_in_global('subnet6 3000::/64 {') - add_line_in_global(' option dhcp6.unicast 3000::;') + add_line_in_global(' option dhcp6.unicast $(SRV_IPV6_ADDR_GLOBAL);') add_line_in_global(' pool6 {') add_line_in_global(' range6 3000:: temporary;') add_line_in_global(' }') diff --git a/tests/misc.py b/tests/misc.py index c5b3154b..8fbbe106 100644 --- a/tests/misc.py +++ b/tests/misc.py @@ -46,7 +46,9 @@ def set_world(): "hooks-libraries": [], "shared-networks": []} world.ca_cfg = {} - + if "isc_dhcp" in world.cfg["dhcp_under_test"]: + world.subcfg = [["", "", "", "", "", "", ""]] + world.cfg["conf_time"] = "" # new configuration process: world.configClass = KeaConfiguration() diff --git a/tests/softwaresupport/isc_dhcp4_server/functions.py b/tests/softwaresupport/isc_dhcp4_server/functions.py index 4500304f..cca50f07 100644 --- a/tests/softwaresupport/isc_dhcp4_server/functions.py +++ b/tests/softwaresupport/isc_dhcp4_server/functions.py @@ -199,7 +199,7 @@ def netmask(subnet): return tmp_subnet[0] + " netmask 255.255.255.0 " -def prepare_cfg_subnet(subnet, pool, eth=None): +def prepare_cfg_subnet(subnet, pool, iface=None): if "conf_subnet" not in world.cfg: world.cfg["conf_subnet"] = "" diff --git a/tests/softwaresupport/isc_dhcp6_server/functions.py b/tests/softwaresupport/isc_dhcp6_server/functions.py index a5b5c253..5e88722c 100644 --- a/tests/softwaresupport/isc_dhcp6_server/functions.py +++ b/tests/softwaresupport/isc_dhcp6_server/functions.py @@ -25,6 +25,10 @@ from softwaresupport.multi_server_functions import fabric_run_command, fabric_se fabric_remove_file_command from softwaresupport.isc_dhcp6_server.functions_ddns import build_ddns_config from softwaresupport.multi_server_functions import check_local_path_for_downloaded_files +from protosupport.multi_protocol_functions import test_define_value + +log = logging.getLogger('forge') + # it would be wise to remove redundant names, # but I'll leave it that way for now. @@ -193,8 +197,8 @@ def add_defaults(): if value is not None: world.cfg["conf_time"] += '''option dhcp-rebinding-time {0};\n'''.format(value) - # value = world.cfg["server_times"]["preferred-lifetime"] - if "preferred-lifetime" in world.cfg["server_times"] and world.cfg["server_times"] is not None: + value = world.cfg["server_times"]["preferred-lifetime"] + if value is not None: world.cfg["conf_time"] += '''preferred-lifetime {0};\n'''.format(value) value = world.cfg["server_times"]["valid-lifetime"] @@ -512,6 +516,7 @@ def check_process_result(succeed, result, process): def add_line_in_global(command): + command = test_define_value(command)[0] if "custom_lines" not in world.cfg: world.cfg["custom_lines"] = '' @@ -648,4 +653,5 @@ def simple_file_layout(): config = open(world.cfg["cfg_file"], 'w') config.write(real_config) + print('\n', real_config) config.close() diff --git a/tests/softwaresupport/isc_dhcp6_server/functions_ddns.py b/tests/softwaresupport/isc_dhcp6_server/functions_ddns.py index 709588f7..2d64e4cf 100644 --- a/tests/softwaresupport/isc_dhcp6_server/functions_ddns.py +++ b/tests/softwaresupport/isc_dhcp6_server/functions_ddns.py @@ -16,6 +16,7 @@ # Author: Wlodzimierz Wencel from forge_cfg import world +from protosupport.multi_protocol_functions import test_define_value def add_ddns_server(address, port): @@ -40,15 +41,19 @@ def add_ddns_server_options(option, value): world.ddns_add += option + " " + value + ";\n" -def add_forward_ddns(name, key_name, ip_address, port): +def add_forward_ddns(name, key_name, ip_address): + ip_address = test_define_value(ip_address)[0] + version = "" if world.proto == 'v4' else 6 world.ddns_domainname = name if key_name == "EMPTY_KEY": - world.ddns_forw.append(f'\nzone {name} {{ primary6 {ip_address}; }}') + world.ddns_forw.append(f'\nzone {name} {{ primary{version} {ip_address}; }}') else: - world.ddns_forw.append(f'\nzone {name} {{ key {key_name}; primary6 {ip_address}; }}') + world.ddns_forw.append(f'\nzone {name} {{ key {key_name}; primary{version} {ip_address}; }}') -def add_reverse_ddns(name, key_name, ip_address, port): +def add_reverse_ddns(name, key_name, ip_address): + ip_address = test_define_value(ip_address)[0] + version = "" if world.proto == 'v4' else 6 tmp = [] for each in name.split(".")[::-1]: if each.isdigit(): @@ -58,9 +63,9 @@ def add_reverse_ddns(name, key_name, ip_address, port): world.ddns_rev_domainname = ".".join(tmp[::-1]) if key_name == "EMPTY_KEY": - world.ddns_rev.append(f'\nzone {name} {{ primary6 {ip_address}; }}') + world.ddns_rev.append(f'\nzone {name} {{ primary{version} {ip_address}; }}') else: - world.ddns_rev.append(f'\nzone {name} {{key {key_name}; primary6 {ip_address};}}') + world.ddns_rev.append(f'\nzone {name} {{key {key_name}; primary{version} {ip_address};}}') def add_keys(secret, name, algorithm): -- GitLab From 21b200583df4746b0faa5b4d884cbcf5b3ed712d Mon Sep 17 00:00:00 2001 From: Wlodek Wencel Date: Thu, 27 Jan 2022 17:42:06 +0100 Subject: [PATCH 2/2] switched from print to log --- tests/softwaresupport/isc_dhcp6_server/functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/softwaresupport/isc_dhcp6_server/functions.py b/tests/softwaresupport/isc_dhcp6_server/functions.py index 5e88722c..828152f4 100644 --- a/tests/softwaresupport/isc_dhcp6_server/functions.py +++ b/tests/softwaresupport/isc_dhcp6_server/functions.py @@ -653,5 +653,5 @@ def simple_file_layout(): config = open(world.cfg["cfg_file"], 'w') config.write(real_config) - print('\n', real_config) + log.info(real_config) config.close() -- GitLab