Notify the Cisco cfg agent handling a particular hosting_device.

        A single notification can contain multiple routers.
494875
def _agent_notification_bulk(self, context, method, routers,
                                 hosting_device, operation):
        
        admin_context = context.is_admin and context or context.elevated()
        dmplugin = bc.get_plugin(cisco_constants.DEVICE_MANAGER)
        if (hosting_device is not None and extensions.is_extension_supported(
                dmplugin, CFGAGENT_SCHED)):
            agents = dmplugin.get_cfg_agents_for_hosting_devices(
                admin_context, [hosting_device['id']], admin_state_up=True,
                schedule=True)
            if agents:
                agent = agents[0]
                LOG.debug('Notify %(agent_type)s at %(topic)s.%(host)s the '
                          'message %(method)s [BULK]',
                          {'agent_type': agent.agent_type,
                           'topic': CFG_AGENT_L3_ROUTING,
                           'host': agent.host,
                           'method': method})
                cctxt = self.client.prepare(server=agent.host,
                                            version='1.1')
                cctxt.cast(context, method, routers=routers)
869658
def enable_host_notifications(self, host):
        
        if not host.notifications_enabled:
            host.modified_attributes |= \
                DICT_MODATTR["MODATTR_NOTIFICATIONS_ENABLED"].value
            host.notifications_enabled = True
            self.send_an_element(host.get_update_status_brok())
701054
def remove_router_from_hosting_device(self, context, hosting_device_id,
                                          router_id):
        
        e_context = context.elevated()
        r_hd_binding_db = self._get_router_binding_info(e_context, router_id)
        if r_hd_binding_db.hosting_device_id != hosting_device_id:
            raise routertypeawarescheduler.RouterNotHostedByHostingDevice(
                router_id=router_id, hosting_device_id=hosting_device_id)
        router = self.get_router(context, router_id)
        self.add_type_and_hosting_device_info(
            e_context, router, r_hd_binding_db, schedule=False)
        # conditionally remove router from backlog ensure it does not get
        # scheduled automatically
        self.remove_router_from_backlog(id)
        l3_cfg_notifier = self.agent_notifiers.get(AGENT_TYPE_L3_CFG)
        if l3_cfg_notifier:
            l3_cfg_notifier.router_removed_from_hosting_device(context, router)
        LOG.debug("Unscheduling router %s", r_hd_binding_db.router_id)
        self.unschedule_router_from_hosting_device(context, r_hd_binding_db)
        # now unbind the router from the hosting device
        with e_context.session.begin(subtransactions=True):
            r_hd_binding_db.hosting_device_id = None
            e_context.session.add(r_hd_binding_db)
224339
def list_config_agents_handling_hosting_device(
            self, client, hosting_device_id, **_params):
        """"""
        resource_path = '/dev_mgr/hosting_devices/%s'
        return client.get((resource_path + HOSTING_DEVICE_CFG_AGENTS) %
                          hosting_device_id, params=_params)
640576
def assign_hosting_device_to_cfg_agent(self, context, cfg_agent_id,
                                           hosting_device_id):
        """"""
        hd_db = self._get_hosting_device(context, hosting_device_id)
        if hd_db.cfg_agent_id:
            if hd_db.cfg_agent_id == cfg_agent_id:
                return
            LOG.debug('Hosting device %(hd_id)s has already been assigned to '
                      'Cisco cfg agent %(agent_id)s',
                      {'hd_id': hosting_device_id, 'agent_id': cfg_agent_id})
            raise ciscocfgagentscheduler.HostingDeviceAssignedToCfgAgent(
                hosting_device_id=hosting_device_id, agent_id=cfg_agent_id)
        cfg_agent_db = get_agent_db_obj(self._get_agent(context, cfg_agent_id))
        if (cfg_agent_db.agent_type != c_constants.AGENT_TYPE_CFG or
                cfg_agent_db.admin_state_up is not True):
            raise ciscocfgagentscheduler.InvalidCfgAgent(agent_id=cfg_agent_id)
        self._bind_hosting_device_to_cfg_agent(context, hd_db, cfg_agent_db)
        cfg_notifier = self.agent_notifiers.get(c_constants.AGENT_TYPE_CFG)
        if cfg_notifier:
            cfg_notifier.hosting_devices_assigned_to_cfg_agent(
                context, [hosting_device_id], cfg_agent_db.host)
630430
def hosting_devices_assigned_to_cfg_agent(self, context, payload):
        """"""
        LOG.debug("Got hosting device assigned, payload: %s" % payload)
        try:
            if payload['hosting_device_ids']:
                #TODO(hareeshp): implement assignment of hosting devices
                self.routing_service_helper.fullsync = True
        except KeyError as e:
            LOG.error("Invalid payload format for received RPC message "
                      "`hosting_devices_assigned_to_cfg_agent`. Error is "
                      "%(error)s. Payload is %(payload)s",
                      {'error': e, 'payload': payload})
627655
def notify(title, message, retcode=None):
    
    try:
        import Foundation
        import objc
    except ImportError:
        import sys
        import logging

        logger = logging.getLogger(__name__)
        if sys.platform.startswith('darwin') and hasattr(sys, 'real_prefix'):
            logger.error(
                "Using ntfy with the MacOS Notification Center doesn't "
                "work within a virtualenv")
            sys.exit(1)
        else:
            raise

    NSUserNotification = objc.lookUpClass('NSUserNotification')
    NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')

    notification = NSUserNotification.alloc().init()
    notification.setTitle_(title)
    if message is not None:
        notification.setInformativeText_(message)
    notification.setDeliveryDate_(Foundation.NSDate.date())

    NSUserNotificationCenter.defaultUserNotificationCenter()\
        .scheduleNotification_(notification)
607932
def report_dead_hosting_devices(self, context, hd_ids=None):
        
        cctxt = self.client.prepare()
        cctxt.cast(context, 'report_non_responding_hosting_devices',
                   host=self.host, hosting_device_ids=hd_ids)
488436
def detectNintendo(self):
        
        return UAgentInfo.deviceNintendo in self.__userAgent \
            or UAgentInfo.deviceNintendo in self.__userAgent \
            or UAgentInfo.deviceNintendo in self.__userAgent
1218623
def _domain_event_device_removal_failed_cb(conn, domain, dev, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'dev': dev
    })
600791
def notify(msg, msg_type=0, t=None):
    msg = msg.replace('"', '\\"')
    ""
    if platform.system() == "Darwin":
        command = notify_command_osx(msg, msg_type, t)
    else:
        command = notify_command_linux(msg, t)

    try:
        subprocess.call(command)
        return True
    except OSError as e:
        return False
1056808
def _agent_notification(self, context, method, hosting_devices, operation):
        """"""
        admin_context = context.is_admin and context or context.elevated()
        for hosting_device in hosting_devices:
            agents = self._dmplugin.get_cfg_agents_for_hosting_devices(
                admin_context, hosting_device['id'], admin_state_up=True,
                schedule=True)
            for agent in agents:
                LOG.debug('Notify %(agent_type)s at %(topic)s.%(host)s the '
                          'message %(method)s',
                          {'agent_type': agent.agent_type,
                           'topic': agent.topic,
                           'host': agent.host,
                           'method': method})
                cctxt = self.client.prepare(server=agent.host)
                cctxt.cast(context, method)
425466
def notify():
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x3e)  # 00111110
    c = NotificationIndicator()
    packet = a / b / c
    return packet
1326034
def notify(self, *args, **kwargs):
        ''''''
        for handler in tuple(self.handlers):
            handler(*args, **kwargs)
374156
def host_trigger_pull(trg_queue, ignore_listener=False):
    ''''''
    trigger_pull(trg_queue, ignore_listener=ignore_listener,
                 trigger=_c.FSQ_HOSTS_TRIGGER)
1251053
def _domain_event_device_added_cb(conn, domain, dev, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'dev': dev
    })
394673
def enable_host_svc_notifications(self, host):
        
        for service_id in host.services:
            if service_id in self.daemon.services:
                service = self.daemon.services[service_id]
                self.enable_svc_notifications(service)
                self.send_an_element(service.get_update_status_brok())