diff options
author | boucherv <valentin.boucher@orange.com> | 2016-08-03 11:17:10 +0200 |
---|---|---|
committer | boucherv <valentin.boucher@orange.com> | 2016-08-03 11:34:23 +0200 |
commit | 9f7f322f30921ecdc4c2f7e4b2e7a147ed9a6712 (patch) | |
tree | 1234449068c8d809f38cb6f52d9a1c6bdc7ec152 | |
parent | 560ab3f2117181dee4a6eb32b3c8a093ca46afc0 (diff) |
functest utils - get_resolvconf_ns() Ensure that dns works with dns name resolution
JIRA: FUNCTEST-402
Change-Id: I5fa9204aafb13330eb810950aa7bc728f1a69162
Signed-off-by: boucherv <valentin.boucher@orange.com>
-rw-r--r-- | docker/requirements.pip | 1 | ||||
-rw-r--r-- | testcases/vnf/vIMS/orchestrator.py | 2 | ||||
-rwxr-xr-x | testcases/vnf/vIMS/vIMS.py | 4 | ||||
-rw-r--r-- | utils/functest_utils.py | 14 |
4 files changed, 12 insertions, 9 deletions
diff --git a/docker/requirements.pip b/docker/requirements.pip index f590b2a03..52d0a9cc7 100644 --- a/docker/requirements.pip +++ b/docker/requirements.pip @@ -25,3 +25,4 @@ paramiko==1.16.0 python-congressclient==1.3.0 subprocess32 shyaml +dnspython diff --git a/testcases/vnf/vIMS/orchestrator.py b/testcases/vnf/vIMS/orchestrator.py index d88efe9b3..3da3fb063 100644 --- a/testcases/vnf/vIMS/orchestrator.py +++ b/testcases/vnf/vIMS/orchestrator.py @@ -55,8 +55,6 @@ class orchestrator: def set_nameservers(self, nameservers): if 0 < len(nameservers): self.config['dns_subnet_1'] = nameservers[0] - if 1 < len(nameservers): - self.config['dns_subnet_2'] = nameservers[1] def set_logger(self, logger): self.logger = logger diff --git a/testcases/vnf/vIMS/vIMS.py b/testcases/vnf/vIMS/vIMS.py index 790bfa0cc..dfbb6759c 100755 --- a/testcases/vnf/vIMS/vIMS.py +++ b/testcases/vnf/vIMS/vIMS.py @@ -441,9 +441,9 @@ def main(): flavor_name = "m1.small" flavor_id = os_utils.get_flavor_id(nova, flavor_name) for requirement in CW_REQUIERMENTS: - if requirement == 'ram_min': + if requirement == 'ram_min' and flavor_id == '': flavor_id = os_utils.get_flavor_id_by_ram_range( - nova, CW_REQUIERMENTS['ram_min'], 8196) + nova, CW_REQUIERMENTS['ram_min'], 4500) if flavor_id == '': logger.error( diff --git a/utils/functest_utils.py b/utils/functest_utils.py index b0014308e..5f790a015 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -16,10 +16,10 @@ import os import os.path import re import shutil -import socket import subprocess import sys import urllib2 +import dns.resolver import functest.ci.tier_builder as tb from git import Repo @@ -226,13 +226,17 @@ def get_resolvconf_ns(): nameservers = [] rconf = open("/etc/resolv.conf", "r") line = rconf.readline() + resolver = dns.resolver.Resolver() while line: ip = re.search(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", line) - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) if ip: - result = sock.connect_ex((ip.group(), 53)) - if result == 0: - nameservers.append(ip.group()) + resolver.nameservers = [str(ip)] + try: + result = resolver.query('opnfv.org')[0] + if result != "": + nameservers.append(ip.group()) + except dns.exception.Timeout: + pass line = rconf.readline() return nameservers |