'Return the agents that can host the network.
This function returns a dictionary which has 3 keys.
n_agents: The number of agents should be scheduled. If n_agents=0,
all networks are already scheduled or no more agent can host the
network.
hostable_agents: A list of agents which can host the network.
hosted_agents: A list of agents which already hosts the network.'

def filter_agents(self, plugin, context, network):

    agents_dict = self._get_network_hostable_dhcp_agents(plugin, context, network)
    if ((not agents_dict['hostable_agents']) or (agents_dict['n_agents'] <= 0)):
        return {'n_agents': 0, 'hostable_agents': [], 'hosted_agents': agents_dict['hosted_agents']}
    return agents_dict
