Beispiel #1
0
def test_v6_server_id_llt():

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    misc.test_procedure()
    srv_msg.client_does_include('Client', 'client-id')
    srv_msg.client_does_include('Client', 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', 'ADVERTISE')
    srv_msg.response_check_include_option(1)
    srv_msg.response_check_option_content(
        1,
        'duid',
        '00:01:00:01:52:7b:a8:f0:08:00:27:58:f1:e8',
        expect_include=False)
    srv_msg.response_check_include_option(2)
    srv_msg.response_check_option_content(
        2, 'duid', '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
Beispiel #2
0
def test_v6_server_id_ll():

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_id('LL', '00:03:00:01:ff:ff:ff:ff:ff:01')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv('DHCP', 'started')

    misc.test_procedure()
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_option_content('Response',
                                          '2',
                                          None,
                                          'duid',
                                          '00:03:00:01:ff:ff:ff:ff:ff:01')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_option_content('Response',
                                          '1',
                                          'NOT ',
                                          'duid',
                                          '00:03:00:01:ff:ff:ff:ff:ff:01')
def test_control_channel_socket_config_test():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::f')
    srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
    # To global section of the config add file line: "expired-leases-processing":{"flush-reclaimed-timer-wait-time": 0,"hold-reclaimed-time": 0,"max-reclaim-leases": 100,"max-reclaim-time": 0,"reclaim-timer-wait-time": 0,"unwarned-reclaim-cycles": 5}
    # To global section of the config add file line: "expired-leases-processing":{"flush-reclaimed-timer-wait-time": 0,"hold-reclaimed-time": 0,"max-reclaim-leases": 100,"max-reclaim-time": 0,"reclaim-timer-wait-time": 0,"unwarned-reclaim-cycles": 5}

    srv_control.build_and_send_config_files('SSH', 'config-file')

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

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::f')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.open_control_channel('unix',
                                     '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket_ANOTHER_ONE')
    srv_control.config_srv_id('LLT', '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone', r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    srv_control.host_reservation_in_subnet('address',
                                           '3000::1',
                                           '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    # Sleep for 10 seconds.
    srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
                                            '{"command": "config-test","arguments": $(SERVER_CONFIG) }')
    # should be ok

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::f')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.open_control_channel('unix',
                                     '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket_ANOTHER_ONE')
    srv_control.config_srv_id('LLT', '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone', r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    # WRONG ADDRESS RESERVATION
    srv_control.host_reservation_in_subnet('address',
                                           '192.168.0.5',
                                           '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()
    #
    srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
                                            '{"command": "config-test","arguments": $(SERVER_CONFIG) }')
def test_control_channel_socket_config_test():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::f')
    srv_control.open_control_channel()
    # To global section of the config add file line: "expired-leases-processing":{"flush-reclaimed-timer-wait-time": 0,"hold-reclaimed-time": 0,"max-reclaim-leases": 100,"max-reclaim-time": 0,"reclaim-timer-wait-time": 0,"unwarned-reclaim-cycles": 5}
    # To global section of the config add file line: "expired-leases-processing":{"flush-reclaimed-timer-wait-time": 0,"hold-reclaimed-time": 0,"max-reclaim-leases": 100,"max-reclaim-time": 0,"reclaim-timer-wait-time": 0,"unwarned-reclaim-cycles": 5}

    srv_control.build_and_send_config_files()

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

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::f')
    srv_control.config_srv_prefix('2001:db8:1::', 0, 90, 96)
    srv_control.open_control_channel('control_socket_ANOTHER_ONE')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone',
                               'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    srv_control.host_reservation_in_subnet('ip-address', '3000::1', 0, 'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    # Sleep for 10 seconds.
    srv_msg.send_ctrl_cmd_via_socket(
        '{"command": "config-test","arguments": $(DHCP_CONFIG) }')
    # should be ok

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::f')
    srv_control.config_srv_prefix('2001:db8:1::', 0, 90, 96)
    srv_control.open_control_channel('control_socket_ANOTHER_ONE')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone',
                               'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    # WRONG ADDRESS RESERVATION
    srv_control.host_reservation_in_subnet('ip-address', '192.168.0.5', 0,
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()
    #
    srv_msg.send_ctrl_cmd_via_socket(
        '{"command": "config-test","arguments": $(DHCP_CONFIG) }',
        exp_result=1)
Beispiel #5
0
def test_2019_6472_subscriber_id():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    for msg in ["REQUEST", "RENEW", "RELEASE"]:
        srv_msg.client_does_include('Client', 'client-id')
        # first let's add server id
        invalid_data = "\x00\x02\x00\x0e\x00\x01\x00\x02\x52\x7b\xa8\xf0\x08\x00\x27\x58\xf1\xe8"
        # and incorrect subscriber-id
        invalid_data += "\x00\x26\x01\x90\x00\x01\x00\x01\x24\xe9\x4e\x2a\x08\x00\x27\x4a\x04\x65" + 386 * "\x11"
        srv_msg.send_raw_message(msg_type=msg, raw_append=invalid_data)

        srv_msg.send_wait_for_message('MUST', "REPLY")
Beispiel #6
0
def test_v6_server_id_en():

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_id('EN', '00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    misc.test_procedure()
    srv_msg.client_does_include('Client', 'client-id')
    srv_msg.client_does_include('Client', 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', 'ADVERTISE')
    srv_msg.response_check_include_option(2)
    # Response option 2 MUST contain duid 00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45.
    srv_msg.response_check_include_option(1)
Beispiel #7
0
def test_v6_server_id_en():

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_id('EN', '00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv('DHCP', 'started')

    misc.test_procedure()
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '2')
    # Response option 2 MUST contain duid 00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45.
    srv_msg.response_check_include_option('Response', None, '1')
Beispiel #8
0
def test_2019_6472_subscriber_id_relay():
    # because of some reason scapy is crashing while parsing response, kea works correctly though.
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    # correct relay-forward
    killer_message = "\x0c\x01\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x05\xfe\x80\x00\x00\x00\x00\x00\x00\x0a\x00\x27\xff\xfe\x6d\xee\x67\x00\x25\x00\x04\x00\x00\x02\x9a"
    # incorrect subscriber-id
    killer_message += "\x00\x26\x01\x90\x00\x01\x00\x01\x24\xe9\x4e\x2a\x08\x00\x27\x4a\x04\x65" + 386 * "\x11"
    # correct relayed message
    killer_message += "\x00\x12\x00\x03\x61\x62\x63\x00\x09\x00\x5a\x03\xea\x4b\x95\x00\x06\x00\x02\x00\x07\x00\x03\x00\x28\x00\x01\x2d\xca\x00\x00\x00\x64\x00\x00\x00\xc8\x00\x05\x00\x18\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x01\x90\x00\x00\x02\x58\x00\x02\x00\x0e\x00\x01\x00\x02\x52\x7b\xa8\xf0\x08\x00\x27\x58\xf1\xe8\x00\x01\x00\x0e\x00\x01\x00\x01\x52\x7b\xa8\xf0\xf6\xf5\xf4\xf3\xf2\x01"

    misc.pass_criteria()
    srv_msg.send_raw_message(raw_append=killer_message)
    srv_msg.send_wait_for_message('MUST', 'RELAYREPLY')
Beispiel #9
0
def test_v6_server_id_ll():

    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::ff')
    srv_control.config_srv_id('LL', '00:03:00:01:ff:ff:ff:ff:ff:01')
    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv('DHCP', 'started')

    misc.test_procedure()
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_option_content('Response', '2', None, 'duid',
                                          '00:03:00:01:ff:ff:ff:ff:ff:01')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_option_content('Response', '1', 'NOT ', 'duid',
                                          '00:03:00:01:ff:ff:ff:ff:ff:01')
def test_control_channel_keashell_test_config():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::1')
    srv_control.open_control_channel()
    srv_control.agent_control_channel('127.0.0.1')
    srv_control.build_and_send_config_files('SSH', 'config-file')

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

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID',
                              '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option',
                                          '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None,
                                             'addr', '3000::1')

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:a::/64',
                                  '2001:db8:a::1-2001:db8:a::1')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone',
                               r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    srv_control.host_reservation_in_subnet('address', '3000::1', '0', 'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    srv_msg.execute_kea_shell(
        '--host 127.0.0.1 --port 8000 --service dhcp6 config-test <<<\'$(SERVER_CONFIG)\''
    )

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID',
                              '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option',
                                          '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None,
                                             'addr', '3000::1')

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:a::/64',
                                  '2001:db8:a::1-2001:db8:a::1')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone',
                               r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    # WRONG ADDRESS RESERVATION
    srv_control.host_reservation_in_subnet('address', '192.168.0.5', '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    srv_msg.execute_kea_shell(
        '--host 127.0.0.1 --port 8000 --service dhcp6 config-test <<<\'$(SERVER_CONFIG)\''
    )
    srv_msg.forge_sleep('5', 'seconds')

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID',
                              '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option',
                                          '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None,
                                             'addr', '3000::1')
Beispiel #11
0
def test_control_channel_http_test_config():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::1')
    srv_control.open_control_channel()
    srv_control.agent_control_channel('$(SRV4_ADDR)')
    srv_control.build_and_send_config_files('SSH', 'config-file')

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

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID',
                              '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option',
                                          '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None,
                                             'addr', '3000::1')

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:a::/64',
                                  '2001:db8:a::1-2001:db8:a::1')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.agent_control_channel('$(SRV4_ADDR)')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone',
                               r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    srv_control.host_reservation_in_subnet('address', '3000::1', '0', 'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    srv_msg.send_ctrl_cmd_via_http(
        '{"command": "config-test","service": ["dhcp6"], "arguments":  $(SERVER_CONFIG) }',
        '$(SRV4_ADDR)')

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID',
                              '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option',
                                          '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None,
                                             'addr', '3000::1')

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:a::/64',
                                  '2001:db8:a::1-2001:db8:a::1')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.agent_control_channel('$(SRV4_ADDR)')
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone',
                               r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    # WRONG ADDRESS RESERVATION
    srv_control.host_reservation_in_subnet('address', '192.168.0.5', '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    response = srv_msg.send_ctrl_cmd_via_http(
        '{"command": "config-test","service": ["dhcp6"], "arguments":  $(SERVER_CONFIG) }',
        '$(SRV4_ADDR)',
        exp_result=1)
    assert "invalid prefix '192.168.0.5' for new IPv6 reservation" in response[
        0]['text']

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID',
                              '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option',
                                          '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None,
                                             'addr', '3000::1')
def test_control_channel_keashell_test_config():
    misc.test_setup()
    srv_control.config_srv_subnet('3000::/64', '3000::1-3000::1')
    srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
    srv_control.agent_control_channel('127.0.0.1',
                                      '8000',
                                      'unix',
                                      '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
    srv_control.build_and_send_config_files('SSH', 'config-file')

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

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::1')

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:a::/64', '2001:db8:a::1-2001:db8:a::1')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.agent_control_channel('$(SRV4_ADDR)',
                                      '8000',
                                      'unix',
                                      '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket_ANOTHER_ONE')
    srv_control.config_srv_id('LLT', '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone', r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    srv_control.host_reservation_in_subnet('address',
                                           '3000::1',
                                           '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    srv_msg.execute_shell_with_args('python',
                                    '$(SOFTWARE_INSTALL_DIR)/sbin/kea-shell',
                                    '--host 127.0.0.1 --port 8000 --service dhcp6 config-test <<<\'$(SERVER_CONFIG)\'')

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::1')

    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:a::/64', '2001:db8:a::1-2001:db8:a::1')
    srv_control.config_srv_prefix('2001:db8:1::', '0', '90', '96')
    srv_control.agent_control_channel('$(SRV4_ADDR)',
                                      '8000',
                                      'unix',
                                      '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket_ANOTHER_ONE')
    srv_control.config_srv_id('LLT', '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.config_srv_opt('sip-server-addr', '2001:db8::1,2001:db8::2')
    srv_control.config_srv_opt('new-posix-timezone', r'EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00')
    # WRONG ADDRESS RESERVATION
    srv_control.host_reservation_in_subnet('address',
                                           '192.168.0.5',
                                           '0',
                                           'duid',
                                           '00:03:00:01:f6:f5:f4:f3:f2:01')
    srv_control.generate_config_files()

    srv_msg.execute_shell_with_args('python',
                                    '$(SOFTWARE_INSTALL_DIR)/sbin/kea-shell',
                                    '--host 127.0.0.1 --port 8000 --service dhcp6 config-test <<<\'$(SERVER_CONFIG)\'')
    srv_msg.forge_sleep('5', 'seconds')

    misc.test_procedure()
    srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
    srv_msg.client_does_include('Client', None, 'client-id')
    srv_msg.client_does_include('Client', None, 'IA_Address')
    srv_msg.client_does_include('Client', None, 'IA-NA')
    srv_msg.client_send_msg('SOLICIT')

    misc.pass_criteria()
    srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
    srv_msg.response_check_include_option('Response', None, '1')
    srv_msg.response_check_include_option('Response', None, '2')
    srv_msg.response_check_include_option('Response', None, '3')
    srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
    srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::1')
Beispiel #13
0
def test_v6_hooks_HA_page_size_sync_mulitple_NA():
    # HA SERVER 1
    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:1::/64',
                                  '2001:db8:1::1-2001:db8:1::ffff')
    srv_control.config_srv_prefix('2001:db8:2::', 0, 48, 91)
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.open_control_channel()
    srv_control.agent_control_channel('$(MGMT_ADDRESS)')
    srv_control.add_hooks('libdhcp_lease_cmds.so')
    srv_control.add_ha_hook('libdhcp_ha.so')

    world.dhcp_cfg["hooks-libraries"][1].update(HOT_STANDBY)
    srv_control.update_ha_hook_parameter({
        "heartbeat-delay": 1000,
        "max-ack-delay": 0,
        "max-response-delay": 1500,
        "max-unacked-clients": 0,
        'sync-page-limit': 2,
        "this-server-name": "server1"
    })

    srv_control.build_and_send_config_files()
    srv_control.start_srv('DHCP', 'started')

    # HA SERVER 2
    misc.test_setup()
    srv_control.clear_some_data('all', dest=world.f_cfg.mgmt_address_2)
    srv_control.start_srv('DHCP', 'stopped', dest=world.f_cfg.mgmt_address_2)

    srv_control.config_srv_subnet('2001:db8:1::/64',
                                  '2001:db8:1::1-2001:db8:1::ffff')
    srv_control.config_srv_prefix('2001:db8:2::', 0, 48, 91)
    srv_control.config_srv_id('LLT',
                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:99:99')
    srv_control.open_control_channel()
    srv_control.agent_control_channel(world.f_cfg.mgmt_address_2)
    srv_control.add_hooks('libdhcp_lease_cmds.so')
    srv_control.add_ha_hook('libdhcp_ha.so')

    world.dhcp_cfg["hooks-libraries"][1].update(HOT_STANDBY)
    srv_control.update_ha_hook_parameter({
        "heartbeat-delay": 1000,
        "max-ack-delay": 0,
        "max-response-delay": 1500,
        "max-unacked-clients": 0,
        'sync-page-limit': 2,
        "this-server-name": "server2"
    })

    srv_control.build_and_send_config_files(dest=world.f_cfg.mgmt_address_2)
    srv_control.start_srv('DHCP', 'started', dest=world.f_cfg.mgmt_address_2)

    wait_until_ha_state('hot-standby')
    misc.test_procedure()

    set_of_leases_1 = generate_leases(leases_count=5, iaid=3, iapd=2)
    srv_msg.check_leases(set_of_leases_1)
    srv_msg.check_leases(set_of_leases_1, dest=world.f_cfg.mgmt_address_2)
    # srv_msg.forge_sleep(2, 'seconds')

    # srv_msg.remote_log_includes_line(world.f_cfg.mgmt_address_2,
    #                                  '$(SOFTWARE_INSTALL_DIR)/var/log/kea.log-CA',
    #                                  None,
    #                                  'Bulk apply of 4 IPv6 leases completed.')
    srv_control.start_srv('DHCP', 'stopped')
    wait_until_ha_state('partner-down', dest=world.f_cfg.mgmt_address_2)

    set_of_leases_2 = generate_leases(leases_count=5,
                                      iaid=3,
                                      iapd=2,
                                      mac="02:02:0c:03:0a:00")

    srv_control.start_srv('DHCP', 'started')
    wait_until_ha_state('hot-standby')

    srv_msg.check_leases(set_of_leases_1)
    srv_msg.check_leases(set_of_leases_2)
Beispiel #14
0
def test_v6_hooks_HA_page_size_sync_mulitple_NA():
    # HA SERVER 1
    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::ffff')
    srv_control.config_srv_prefix('2001:db8:2::', '0', '48', '91')
    srv_control.config_srv_id('LLT', '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_control.open_control_channel()
    srv_control.agent_control_channel('$(MGMT_ADDRESS)')
    srv_control.configure_loggers('kea-dhcp6.dhcpsrv', 'DEBUG', '99')
    srv_control.configure_loggers('kea-dhcp6.ha-hooks', 'DEBUG', '99')
    srv_control.configure_loggers('kea-ctrl-agent', 'DEBUG', '99', 'kea.log-CTRL')

    srv_control.add_hooks('libdhcp_lease_cmds.so')

    srv_control.add_ha_hook('libdhcp_ha.so')

    srv_control.add_parameter_to_ha_hook('this-server-name', '"server1"')
    srv_control.add_parameter_to_ha_hook('mode', '"hot-standby"')
    srv_control.add_parameter_to_ha_hook('heartbeat-delay', '1000')
    srv_control.add_parameter_to_ha_hook('max-response-delay', '1001')
    srv_control.add_parameter_to_ha_hook('max-unacked-clients', '0')
    srv_control.add_parameter_to_ha_hook('max-ack-delay', '0')

    srv_control.add_parameter_to_ha_hook('sync-page-limit', '2')

    srv_control.add_parameter_to_ha_hook('peers',
                                         '{"name":"server1","url":"http://$(MGMT_ADDRESS):8000/","role":"primary","auto-failover":true}')
    srv_control.add_parameter_to_ha_hook('peers',
                                         '{"name":"server2","url":"http://$(MGMT_ADDRESS_2):8000/","role":"standby","auto-failover":true}')

    srv_control.build_and_send_config_files('SSH', 'config-file')
    srv_control.start_srv('DHCP', 'started')

    # HA SERVER 2
    misc.test_setup()
    srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::ffff')
    srv_control.config_srv_prefix('2001:db8:2::', '0', '48', '91')
    srv_control.config_srv_id('LLT', '00:01:00:02:52:7b:a8:f0:08:00:27:58:99:99')
    srv_control.open_control_channel()
    srv_control.agent_control_channel('$(MGMT_ADDRESS_2)')
    srv_control.configure_loggers('kea-dhcp6.dhcpsrv', 'DEBUG', '99')
    srv_control.configure_loggers('kea-dhcp6.ha-hooks', 'DEBUG', '99')
    srv_control.configure_loggers('kea-ctrl-agent', 'DEBUG', '99', 'kea.log-CTRL2')
    srv_control.add_hooks('libdhcp_lease_cmds.so')
    srv_control.add_ha_hook('libdhcp_ha.so')
    srv_control.add_parameter_to_ha_hook('this-server-name', '"server2"')
    srv_control.add_parameter_to_ha_hook('mode', '"hot-standby"')
    srv_control.add_parameter_to_ha_hook('heartbeat-delay', '1000')
    srv_control.add_parameter_to_ha_hook('max-response-delay', '1001')
    srv_control.add_parameter_to_ha_hook('max-unacked-clients', '0')
    srv_control.add_parameter_to_ha_hook('max-ack-delay', '0')
    srv_control.add_parameter_to_ha_hook('sync-page-limit', '2')

    srv_control.add_parameter_to_ha_hook('peers',
                                         '{"name":"server1","url":"http://$(MGMT_ADDRESS):8000/","role": "primary","auto-failover":true}')
    srv_control.add_parameter_to_ha_hook('peers',
                                         '{"name":"server2","url":"http://$(MGMT_ADDRESS_2):8000/","role": "standby","auto-failover":true}')

    srv_control.build_and_send_config_files_dest_addr('SSH', 'config-file', '$(MGMT_ADDRESS_2)')
    srv_control.remote_start_srv('DHCP', 'started', '$(MGMT_ADDRESS_2)')

    misc.test_procedure()
    srv_msg.forge_sleep('2', 'seconds')

    tmp = world.f_cfg.show_packets_from
    world.f_cfg.show_packets_from = ""
    duid = "00:03:00:01:ff:ff:ff:ff:ff:0"
    test_range = 5
    for each in range(9):
        ia_1 = random.randint(1, 9009)

        misc.test_procedure()
        srv_msg.client_sets_value('Client', 'DUID', duid + str(each))
        srv_msg.client_does_include('Client', None, 'client-id')
        for each_ia in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_id', ia_1 + each_ia)
            srv_msg.client_does_include('Client', None, 'IA-NA')

        for each_pd in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_pd', ia_1 + each_pd)
            srv_msg.client_does_include('Client', None, 'IA-PD')
        srv_msg.client_send_msg('SOLICIT')

        misc.pass_criteria()
        srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')

        misc.test_procedure()
        srv_msg.client_sets_value('Client', 'DUID', duid + str(each))
        srv_msg.client_does_include('Client', None, 'client-id')

        for each_ia in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_id', ia_1 + each_ia)
            srv_msg.client_does_include('Client', None, 'IA-NA')

        for each_pd in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_pd', ia_1 + each_pd)
            srv_msg.client_does_include('Client', None, 'IA-PD')

        srv_msg.client_copy_option('server-id')
        srv_msg.client_send_msg('REQUEST')

        misc.pass_criteria()
        srv_msg.send_wait_for_message('MUST', None, 'REPLY')
        srv_msg.response_check_include_option('Response', None, '2')
        srv_msg.response_check_option_content('Response',
                                              '2',
                                              None,
                                              'duid',
                                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:f1:e8')
    srv_msg.forge_sleep('2', 'seconds')
    world.f_cfg.show_packets_from = tmp

    srv_msg.remote_log_includes_line('$(MGMT_ADDRESS_2)',
                                     '$(SOFTWARE_INSTALL_DIR)/var/log/kea.log',
                                     None,
                                     'DHCPSRV_MEMFILE_GET_ADDR6 obtaining IPv6 lease '
                                     'for address 2001:db8:2::aa0:0:0 and lease type IA_PD')
    srv_msg.remote_log_includes_line('$(MGMT_ADDRESS_2)',
                                     '$(SOFTWARE_INSTALL_DIR)/var/log/kea.log',
                                     None,
                                     'DHCPSRV_MEMFILE_UPDATE_ADDR6 updating IPv6 lease for address 2001:db8:2::aa0:0:0')
    srv_msg.remote_log_includes_line('$(MGMT_ADDRESS_2)',
                                     '$(SOFTWARE_INSTALL_DIR)/var/log/kea.log-CTRL2',
                                     None,
                                     'Bulk apply of 10 IPv6 leases completed.')
    srv_control.start_srv('DHCP', 'stopped')
    srv_msg.forge_sleep('2', 'seconds')

    tmp = world.f_cfg.show_packets_from
    world.f_cfg.show_packets_from = ""
    duid = "00:03:00:01:ff:ff:ff:ff:00:0"
    for each in range(9):
        ia_1 = random.randint(1, 9009)

        misc.test_procedure()
        srv_msg.client_sets_value('Client', 'DUID', duid + str(each))
        srv_msg.client_does_include('Client', None, 'client-id')
        for each_ia in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_id', ia_1 + each_ia)
            srv_msg.client_does_include('Client', None, 'IA-NA')

        for each_pd in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_pd', ia_1 + each_pd)
            srv_msg.client_does_include('Client', None, 'IA-PD')
        srv_msg.client_send_msg('SOLICIT')

        misc.pass_criteria()
        srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')

        misc.test_procedure()
        srv_msg.client_sets_value('Client', 'DUID', duid + str(each))
        srv_msg.client_does_include('Client', None, 'client-id')

        for each_ia in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_id', ia_1 + each_ia)
            srv_msg.client_does_include('Client', None, 'IA-NA')

        for each_pd in range(test_range):
            srv_msg.client_sets_value('Client', 'ia_pd', ia_1 + each_pd)
            srv_msg.client_does_include('Client', None, 'IA-PD')

        srv_msg.client_copy_option('server-id')
        srv_msg.client_send_msg('REQUEST')

        misc.pass_criteria()
        srv_msg.send_wait_for_message('MUST', None, 'REPLY')

        srv_msg.response_check_include_option('Response', None, '2')
        srv_msg.response_check_option_content('Response',
                                              '2',
                                              None,
                                              'duid',
                                              '00:01:00:02:52:7b:a8:f0:08:00:27:58:99:99')
    srv_control.start_srv('DHCP', 'started')
    srv_msg.forge_sleep('4', 'seconds')