#NEWLINE# def handle( self , request , data ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# network = api . neutron . network_get ( network , data [ 'network_id' ] ) #NEWLINE# data [ 'tenant_id' ] = network . tenant_id #NEWLINE# data [ 'admin_state_up' ] = data [ 'admin_state' ] #NEWLINE# del data [ 'network_name' ] #NEWLINE# del data [ 'admin_state' ] #NEWLINE# port = api . neutron . port_create ( request , ** data ) #NEWLINE# msg = ( _ ( 'Port %s was successfully created.' ) % port [ 'id' ] ) #NEWLINE# LOG . debug ( msg ) #NEWLINE# messages . success ( request , msg ) #NEWLINE# return port #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# msg = ( _ ( 'Failed to create a port for network %s' ) % data [ 'network_id' ] ) #NEWLINE# LOG . info ( msg ) #NEWLINE# redirect = reverse ( 'horizon:admin:networks:detail' , args = ( data [ 'network_id' ] , ) ) #NEWLINE# exceptions . handle ( request , msg , redirect = redirect )