'Notify all the agents that are hosting the network.'

def _notify_agents(self, context, method, payload, network_id):

    no_agents = (not utils.is_extension_supported(self.plugin, constants.DHCP_AGENT_SCHEDULER_EXT_ALIAS))
    fanout_required = ((method == 'network_delete_end') or no_agents)
    cast_required = (method != 'network_create_end')
    if fanout_required:
        self._fanout_message(context, method, payload)
    elif cast_required:
        admin_ctx = (context if context.is_admin else context.elevated())
        network = self.plugin.get_network(admin_ctx, network_id)
        if (('subnet' in payload) and payload['subnet'].get('segment_id')):
            segment_plugin = directory.get_plugin('segments')
            segment = segment_plugin.get_segment(context, payload['subnet']['segment_id'])
            network['candidate_hosts'] = segment['hosts']
        agents = self.plugin.get_dhcp_agents_hosting_networks(context, [network_id], hosts=network.get('candidate_hosts'))
        schedule_required = ((method == 'subnet_create_end') or ((method == 'port_create_end') and (not self._is_reserved_dhcp_port(payload['port']))))
        if schedule_required:
            agents = self._schedule_network(admin_ctx, network, agents)
        if (not agents):
            LOG.debug('Network    %s    is    not    hosted    by    any    dhcp    agent', network_id)
            return
        enabled_agents = self._get_enabled_agents(context, network, agents, method, payload)
        for agent in enabled_agents:
            self._cast_message(context, method, payload, agent.host, agent.topic)
