summaryrefslogtreecommitdiffstats
path: root/eteutils/DNSUtils.py
diff options
context:
space:
mode:
authorDR695H <dr695h@att.com>2017-02-15 18:21:12 -0500
committerDR695H <dr695h@att.com>2017-02-15 18:23:10 -0500
commit5fa0146de7ad7aa73f533253a57f3798b02cca39 (patch)
treeba3f0e5a3755af179478b7f0c1434feae0294384 /eteutils/DNSUtils.py
parent9ef2b0130988e923bdf96b563d8457be9ba70ee1 (diff)
Initial checkin of OpenECOMP testing utilsrelease-1.0.0
Change-Id: Ife652fabd1ee64d73d0cb0b72f954b9a44de615f Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'eteutils/DNSUtils.py')
-rw-r--r--eteutils/DNSUtils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/eteutils/DNSUtils.py b/eteutils/DNSUtils.py
new file mode 100644
index 0000000..65ae68b
--- /dev/null
+++ b/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