#NEWLINE# def test_dhcp_scheduler_filters_hosts_without_network_access( self ) : #NEWLINE# #INDENT# dhcp_agent1 = helpers . register_dhcp_agent ( host = 'host1' ) #NEWLINE# dhcp_agent2 = helpers . register_dhcp_agent ( host = 'host2' ) #NEWLINE# dhcp_agent3 = helpers . register_dhcp_agent ( host = 'host3' ) #NEWLINE# dhcp_agents = [ dhcp_agent1 , dhcp_agent2 , dhcp_agent3 ] #NEWLINE# helpers . register_ovs_agent ( host = 'host1' , bridge_mappings = { #NEWLINE# #INDENT# 'physnet1' : 'br-eth-1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# helpers . register_ovs_agent ( host = 'host2' , bridge_mappings = { #NEWLINE# #INDENT# 'physnet2' : 'br-eth-1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# helpers . register_ovs_agent ( host = 'host3' , bridge_mappings = { #NEWLINE# #INDENT# 'physnet2' : 'br-eth-1' , #NEWLINE# #UNINDENT# } ) #NEWLINE# admin_context = context . get_admin_context ( ) #NEWLINE# net = self . driver . create_network ( admin_context , { #NEWLINE# #INDENT# 'network' : { #NEWLINE# #INDENT# 'name' : 'net1' , #NEWLINE# providernet . NETWORK_TYPE : 'vlan' , #NEWLINE# providernet . PHYSICAL_NETWORK : 'physnet1' , #NEWLINE# providernet . SEGMENTATION_ID : 1 , #NEWLINE# 'tenant_id' : 'tenant_one' , #NEWLINE# 'admin_state_up' : True , #NEWLINE# 'shared' : True , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . driver . create_subnet ( admin_context , { #NEWLINE# #INDENT# 'subnet' : { #NEWLINE# #INDENT# 'name' : 'name' , #NEWLINE# 'ip_version' : 4 , #NEWLINE# 'network_id' : admin_context [ 'id' ] , #NEWLINE# 'cidr' : '10.0.0.0/24' , #NEWLINE# 'gateway_ip' : constants . ATTR_NOT_SPECIFIED , #NEWLINE# 'allocation_pools' : constants . ATTR_NOT_SPECIFIED , #NEWLINE# 'dns_nameservers' : constants . ATTR_NOT_SPECIFIED , #NEWLINE# 'host_routes' : constants . ATTR_NOT_SPECIFIED , #NEWLINE# 'tenant_id' : 'tenant_one' , #NEWLINE# 'enable_dhcp' : True , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . plugin . schedule_network ( admin_context , net ) #NEWLINE# dhcp_agents = self . driver . get_dhcp_agents_hosting_networks ( admin_context , [ net [ 'id' ] ] ) #NEWLINE# self . assertEqual ( 1 , len ( dhcp_agents ) ) #NEWLINE# self . assertEqual ( 'host1' , dhcp_agents [ 0 ] [ 'host' ] )