本文整理汇总了Python中srv_control.add_hooks函数的典型用法代码示例。如果您正苦于以下问题:Python add_hooks函数的具体用法?Python add_hooks怎么用?Python add_hooks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_hooks函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_hook_v4_subnet_cmds_del_global_options
def test_hook_v4_subnet_cmds_del_global_options():
misc.test_setup()
srv_control.config_srv_subnet('192.168.51.0/24', '192.168.51.1-192.168.51.1')
srv_control.config_srv_opt('domain-name-servers', '199.199.199.1,100.100.100.1')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_subnet_cmds.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_requests_option('6')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.51.1')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command": "subnet4-del","arguments":{"id":1}}')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_dont_wait_for_message()
示例2: test_v4_hosts_cmds_get_reservation_pgsql_2
def test_v4_hosts_cmds_get_reservation_pgsql_2():
misc.test_setup()
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_host_cmds.so')
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.50-192.168.50.50')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.enable_db_backend_reservation('PostgreSQL')
srv_control.new_db_backend_reservation('PostgreSQL', 'hw-address', 'ff:01:02:03:ff:04')
srv_control.update_db_backend_reservation('hostname', 'reserved-hostname', 'PostgreSQL', '1')
srv_control.update_db_backend_reservation('ipv4_address', '192.168.50.100', 'PostgreSQL', '1')
srv_control.update_db_backend_reservation('dhcp4_subnet_id', '1', 'PostgreSQL', '1')
srv_control.upload_db_reservation('PostgreSQL')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.100')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command": "reservation-get","arguments":{"subnet-id":1,"identifier-type": "hw-address","identifier":"ff:01:02:03:ff:04"}}')
示例3: test_hook_v4_lease_cmds_add_valid
def test_hook_v4_lease_cmds_add_valid():
misc.test_setup()
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.5-192.168.50.5')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.5')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command": "lease4-add","arguments": {"subnet-id": 1,"ip-address": "192.168.50.5","hw-address": "1a:1b:1c:1d:1e:1f"}}')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_dont_wait_for_message()
示例4: test_user_check_hook_IA_NA_with_registry_known_user
def test_user_check_hook_IA_NA_with_registry_known_user():
# With a user registry and multiple subnets
# an known user should get first subnet
misc.test_setup()
srv_msg.send_file_to_server('tests/dhcpv6/kea_only/user_chk/registry_1.txt',
'/tmp/user_chk_registry.txt')
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('3000::/64', '3000::5-3000::5')
srv_control.config_srv_another_subnet_no_interface('1000::/64', '1000::5-1000::5')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_user_chk.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
# Send a query from a registered user
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:11:02:03:04:05:06')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
srv_msg.response_check_suboption_content('Response', '5', '3', None, 'addr', '3000::5')
# Check the outcome file for correct content
srv_msg.copy_remote('/tmp/user_chk_outcome.txt')
srv_msg.compare_file('tests/dhcpv6/kea_only/user_chk/outcome_2.txt')
示例5: test_v4_hooks_flexid_replace_client_id_renew_2
def test_v4_hooks_flexid_replace_client_id_renew_2():
misc.test_setup()
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.5')
srv_control.host_reservation_in_subnet('address',
'192.168.50.10',
'0',
'flex-id',
'\'docsis3.0\'')
srv_control.add_line('"host-reservation-identifiers": ["hw-address", "flex-id" ]')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_flex_id.so')
srv_control.add_parameter_to_hook('1', 'identifier-expression', 'option[60].hex')
srv_control.add_parameter_to_hook('1', 'replace-client-id', 'true')
# enable matching client id
srv_control.set_conf_parameter_global('match-client-id', 'true')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
# server should act normally, mac address should not be replaced
misc.test_procedure()
srv_msg.client_does_include_with_value('client_id', 'ff:01:02:03:ff:04:11:22')
srv_msg.client_does_include_with_value('vendor_class_id', 'docsis3.0')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.10')
misc.test_procedure()
srv_msg.client_does_include_with_value('client_id', 'ff:01:02:03:ff:04:11:22')
srv_msg.client_copy_option('server_id')
srv_msg.client_does_include_with_value('requested_addr', '192.168.50.10')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_does_include_with_value('vendor_class_id', 'docsis3.0')
srv_msg.client_send_msg('REQUEST')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ACK')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.10')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
misc.test_procedure()
srv_msg.client_does_include_with_value('client_id', 'ff:01:02:03:ff:04:11:22')
# Client adds to the message vendor_class_id with value docsis3.0.
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_content('Response', 'NOT ', 'yiaddr', '192.168.50.10')
srv_msg.response_check_include_option('Response', None, '61')
srv_msg.response_check_include_option('Response', None, '54')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases4.csv',
'NOT ',
'ff:01:02:03:ff:04:11:22:33')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases4.csv',
None,
'192.168.50.10,ff:01:02:03:ff:04,00:64:6f:63:73:69:73:33:2e:30,4000')
示例6: test_v4_hooks_flexid_inside_pool_negative
def test_v4_hooks_flexid_inside_pool_negative():
misc.test_setup()
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.50')
srv_control.host_reservation_in_subnet('hostname',
'reserved-hostname',
'0',
'flex-id',
'\'docsis3.0\'')
srv_control.host_reservation_in_subnet_add_value('0', '0', 'address', '192.168.50.10')
srv_control.add_line('"host-reservation-identifiers": [ "flex-id" ]')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_flex_id.so')
srv_control.add_parameter_to_hook('1', 'identifier-expression', 'option[60].hex')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_does_include_with_value('vendor_class_id', 'docsis3.0')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.10')
misc.test_procedure()
# Client adds to the message vendor_class_id with value docsis3.0.
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('vendor_class_id', 'docsis3.1')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('REQUEST')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'NAK')
示例7: test_hook_v4_subnet_cmds_add
def test_hook_v4_subnet_cmds_add():
misc.test_setup()
srv_control.config_srv_subnet('$(EMPTY)', '$(EMPTY)')
srv_control.config_srv_opt('domain-name-servers', '199.199.199.1,100.100.100.1')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_subnet_cmds.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_dont_wait_for_message()
# Using UNIX socket on server in path $(SOFTWARE_INSTALL_DIR)/var/kea/control_socket send {"command":"subnet4-list","arguments":{}}
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command":"subnet4-add","arguments":{"subnet4":[{"subnet":"192.168.50.0/24","interface":"$(SERVER_IFACE)","id":234,"pools":[{"pool":"192.168.50.1-192.168.50.1"}]}]}}')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command":"subnet4-get","arguments":{"id": 234}}')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.1')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
示例8: test_user_check_IA_NA_with_registry_known_user
def test_user_check_IA_NA_with_registry_known_user():
# With a user registry and multiple subnets
# an known user should get first subnet
misc.test_setup()
srv_msg.send_file_to_server('tests/dhcpv4/kea_only/user_chk/registry_1.txt',
'/tmp/user_chk_registry.txt')
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.5-192.168.50.5')
srv_control.config_srv_another_subnet_no_interface('10.0.0.0/24', '10.0.0.5-10.0.0.5')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_user_chk.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', '0c:0e:0a:01:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.5')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
# Check the outcome file for correct content
srv_msg.copy_remote('/tmp/user_chk_outcome.txt')
srv_msg.compare_file('tests/dhcpv4/kea_only/user_chk/outcome_2.txt')
示例9: test_user_check_IA_NA_with_registry_unknown_user_logging_2
def test_user_check_IA_NA_with_registry_unknown_user_logging_2():
# With a user registry and multiple subnets
# an unknown user should get last subnet
misc.test_setup()
srv_msg.send_file_to_server('tests/dhcpv4/kea_only/user_chk/registry_1.txt',
'/tmp/user_chk_registry.txt')
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.5-192.168.50.5')
srv_control.config_srv_another_subnet_no_interface('10.0.0.0/24', '10.0.0.5-10.0.0.5')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_user_chk.so')
# Server logging system is configured with logger type kea-dhcp4.callouts, severity DEBUG, severity level 99 and log file kea.log.
# Server logging system is configured with logger type kea-dhcp4.hooks, severity INFO, severity level None and log file kea.log.
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', '0c:0e:0a:01:ff:01')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '10.0.0.5')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
# Check the outcome file for correct content
srv_msg.copy_remote('/tmp/user_chk_outcome.txt')
srv_msg.compare_file('tests/dhcpv4/kea_only/user_chk/outcome_1.txt')
# File stored in $(SOFTWARE_INSTALL_DIR)/var/kea/kea.log MUST contain line or phrase: INFO \[kea-dhcp4.hooks
# File stored in $(SOFTWARE_INSTALL_DIR)/var/kea/kea.log MUST contain line or phrase: DEBUG \[kea-dhcp4.callouts
misc.test_setup()
srv_msg.send_file_to_server('tests/dhcpv4/kea_only/user_chk/registry_1.txt',
'/tmp/user_chk_registry.txt')
srv_msg.remove_file_from_server('/tmp/user_chk_outcome.txt')
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.5-192.168.50.5')
srv_control.config_srv_another_subnet_no_interface('10.0.0.0/24', '10.0.0.5-10.0.0.5')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_user_chk.so')
# Server logging system is configured with logger type kea-dhcp4.callouts, severity DEBUG, severity level 99 and log file kea.log.
# Server logging system is configured with logger type kea-dhcp4.hooks, severity INFO, severity level None and log file kea.log.
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', '0c:0e:0a:01:ff:01')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '10.0.0.5')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
# Check the outcome file for correct content
srv_msg.copy_remote('/tmp/user_chk_outcome.txt')
srv_msg.compare_file('tests/dhcpv4/kea_only/user_chk/outcome_1.txt')
示例10: test_v4_legal_log_assigned_address_via_relay_mysql
def test_v4_legal_log_assigned_address_via_relay_mysql():
misc.test_procedure()
srv_msg.remove_from_db_table('logs', 'MySQL')
misc.test_setup()
srv_control.set_time('renew-timer', '3')
srv_control.set_time('rebind-timer', '50')
srv_control.set_time('valid-lifetime', '600')
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.2-192.168.50.2')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_legal_log.so')
srv_control.add_parameter_to_hook('1', 'name', '$(DB_NAME)')
srv_control.add_parameter_to_hook('1', 'password', '$(DB_PASSWD)')
srv_control.add_parameter_to_hook('1', 'type', 'mysql')
srv_control.add_parameter_to_hook('1', 'user', '$(DB_USER)')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_does_include_with_value('client_id', '00010203040577')
srv_msg.network_variable('source_port', '67')
srv_msg.network_variable('source_address', '$(GIADDR4)')
srv_msg.network_variable('destination_address', '$(SRV4_ADDR)')
srv_msg.client_sets_value('Client', 'giaddr', '$(GIADDR4)')
srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:00')
srv_msg.client_sets_value('Client', 'hops', '1')
srv_msg.client_requests_option('1')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.2')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'chaddr', '00:00:00:00:00:00')
srv_msg.client_does_include_with_value('client_id', '00010203040577')
srv_msg.client_sets_value('Client', 'giaddr', '$(GIADDR4)')
srv_msg.client_sets_value('Client', 'hops', '1')
srv_msg.client_copy_option('server_id')
srv_msg.client_does_include_with_value('requested_addr', '192.168.50.2')
srv_msg.client_requests_option('1')
srv_msg.client_send_msg('REQUEST')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ACK')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.2')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
srv_msg.table_contains_line('logs',
'MySQL',
None,
'Address: 192.168.50.2 has been assigned for 0 hrs 10 mins 0 secs to a device with hardware address: hwtype=1 00:00:00:00:00:00,')
srv_msg.table_contains_line('logs',
'MySQL',
None,
'client-id: 00:01:02:03:04:05:77 connected via relay at address: $(GIADDR4)')
示例11: test_hook_v6_lease_cmds_update
def test_hook_v6_lease_cmds_update():
misc.test_setup()
srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::2')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_sets_value('Client', 'ia_id', '666')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
misc.test_procedure()
srv_msg.client_copy_option('IA_NA')
srv_msg.client_copy_option('server-id')
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_send_msg('REQUEST')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'REPLY')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_include_option('Response', None, '2')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
None,
'2001:db8:1::1,00:03:00:01:66:55:44:33:22:11,4000,')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
None,
',1,3000,0,666,128,0,0,,66:55:44:33:22:11,0')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
'NOT ',
'2001:db8:1::1,01:02:03:04:05:06:07:08')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
'NOT ',
',urania.example.org,1a:1b:1c:1d:1e:1f,')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command":"lease6-update", "arguments":{"subnet-id": 1,"ip-address": "2001:db8:1::1","duid": "01:02:03:04:05:06:07:08","iaid": 1234,"hw-address": "1a:1b:1c:1d:1e:1f","preferred-lft": 500,"valid-lft": 1000,"hostname": "urania.example.org"}}')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
None,
',1,500,0,1234,128,0,0,urania.example.org,1a:1b:1c:1d:1e:1f,0')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
None,
'2001:db8:1::1,01:02:03:04:05:06:07:08,1000')
示例12: test_hook_v6_lease_cmds_add_valid_with_options
def test_hook_v6_lease_cmds_add_valid_with_options():
misc.test_setup()
srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1')
srv_control.config_srv_opt('preference', '123')
srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_include_option('Response', None, '2')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
srv_msg.response_check_suboption_content('Response',
'5',
'3',
None,
'addr',
'2001:db8:1::1')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command": "lease6-add","arguments": {"subnet-id": 1,"ip-address": "2001:db8:1::1","duid": "1a:1b:1c:1d:1e:1f:20:21:22:23:24","iaid": 1234,"hw-address": "1a:2b:3c:4d:5e:6f","preferred-lft": 500,"valid-lft": 11111,"fqdn-fwd": true,"fqdn-rev": true,"hostname": "urania.example.org"}}')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_include_option('Response', None, '2')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13')
srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
None,
'1a:2b:3c:4d:5e:6f')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
None,
'1a:1b:1c:1d:1e:1f:20:21:22:23:24')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv', None, '11111')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-leases6.csv',
None,
'urania.example.org')
示例13: test_hook_v6_lease_cmds_get_using_address
def test_hook_v6_lease_cmds_get_using_address():
misc.test_setup()
srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
misc.test_procedure()
srv_msg.client_copy_option('IA_NA')
srv_msg.client_copy_option('server-id')
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_send_msg('REQUEST')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'REPLY')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_include_option('Response', None, '2')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
srv_msg.response_check_suboption_content('Response',
'5',
'3',
None,
'addr',
'2001:db8:1::1')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:11:22:33:44:55:66')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_include_option('Response', None, '2')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13')
srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command":"lease6-get","arguments":{"ip-address": "2001:db8:1::1"}}')
示例14: test_hook_v6_lease_cmds_legal_logging_add
def test_hook_v6_lease_cmds_legal_logging_add():
misc.test_procedure()
srv_msg.remove_file_from_server('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-legal*.txt')
misc.test_setup()
srv_control.config_srv_subnet('2001:db8:1::/64', '2001:db8:1::1-2001:db8:1::1')
srv_control.config_srv_opt('preference', '123')
srv_control.config_srv_opt('domain-search', 'domain1.example.com,domain2.isc.org')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_legal_log.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_include_option('Response', None, '2')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '5')
srv_msg.response_check_suboption_content('Response',
'5',
'3',
None,
'addr',
'2001:db8:1::1')
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command": "lease6-add","arguments": {"subnet-id": 1,"ip-address": "2001:db8:1::1","duid": "1a:1b:1c:1d:1e:1f:20:21:22:23:24","iaid": 1234}}')
misc.test_procedure()
srv_msg.client_sets_value('Client', 'DUID', '00:03:00:01:66:55:44:33:22:11')
srv_msg.client_does_include('Client', None, 'client-id')
srv_msg.client_does_include('Client', None, 'IA-NA')
srv_msg.client_send_msg('SOLICIT')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ADVERTISE')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_include_option('Response', None, '2')
srv_msg.response_check_include_option('Response', None, '3')
srv_msg.response_check_option_content('Response', '3', None, 'sub-option', '13')
srv_msg.response_check_suboption_content('Response', '13', '3', None, 'statuscode', '2')
srv_msg.copy_remote('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-legal*.txt')
srv_msg.file_contains_line('$(SOFTWARE_INSTALL_DIR)/var/kea/kea-legal*.txt',
None,
'Administrator added a lease of address: 2001:db8:1::1 to a device with DUID: 1a:1b:1c:1d:1e:1f:20:21:22:23:24')
示例15: test_hook_v4_lease_cmds_del_using_hw_address
def test_hook_v4_lease_cmds_del_using_hw_address():
misc.test_setup()
srv_control.config_srv_subnet('192.168.50.0/24', '192.168.50.1-192.168.50.1')
srv_control.open_control_channel('unix', '$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket')
srv_control.add_hooks('$(SOFTWARE_INSTALL_DIR)/lib/kea/hooks/libdhcp_lease_cmds.so')
srv_control.build_and_send_config_files('SSH', 'config-file')
srv_control.start_srv('DHCP', 'started')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.1')
srv_msg.response_check_option_content('Response', '1', None, '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.1')
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', 'ff:01:02:03:ff:04')
srv_msg.client_send_msg('REQUEST')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'ACK')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.1')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', 'aa:bb:cc:dd:ee:11')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_dont_wait_for_message()
srv_msg.send_through_socket_server_site('$(SOFTWARE_INSTALL_DIR)/var/kea/control_socket',
'{"command": "lease4-del","arguments": {"identifier": "ff:01:02:03:ff:04","identifier-type":"hw-address","subnet-id":1}}')
misc.test_procedure()
srv_msg.client_requests_option('1')
srv_msg.client_sets_value('Client', 'chaddr', 'aa:bb:cc:dd:ee:11')
srv_msg.client_send_msg('DISCOVER')
misc.pass_criteria()
srv_msg.send_wait_for_message('MUST', None, 'OFFER')
srv_msg.response_check_include_option('Response', None, '1')
srv_msg.response_check_content('Response', None, 'yiaddr', '192.168.50.1')
srv_msg.response_check_option_content('Response', '1', None, 'value', '255.255.255.0')