[Designate] IPv6 detection check added

The current code assumes that the nameserver value configured
in tempest.conf is one of these two options only: IPV4 or IPV4:PORT
There is no handling for IPV6 addresses(with/without PORT).
(If IPV6 is set it causes traceback).

This patch adds support for IPV6.

Change-Id: I6ee56fcc1f00bc55012bcd1895bddce5acfa07d4
This commit is contained in:
Lilach Avraham 2023-06-13 19:02:16 +03:00 committed by Arkady Shtempler
parent 25c93a50ec
commit 9b0cec95fa
1 changed files with 4 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import dns
import dns.exception
import dns.query
from tempest import config
from oslo_utils import netutils
CONF = config.CONF
@ -78,7 +79,7 @@ class Nameserver(object):
@classmethod
def from_str(self, nameserver):
if ':' in nameserver:
ip, port = nameserver.rsplit(':', 1)
return Nameserver(ip, int(port))
ip, port = netutils.parse_host_port(nameserver)
if port:
return Nameserver(ip, port)
return Nameserver(nameserver)