diff options
author | DR695H <dr695h@att.com> | 2019-04-18 10:56:38 -0400 |
---|---|---|
committer | Gary Wu <gary.i.wu@huawei.com> | 2019-04-23 10:34:04 -0700 |
commit | d050b58d3fde6a049104d8287f8d8cfbe3013d5d (patch) | |
tree | 7563bfffabfc4f713996b1f12e52b5f2317fc6e2 /robotframework-onap/eteutils/DNSUtils.py | |
parent | 5709f89501b9ecf93fcb1667de017e1736c8919f (diff) |
move robotframeworkonap to subdirectory
i also moved the build to maven based, although that isnt needed
to work right now.
Change-Id: Ib18d70e3ea4858cc4b9d51fdc2046b59202640ab
Issue-ID: TEST-141
Signed-off-by: DR695H <dr695h@att.com>
Signed-off-by: Gary Wu <gary.i.wu@huawei.com>
Diffstat (limited to 'robotframework-onap/eteutils/DNSUtils.py')
-rw-r--r-- | robotframework-onap/eteutils/DNSUtils.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/robotframework-onap/eteutils/DNSUtils.py b/robotframework-onap/eteutils/DNSUtils.py new file mode 100644 index 0000000..65ae68b --- /dev/null +++ b/robotframework-onap/eteutils/DNSUtils.py @@ -0,0 +1,17 @@ +import dns.message +import dns.name +import dns.query + +class DNSUtils: + """ Utilities useful for DNS requests """ + + def dns_request(self, domain, ns): + """ return the ip address of the given domain name from the given nameserver """ + request = dns.message.make_query(domain, dns.rdatatype.A); + request.flags |= dns.flags.AD; + request.find_rrset(request.additional, dns.name.root, 65535, dns.rdatatype.OPT, create=True, force_unique=True) + response = dns.query.udp(request, ns) + + for answer in response.answer: + for item in answer.items: + return item
\ No newline at end of file |