# Path: oslo_utils/netutils.py
# LOG = logging.getLogger(__name__)
# _IS_IPV6_ENABLED = None
#             _IS_IPV6_ENABLED = disabled == "0"
#             _IS_IPV6_ENABLED = False
#     LOCALHOST = '127.0.0.1'
# def parse_host_port(address, default_port=None):
# def is_valid_ipv4(address, strict=None):
# def is_valid_ipv6(address):
# def is_valid_cidr(address):
# def is_valid_ipv6_cidr(address):
# def get_ipv6_addr_by_EUI64(prefix, mac):
# def get_mac_addr_by_ipv6(ipv6, dialect=netaddr.mac_unix_expanded):
# def is_ipv6_enabled():
# def escape_ipv6(address):
# def is_valid_ip(address):
# def is_valid_mac(address):
# def _is_int_in_range(value, start, end):
# def is_valid_port(port):
# def is_valid_icmp_type(type):
# def is_valid_icmp_code(code):
# def get_my_ipv4():
# def _get_my_ipv4_address():
#     def params(self, collapse=True):
# def urlsplit(url, scheme='', allow_fragments=True):
# def set_tcp_keepalive(sock, tcp_keepalive=True,
#                       tcp_keepidle=None,
#                       tcp_keepalive_interval=None,
#                       tcp_keepalive_count=None):
# class _ModifiedSplitResult(parse.SplitResult):


import contextlib
import io
import socket
import netaddr
import netifaces
from unittest import mock
from oslotest import base as test_base
from oslo_utils import netutils

        self.assertFalse(netutils.is_valid_ip('256.0.0.0'))

        self.assertFalse(netutils.is_valid_ip('::1.2.3.'))

        self.assertFalse(netutils.is_valid_ip(''))

        self.assertFalse(netutils.is_valid_ip(None))

    def test_is_valid_mac(self):
        self.assertTrue(netutils.is_valid_mac("52:54:00:cf:2d:31"))
        self.assertTrue(netutils.is_valid_mac(u"52:54:00:cf:2d:31"))
        self.assertFalse(netutils.is_valid_mac("127.0.0.1"))
        self.assertFalse(netutils.is_valid_mac("not:a:mac:address"))
        self.assertFalse(netutils.is_valid_mac("52-54-00-cf-2d-31"))
        self.assertFalse(netutils.is_valid_mac("aa bb cc dd ee ff"))
        self.assertTrue(netutils.is_valid_mac("AA:BB:CC:DD:EE:FF"))
        self.assertFalse(netutils.is_valid_mac("AA BB CC DD EE FF"))
        self.assertFalse(netutils.is_valid_mac("AA-BB-CC-DD-EE-FF"))

    def test_is_valid_cidr(self):
        self.assertTrue(netutils.is_valid_cidr('10.0.0.0/24'))
        self.assertTrue(netutils.is_valid_cidr('10.0.0.1/32'))
        self.assertTrue(netutils.is_valid_cidr('0.0.0.0/0'))
        self.assertTrue(netutils.is_valid_cidr('2600::/64'))
        self.assertTrue(netutils.is_valid_cidr(
                        '0000:0000:0000:0000:0000:0000:0000:0001/32'))

        self.assertFalse(netutils.is_valid_cidr('10.0.0.1'))
        self.assertFalse(netutils.is_valid_cidr('10.0.0.1/33'))

# Path: oslo_utils/netutils.py
# LOG = logging.getLogger(__name__)
# _IS_IPV6_ENABLED = None
#             _IS_IPV6_ENABLED = disabled == "0"
#             _IS_IPV6_ENABLED = False
#     LOCALHOST = '127.0.0.1'
# def parse_host_port(address, default_port=None):
# def is_valid_ipv4(address, strict=None):
# def is_valid_ipv6(address):
# def is_valid_cidr(address):
# def is_valid_ipv6_cidr(address):
# def get_ipv6_addr_by_EUI64(prefix, mac):
# def get_mac_addr_by_ipv6(ipv6, dialect=netaddr.mac_unix_expanded):
# def is_ipv6_enabled():
# def escape_ipv6(address):
# def is_valid_ip(address):
# def is_valid_mac(address):
# def _is_int_in_range(value, start, end):
# def is_valid_port(port):
# def is_valid_icmp_type(type):
# def is_valid_icmp_code(code):
# def get_my_ipv4():
# def _get_my_ipv4_address():
#     def params(self, collapse=True):
# def urlsplit(url, scheme='', allow_fragments=True):
# def set_tcp_keepalive(sock, tcp_keepalive=True,
#                       tcp_keepidle=None,
#                       tcp_keepalive_interval=None,
#                       tcp_keepalive_count=None):
# class _ModifiedSplitResult(parse.SplitResult):


# Path: oslo_utils/tests/test_netutils.py
import contextlib
import io
import socket
import netaddr
import netifaces
from unittest import mock
from oslotest import base as test_base
from oslo_utils import netutils


        self.assertFalse(netutils.is_valid_ip('256.0.0.0'))

        self.assertFalse(netutils.is_valid_ip('::1.2.3.'))

        self.assertFalse(netutils.is_valid_ip(''))

        self.assertFalse(netutils.is_valid_ip(None))

    def test_is_valid_mac(self):
        self.assertTrue(netutils.is_valid_mac("52:54:00:cf:2d:31"))
        self.assertTrue(netutils.is_valid_mac(u"52:54:00:cf:2d:31"))
        self.assertFalse(netutils.is_valid_mac("127.0.0.1"))
        self.assertFalse(netutils.is_valid_mac("not:a:mac:address"))
        self.assertFalse(netutils.is_valid_mac("52-54-00-cf-2d-31"))
        self.assertFalse(netutils.is_valid_mac("aa bb cc dd ee ff"))
        self.assertTrue(netutils.is_valid_mac("AA:BB:CC:DD:EE:FF"))
        self.assertFalse(netutils.is_valid_mac("AA BB CC DD EE FF"))
        self.assertFalse(netutils.is_valid_mac("AA-BB-CC-DD-EE-FF"))

    def test_is_valid_cidr(self):
        self.assertTrue(netutils.is_valid_cidr('10.0.0.0/24'))
        self.assertTrue(netutils.is_valid_cidr('10.0.0.1/32'))
        self.assertTrue(netutils.is_valid_cidr('0.0.0.0/0'))
        self.assertTrue(netutils.is_valid_cidr('2600::/64'))
        self.assertTrue(netutils.is_valid_cidr(
                        '0000:0000:0000:0000:0000:0000:0000:0001/32'))

        self.assertFalse(netutils.is_valid_cidr('10.0.0.1'))
        self.assertFalse(netutils.is_valid_cidr('10.0.0.1/33'))

        self.assertFalse(netutils.is_valid_cidr(10))