From 3e0952109f7851ced21c7cc7aaed26c4669bf424 Mon Sep 17 00:00:00 2001 From: Abhishek Kekane Date: Tue, 24 May 2016 16:23:39 +0530 Subject: [PATCH] Remove unused is_valid_cidr method is_valid_cidr() method is defined but not used anywhere. In future if we need this method then we can use the same from oslo_utils/netutils package. TrivialFix Change-Id: I0f9792d48ba52bd37cdfe8ff3a824d4370d9c040 --- ironic/common/utils.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/ironic/common/utils.py b/ironic/common/utils.py index 9652a1b08b..530e875468 100644 --- a/ironic/common/utils.py +++ b/ironic/common/utils.py @@ -301,29 +301,6 @@ def get_shortened_ipv6_cidr(address): return str(net.cidr) -def is_valid_cidr(address): - """Check if the provided ipv4 or ipv6 address is a valid CIDR address.""" - try: - # Validate the correct CIDR Address - netaddr.IPNetwork(address) - except netaddr.core.AddrFormatError: - return False - except UnboundLocalError: - # NOTE(MotoKen): work around bug in netaddr 0.7.5 (see detail in - # https://github.com/drkjam/netaddr/issues/2) - return False - - # Prior validation partially verify /xx part - # Verify it here - ip_segment = address.split('/') - - if (len(ip_segment) <= 1 or - ip_segment[1] == ''): - return False - - return True - - def get_ip_version(network): """Returns the IP version of a network (IPv4 or IPv6).