def _get_interface_name_index(dbapi, host):
    """
    Builds a dictionary of interfaces indexed by interface name.
    """
    interfaces = {}
    for iface in dbapi.iinterface_get_by_ihost(host.id):
        interfaces[iface.ifname] = iface
    return interfaces