#!/usr/share/ucs-test/runner python
## desc: Set fixedaddress during dhcp/host modification
## tags: [udm]
## roles: [domaincontroller_master]
## exposure: careful
## packages:
##   - univention-config
##   - univention-directory-manager-tools



import univention.testing.utils as utils
import univention.testing.udm as udm_test
import univention.testing.strings as uts

if __name__ == '__main__':

	with udm_test.UCSTestUDM() as udm:
		dhcp_service = udm.create_object('dhcp/service', service = uts.random_name())

		dhcp_host = udm.create_object('dhcp/host', host = uts.random_name(), hwaddress = 'ethernet 01:ff:78:38:ab:24', superordinate = dhcp_service)

		fixed_address = '10.20.30.40'
		udm.modify_object('dhcp/host', dn = dhcp_host, fixedaddress = fixed_address, superordinate = dhcp_service)
		utils.verify_ldap_object(dhcp_host, {'univentionDhcpFixedAddress': [fixed_address]})
