Kiall Mac Innes | 25fb29e | 2016-04-07 08:07:04 +0100 | [diff] [blame] | 1 | # Copyright 2016 Hewlett Packard Enterprise Development Company, L.P. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | from tempest.lib.common.utils import data_utils |
| 15 | |
| 16 | |
| 17 | def rand_zone_name(): |
| 18 | """Generate a random zone name |
| 19 | :return: a random zone name e.g. example.org. |
| 20 | :rtype: string |
| 21 | """ |
| 22 | return '%s.com.' % data_utils.rand_name() |
| 23 | |
| 24 | |
| 25 | def rand_email(domain=None): |
| 26 | """Generate a random zone name |
| 27 | :return: a random zone name e.g. example.org. |
| 28 | :rtype: string |
| 29 | """ |
| 30 | domain = domain or rand_zone_name() |
| 31 | return 'example@%s' % domain.rstrip('.') |
| 32 | |
| 33 | |
| 34 | def rand_ttl(start=1, end=86400): |
| 35 | """Generate a random TTL value |
| 36 | :return: a random ttl e.g. 165 |
| 37 | :rtype: string |
| 38 | """ |
| 39 | return data_utils.rand_int_id(start, end) |