#NEWLINE# @ mock . patch ( 'nailgun.rpc.cast' ) #NEWLINE# def test_default_network_assignment_for_multiple_node_groups( self , _ ) : #NEWLINE# #INDENT# cluster = self . env . create ( release_kwargs = { #NEWLINE# #INDENT# 'operating_system' : consts . RELEASE_OS . ubuntu , #NEWLINE# #UNINDENT# } , cluster_kwargs = { #NEWLINE# #INDENT# 'net_provider' : consts . CLUSTER_NET_PROVIDERS . neutron , #NEWLINE# 'net_segment_type' : consts . NEUTRON_SEGMENT_TYPES . tun , #NEWLINE# #UNINDENT# } ) #NEWLINE# node1 = self . _add_node_with_pxe_on_eth2 ( cluster [ 'id' ] ) #NEWLINE# node_group = self . env . create_node_group ( api = False ) #NEWLINE# resp = self . env . setup_networks_for_nodegroup ( cluster_id = cluster [ 'id' ] , node_group = node_group , cidr_start = '199.99' ) #NEWLINE# self . assertEqual ( resp . status_code , 200 ) #NEWLINE# node2 = self . _add_node_with_pxe_on_eth2 ( cluster [ 'id' ] , ip = '199.99.9.3' ) #NEWLINE# self . assertEqual ( node2 [ 'group_id' ] , node_group . id ) #NEWLINE# for node in [ node1 , node2 ] : #NEWLINE# #INDENT# resp = self . app . get ( reverse ( 'NodeNICsHandler' , kwargs = { #NEWLINE# #INDENT# 'node_id' : node [ 'id' ] , #NEWLINE# #UNINDENT# } ) , headers = self . default_headers ) #NEWLINE# self . assertEqual ( resp . status_code , 200 ) #NEWLINE# nics = resp . json_body #NEWLINE# node_net_names = [ ] #NEWLINE# pxe_found = False #NEWLINE# for nic in nics : #NEWLINE# #INDENT# net_names = [ net [ 'name' ] for net in nic [ 'assigned_networks' ] ] #NEWLINE# node_net_names . extend ( net_names ) #NEWLINE# if nic [ 'pxe' ] : #NEWLINE# #INDENT# self . assertIn ( 'fuelweb_admin' , net_names ) #NEWLINE# self . assertEqual ( nic [ 'name' ] , 'eth2' ) #NEWLINE# pxe_found = True #NEWLINE# #UNINDENT# #UNINDENT# self . assertTrue ( pxe_found ) #NEWLINE# self . assertEqual ( len ( node_net_names ) , len ( set ( node_net_names ) ) )