Merge "Use is_valid_ipv4 in get_ipv6_addr_by_EUI64"
This commit is contained in:
commit
d20d99200f
@ -151,7 +151,7 @@ def get_ipv6_addr_by_EUI64(prefix, mac):
|
||||
.. versionadded:: 1.4
|
||||
"""
|
||||
# Check if the prefix is an IPv4 address
|
||||
if netaddr.valid_ipv4(prefix):
|
||||
if is_valid_ipv4(prefix):
|
||||
msg = _("Unable to generate IP address by EUI64 for IPv4 prefix")
|
||||
raise ValueError(msg)
|
||||
try:
|
||||
|
@ -317,6 +317,12 @@ class IPv6byEUI64TestCase(test_base.BaseTestCase):
|
||||
self.assertRaises(TypeError, lambda:
|
||||
netutils.get_ipv6_addr_by_EUI64(prefix, mac))
|
||||
|
||||
def test_generate_IPv6_with_empty_prefix(self):
|
||||
mac = '00:16:3e:33:44:55'
|
||||
prefix = ''
|
||||
self.assertRaises(ValueError, lambda:
|
||||
netutils.get_ipv6_addr_by_EUI64(prefix, mac))
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def mock_file_content(content):
|
||||
|
Loading…
x
Reference in New Issue
Block a user