#NEWLINE# def test_change_mac_of_assigned_nics( self ) : #NEWLINE# #INDENT# def get_nodes( ) : #NEWLINE# #INDENT# resp = self . app . get ( reverse ( 'NodeCollectionHandler' , kwargs = { #NEWLINE# #INDENT# 'cluster_id' : cluster . id , #NEWLINE# #UNINDENT# } ) , headers = self . default_headers ) #NEWLINE# return resp . json_body #NEWLINE# #UNINDENT# meta = self . env . default_metadata ( ) #NEWLINE# meta [ 'interfaces' ] = [ { #NEWLINE# #INDENT# 'name' : 'eth0' , #NEWLINE# 'mac' : self . env . generate_random_mac ( ) , #NEWLINE# 'pxe' : True , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'eth1' , #NEWLINE# 'mac' : self . env . generate_random_mac ( ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'eth2' , #NEWLINE# 'mac' : self . env . generate_random_mac ( ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'eth3' , #NEWLINE# 'mac' : self . env . generate_random_mac ( ) , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'eth4' , #NEWLINE# 'mac' : self . env . generate_random_mac ( ) , #NEWLINE# #UNINDENT# } ] #NEWLINE# cluster = self . env . create ( nodes_kwargs = [ { #NEWLINE# #INDENT# 'api' : True , #NEWLINE# 'meta' : meta , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# for handler in ( 'NodeAgentHandler' , 'NodeHandler' , 'NodeCollectionHandler' ) : #NEWLINE# #INDENT# nodes_data = get_nodes ( ) #NEWLINE# self . assertEqual ( len ( nodes_data ) , 1 ) #NEWLINE# node_db = objects . Node . get_by_uid ( nodes_data [ 0 ] [ 'id' ] ) #NEWLINE# adm_eth = self . env . network_manager . _get_interface_by_network_name ( node_db , 'fuelweb_admin' ) #NEWLINE# for iface in nodes_data [ 0 ] [ 'meta' ] [ 'interfaces' ] : #NEWLINE# #INDENT# if ( iface [ 'name' ] != adm_eth . name ) : #NEWLINE# #INDENT# iface [ 'mac' ] = self . env . generate_random_mac ( ) #NEWLINE# #UNINDENT# #UNINDENT# data = { #NEWLINE# #INDENT# 'id' : nodes_data [ 0 ] [ 'id' ] , #NEWLINE# 'meta' : nodes_data [ 0 ] [ 'meta' ] , #NEWLINE# #UNINDENT# } #NEWLINE# if ( handler in ( 'NodeCollectionHandler' , ) ) : #NEWLINE# #INDENT# data = [ data ] #NEWLINE# #UNINDENT# if ( handler in ( 'NodeHandler' , ) ) : #NEWLINE# #INDENT# endpoint = reverse ( handler , kwargs = { #NEWLINE# #INDENT# 'obj_id' : data [ 'id' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# endpoint = reverse ( handler ) #NEWLINE# #UNINDENT# self . app . put ( endpoint , jsonutils . dumps ( data ) , headers = nodes_data . default_headers ) #NEWLINE# nodes_data = get_nodes ( ) #NEWLINE# self . assertEqual ( len ( nodes_data ) , 1 )