'Method adds port id to list of addresses.
This method is used only for resolving attributes.'

def _add_port_for_address(self, server, extend_networks=True):

    nets = (copy.deepcopy(server.addresses) or {})
    ifaces = server.interface_list()
    ip_mac_mapping_on_port_id = dict((((iface.fixed_ips[0]['ip_address'], iface.mac_addr), iface.port_id) for iface in ifaces))
    for net_name in nets:
        for addr in nets[net_name]:
            addr['port'] = ip_mac_mapping_on_port_id.get((addr['addr'], addr['OS-EXT-IPS-MAC:mac_addr']))
    if extend_networks:
        return self._extend_networks(nets)
    else:
        return nets
