'Return a vacant binding_index to use and whether or not it exists.
Each RouterL3AgentBinding has a binding_index which is unique per
router_id, and when creating a single binding we require to find a
\'vacant\' binding_index which isn\'t yet used - for example if we have
bindings with indices 1 and 3, then clearly binding_index == 2 is free.
:returns: binding_index.'

def get_vacant_binding_index(self, context, router_id, is_manual_scheduling=False):

    num_agents = self.get_number_of_agents_for_scheduling(context)
    pager = base_obj.Pager(sorts=[('binding_index', True)])
    bindings = rb_obj.RouterL3AgentBinding.get_objects(context, _pager=pager, router_id=router_id)
    binding_indices = [b.binding_index for b in bindings]
    all_indicies = set(range(rb_model.LOWEST_BINDING_INDEX, (num_agents + 1)))
    open_slots = sorted(list((all_indicies - set(binding_indices))))
    if open_slots:
        return open_slots[0]
    if is_manual_scheduling:
        return (max(all_indicies) + 1)
    return (-1)
