#NEWLINE# def setup_dhcp_port( self , network ) : #NEWLINE# #INDENT# 'Create/update DHCP port for the host if needed and return port.' #NEWLINE# device_id = self . get_device_id ( network ) #NEWLINE# dhcp_subnets = { subnet . id : subnet for subnet in network . subnets if subnet . enable_dhcp } #NEWLINE# for setup_method in ( self . _setup_existing_dhcp_port , self . _setup_reserved_dhcp_port , self . _setup_new_dhcp_port ) : #NEWLINE# #INDENT# dhcp_port = setup_method ( network , device_id , dhcp_subnets ) #NEWLINE# if dhcp_port : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise exceptions . Conflict ( ) #NEWLINE# #UNINDENT# fixed_ips = [ dict ( subnet_id = fixed_ip . subnet_id , ip_address = fixed_ip . ip_address , subnet = dhcp_subnets [ fixed_ip . subnet_id ] ) for fixed_ip in dhcp_port . fixed_ips ] #NEWLINE# ips = [ ( DictModel ( item ) if isinstance ( item , dict ) else item ) for item in fixed_ips ] #NEWLINE# dhcp_port . fixed_ips = ips #NEWLINE# return dhcp_port