#!/usr/share/ucs-test/runner python3
## desc: Create dns/srv_record with all attributes set
## tags: [udm]
## roles: [domaincontroller_master]
## exposure: careful
## packages:
##   - univention-config
##   - univention-directory-manager-tools

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

if __name__ == '__main__':
	with udm_test.UCSTestUDM() as udm:
		forward_zone = udm.create_object('dns/forward_zone', zone='%s.%s' % (uts.random_name(), uts.random_name()), nameserver=uts.random_dns_record())

		srv_record_proprties = {
			'name': '%s tcp %s' % (uts.random_string(), uts.random_string()),
			'location': '0 1 2 %s.%s' % (uts.random_name(), uts.random_name()),
			'zonettl': '128'
		}

		srv_record = udm.create_object('dns/srv_record', superordinate=forward_zone, **srv_record_proprties)

		utils.verify_ldap_object(srv_record, {
			'sRVRecord': [srv_record_proprties['location']],
			'dNSTTL': [srv_record_proprties['zonettl']],
		})
