Standarize ip validation along the code
Details: - Use the nova/utils.py validations along the code - refactor ipv4 validator to looks like ipv6 validator - interprets ip validations exceptions as Invalid IP values Change-Id: Ia506c00510a066e167d3dcd9dd371a371129a9dd
This commit is contained in:
		@@ -945,14 +945,16 @@ def is_valid_boolstr(val):
 | 
			
		||||
def is_valid_ipv4(address):
 | 
			
		||||
    """Verify that address represents a valid IPv4 address."""
 | 
			
		||||
    try:
 | 
			
		||||
        addr = netaddr.IPAddress(address)
 | 
			
		||||
        return addr.version == 4
 | 
			
		||||
        return netaddr.valid_ipv4(address)
 | 
			
		||||
    except Exception:
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def is_valid_ipv6(address):
 | 
			
		||||
    return netaddr.valid_ipv6(address)
 | 
			
		||||
    try:
 | 
			
		||||
        return netaddr.valid_ipv6(address)
 | 
			
		||||
    except Exception:
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def is_valid_ipv6_cidr(address):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user