コード例 #1
0
    def callback_for_alert(self, event, *args, **kwargs):
        log.debug("caught an OMSDeviceStatusEvent: %s", event)       
        
#        self._notify_driver_event(OMSEventDriverEvent(event['description']))
     
        log.info('Platform agent %r published OMSDeviceStatusEvent : %s, time: %s',
                 self._platform_id, event, time.time())
コード例 #2
0
    def _configure(self, driver_config):
        """
        Nothing special done here, only calls super.configure(driver_config)

        @param driver_config with required 'oms_uri' entry.
        """
        PlatformDriver._configure(self, driver_config)

        self.nodeCfg = NodeConfiguration()

        self._platform_id = driver_config['node_id']
        self.nodeCfg.openNode(
            self._platform_id,
            driver_config['driver_config_file']['node_cfg_file'])

        self.nms_source = self.nodeCfg.node_meta_data['nms_source']

        self.oms_sample_rate = self.nodeCfg.node_meta_data['oms_sample_rate']

        self.read_only_mode = self.nodeCfg.node_meta_data['read_only_mode']
        log.info("READ ONLY MODE: %s" % self.read_only_mode)

        self.nodeCfg.Print()

        self._construct_resource_schema()
コード例 #3
0
ファイル: driver.py プロジェクト: danmergens/mi-instrument
 def _delete_scheduler(self):
     """
     Remove the autosample schedule.
     """
     try:
         self._remove_scheduler(ScheduledJob.ACQUIRE_SAMPLE)
     except KeyError:
         log.info('Failed to remove scheduled job for ACQUIRE_SAMPLE')
コード例 #4
0
ファイル: driver.py プロジェクト: vipullakhani/mi-instrument
 def _delete_scheduler(self):
     """
     Remove the autosample schedule.
     """
     try:
         self._remove_scheduler(ScheduledJob.ACQUIRE_SAMPLE)
     except KeyError:
         log.info('Failed to remove scheduled job for ACQUIRE_SAMPLE')
コード例 #5
0
    def callback_for_alert(self, event, *args, **kwargs):
        log.debug("caught an OMSDeviceStatusEvent: %s", event)

        #        self._notify_driver_event(OMSEventDriverEvent(event['description']))

        log.info(
            'Platform agent %r published OMSDeviceStatusEvent : %s, time: %s',
            self._platform_id, event, time.time())
コード例 #6
0
    def _disconnect(self, recursion=None):
        log.info("%r: _disconnect...", self._platform_id)

        CIOMSClientFactory.destroy_instance(self._rsn_oms)
        self._rsn_oms = None
        log.debug("%r: CIOMSClient instance destroyed", self._platform_id)

        self._delete_scheduler()
        self._scheduler = None
コード例 #7
0
    def _disconnect(self, recursion=None):
        log.info("%r: _disconnect...", self._platform_id)

        CIOMSClientFactory.destroy_instance(self._rsn_oms)
        self._rsn_oms = None
        log.debug("%r: CIOMSClient instance destroyed", self._platform_id)

        self._delete_scheduler()
        self._scheduler = None
コード例 #8
0
    def _delete_scheduler(self):
        """
        Remove the autosample schedule.
        """
        try:
            self._scheduler.unschedule_job(self._job)
        except KeyError:
            log.info('Failed to remove scheduled job for ACQUIRE_SAMPLE')

        self._scheduler.shutdown()
コード例 #9
0
    def _delete_scheduler(self):
        """
        Remove the autosample schedule.
        """
        try:
            self._scheduler.unschedule_job(self._job)
            self._scheduler.shutdown()
 #           self._scheduler.remove_scheduler(self._job)
        except KeyError:
            log.info('Failed to remove scheduled job for ACQUIRE_SAMPLE')
コード例 #10
0
ファイル: driver.py プロジェクト: kehunt06/mi-instrument
    def _set_params(self, *args, **kwargs):
        if len(args) < 1:
            raise InstrumentParameterException("Set command requires a parameter dict.")
        params = args[0]

        if not isinstance(params, dict):
            raise InstrumentParameterException("Set parameters not a dict.")

        self._param_dict = ProtocolParameterDict()

        for param in params:
            log.info("Creating new parameter: %s", param)
            self._param_dict.add(param, "", None, None)
            self._param_dict.set_value(param, params[param])
コード例 #11
0
ファイル: driver.py プロジェクト: vipullakhani/mi-instrument
    def _set_params(self, *args, **kwargs):
        if len(args) < 1:
            raise InstrumentParameterException(
                'Set command requires a parameter dict.')
        params = args[0]

        if not isinstance(params, dict):
            raise InstrumentParameterException('Set parameters not a dict.')

        self._param_dict = ProtocolParameterDict()

        for param in params:
            log.info('Creating new parameter: %s', param)
            self._param_dict.add(param, '', None, None)
            self._param_dict.set_value(param, params[param])
コード例 #12
0
ファイル: driver.py プロジェクト: danmergens/mi-instrument
    def _handler_connected_connection_lost(self, *args, **kwargs):
        """
        The device connection was lost. Stop comms, destroy protocol FSM and revert to disconnected state.
        @returns: (next_state, result) tuple, (DriverConnectionState.DISCONNECTED, None).
        """
        for connection in self._connection.values():
            connection.stop_comms()

        self._destroy_protocol()

        # Send async agent state change event.
        log.info("_handler_connected_connection_lost: sending LOST_CONNECTION "
                 "event, moving to DISCONNECTED state.")
        self._driver_event(DriverAsyncEvent.AGENT_EVENT,
                           ResourceAgentEvent.LOST_CONNECTION)

        return DriverConnectionState.UNCONFIGURED, None
コード例 #13
0
ファイル: driver.py プロジェクト: vipullakhani/mi-instrument
    def _handler_connected_connection_lost(self, *args, **kwargs):
        """
        The device connection was lost. Stop comms, destroy protocol FSM and revert to disconnected state.
        @returns: (next_state, result) tuple, (DriverConnectionState.DISCONNECTED, None).
        """
        for connection in self._connection.values():
            connection.stop_comms()

        self._destroy_protocol()

        # Send async agent state change event.
        log.info("_handler_connected_connection_lost: sending LOST_CONNECTION "
                 "event, moving to DISCONNECTED state.")
        self._driver_event(DriverAsyncEvent.AGENT_EVENT,
                           ResourceAgentEvent.LOST_CONNECTION)

        return DriverConnectionState.UNCONFIGURED, None
コード例 #14
0
    def _connect(self, recursion=None):
        """
        Creates an CIOMSClient instance, does a ping to verify connection,
        and starts event dispatch.
        """
        log.info("%r: _connect...", self._platform_id)

        # create CIOMSClient:
        oms_uri = self._driver_config['oms_uri']
        log.debug("%r: creating CIOMSClient instance with oms_uri=%r",
                  self._platform_id, oms_uri)
        self._rsn_oms = CIOMSClientFactory.create_instance(oms_uri)
        log.debug("%r: CIOMSClient instance created: %s",
                  self._platform_id, self._rsn_oms)

        # ping to verify connection:
        self._ping()
        self._build_scheduler()  # then start calling it every X seconds
コード例 #15
0
    def _connect(self, recursion=None):
        """
        Creates an CIOMSClient instance, does a ping to verify connection,
        and starts event dispatch.
        """
        log.info("%r: _connect...", self._platform_id)

        # create CIOMSClient:
        oms_uri = self._driver_config['oms_uri']
        log.debug("%r: creating CIOMSClient instance with oms_uri=%r",
                  self._platform_id, oms_uri)
        self._rsn_oms = CIOMSClientFactory.create_instance(oms_uri)
        log.debug("%r: CIOMSClient instance created: %s", self._platform_id,
                  self._rsn_oms)

        # ping to verify connection:
        self._ping()
        self._build_scheduler()  # then start calling it every X seconds
コード例 #16
0
    def _configure(self, driver_config):
        """
        Nothing special done here, only calls super.configure(driver_config)

        @param driver_config with required 'oms_uri' entry.
        """
        PlatformDriver._configure(self, driver_config)

        self.node_config = NodeConfiguration(driver_config["driver_config_file"]["node_cfg_file"])

        self._platform_id = self.node_config.platform_id

        self.nms_source = self.node_config.node_meta_data["nms_source"]

        self.oms_sample_rate = self.node_config.node_meta_data["oms_sample_rate"]

        self.read_only_mode = self.node_config.node_meta_data["read_only_mode"]
        log.info("READ ONLY MODE: %s" % self.read_only_mode)

        self._construct_resource_schema()
コード例 #17
0
 def event_callback(event):
     log.info("driver job triggered, raise event: %s" % event)
     self._fsm.on_event(event)
コード例 #18
0
 def event_callback(event):
     log.info("driver job triggered, raise event: %s" % event)
     self._fsm.on_event(event)