def update_port_ip_address(self):
leases = None<EOL>req = dict(ip='<STR_LIT>')<EOL>instances = self.get_vms_for_this_req(**req)<EOL>if instances is None:<EOL><INDENT>return<EOL><DEDENT>for vm in instances:<EOL><INDENT>if not leases:<EOL><INDENT>leases = self._get_ip_leases()<EOL>if not leases:<EOL><INDENT>return<EOL><DEDENT><DEDENT>for line in leases:<EOL><INDENT>if line.startswith('<STR_LIT>') and line.endswith('<STR_LIT>'):<EOL><INDENT>ip_addr = line.split()[<NUM_LIT:1>]<EOL><DEDENT>if '<STR_LIT>' in line:<EOL><INDENT>if vm.mac == line.replace('<STR_LIT:;>', '<STR_LIT>').split()[<NUM_LIT:2>]:<EOL><INDENT>LOG.info('<STR_LIT>',<EOL>{'<STR_LIT>': ip_addr, '<STR_LIT>': vm.mac})<EOL>try:<EOL><INDENT>rule_info = dict(ip=ip_addr, mac=vm.mac,<EOL>port=vm.port_id,<EOL>status='<STR_LIT>')<EOL>self.neutron_event.update_ip_rule(str(vm.host),<EOL>str(rule_info))<EOL><DEDENT>except (rpc.MessagingTimeout, rpc.RPCException,<EOL>rpc.RemoteError):<EOL><INDENT>LOG.error("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>params = dict(columns=dict(ip=ip_addr))<EOL>self.update_vm_db(vm.port_id, **params)<EOL>vm_info = dict(status=vm.status, vm_mac=vm.mac,<EOL>segmentation_id=vm.segmentation_id,<EOL>host=vm.host, port_uuid=vm.port_id,<EOL>net_uuid=vm.network_id,<EOL>oui=dict(ip_addr=ip_addr,<EOL>vm_name=vm.name,<EOL>vm_uuid=vm.instance_id,<EOL>gw_mac=vm.gw_mac,<EOL>fwd_mod=vm.fwd_mod,<EOL>oui_id='<STR_LIT>'))<EOL>try:<EOL><INDENT>self.neutron_event.send_vm_info(vm.host,<EOL>str(vm_info))<EOL><DEDENT>except (rpc.MessagingTimeout, rpc.RPCException,<EOL>rpc.RemoteError):<EOL><INDENT>LOG.error('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>
Find the ip address that assinged to a port via DHCP

        The port database will be updated with the ip address.