def _get_port_interface_id_index(dbapi, host):
    """
    Builds a dictionary of ports indexed by interface id.
    """
    ports = {}
    for port in dbapi.ethernet_port_get_by_host(host.id):
        ports[port.interface_id] = port
    return ports