<s> import netaddr <EOL> from neutron . ipam import utils <EOL> from neutron . tests import base <EOL> class TestIpamUtils ( base . BaseTestCase ) : <EOL> def test_check_subnet_ip_v4_network ( self ) : <EOL> self . assertFalse ( utils . check_subnet_ip ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_check_subnet_ip_v4_broadcast ( self ) : <EOL> self . assertFalse ( utils . check_subnet_ip ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_check_subnet_ip_v4_valid ( self ) : <EOL> self . assertTrue ( utils . check_subnet_ip ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertTrue ( utils . check_subnet_ip ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_check_subnet_ip_v6_network ( self ) : <EOL> self . assertFalse ( utils . check_subnet_ip ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> def test_check_subnet_ip_v6_valid ( self ) : <EOL> self . assertTrue ( utils . check_subnet_ip ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> self . assertTrue ( utils . check_subnet_ip ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) ) <EOL> def test_generate_pools_v4_nogateway ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> expected = [ netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , None ) ) <EOL> def test_generate_pools_v4_gateway_first ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> gateway = '<STR_LIT>' <EOL> expected = [ netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , gateway ) ) <EOL> def test_generate_pools_v4_gateway_last ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> gateway = '<STR_LIT>' <EOL> expected = [ netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , gateway ) ) <EOL> def test_generate_pools_v4_32 ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> expected = [ netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , None ) ) <EOL> def test_generate_pools_v4_31 ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> expected = [ ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , None ) ) <EOL> def test_generate_pools_v4_gateway_middle ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> gateway = '<STR_LIT>' <EOL> expected = [ netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , gateway ) ) <EOL> def test_generate_pools_v6_nogateway ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> expected = [ netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , None ) ) <EOL> def test_generate_pools_v6_empty ( self ) : <EOL> cidr = '<STR_LIT>' <EOL> expected = [ netaddr . IPRange ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> self . assertEqual ( expected , utils . generate_pools ( cidr , None ) ) </s>
