예제 #1
0
    def connect(self, recursion=None):
        """
        Creates an CIOMSClient instance, does a ping to verify connection,
        and starts event dispatch.
        """
        # 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()

        # start event dispatch:
        self._start_event_dispatch()

        # TODO(OOIION-1495) review the following. Commented out for the moment.
        # 2014-06-05: The pending review in terms of ports is still relevant in
        # what follows from the original comment here, but note that the
        # Connect_instrument and disConnect_instrument operations have been
        # removed from the CI-OMS interface.
        # Note, per the CI-OMS spec ports need to be turned OFF to then proceed
        # with connecting instruments. So we need to determine whether we
        # want to turn all ports ON in this "connect driver" operation,
        # and then add the logic to turn a port OFF before connecting
        # instruments, and then ON again; or, just do the OFF/ON logic in the
        # Connect_instrument and disConnect_instrument operations,
        # but not here.
        """
예제 #2
0
    def connect(self, recursion=None):
        """
        Creates an CIOMSClient instance, does a ping to verify connection,
        and starts event dispatch.
        """
        # 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()

        # start event dispatch:
        self._start_event_dispatch()

        # TODO(OOIION-1495) review the following. Commented out for the moment.
        # 2014-06-05: The pending review in terms of ports is still relevant in
        # what follows from the original comment here, but note that the
        # connect_instrument and disconnect_instrument operations have been
        # removed from the CI-OMS interface.
        # Note, per the CI-OMS spec ports need to be turned OFF to then proceed
        # with connecting instruments. So we need to determine whether we
        # want to turn all ports ON in this "connect driver" operation,
        # and then add the logic to turn a port OFF before connecting
        # instruments, and then ON again; or, just do the OFF/ON logic in the
        # connect_instrument and disconnect_instrument operations,
        # but not here.
        """
예제 #3
0
    def _configure(self, config):
        """
        Configures this driver. In this base class it basically
        calls validate_driver_configuration and then assigns the given
        config to self._driver_config.

        @param driver_config Driver configuration.
        """

        #
        # NOTE the "pnode" parameter may be not very "standard" but it is the
        # current convenient mechanism that captures the overall definition
        # of the corresponding platform (most of which coming from configuration)
        #


        # Use the network definition provided by RSN OMS directly.
        rsn_oms = CIOMSClientFactory.create_instance()
        network_definition = RsnOmsUtil.build_network_definition(rsn_oms)
        CIOMSClientFactory.destroy_instance(rsn_oms)

        platform_id = 'LJ01D'
        self._pnode = network_definition.pnodes[platform_id]

        #self._pnode = config.get('pnode')

        self._platform_id = self._pnode.platform_id
        if self._pnode.parent:
            self._parent_platform_id = self._pnode.parent.platform_id
        else:
            self._parent_platform_id = None

        self._platform_attributes = \
            dict((a.attr_id, a.defn) for a in self._pnode.attrs.itervalues())

        log.debug("%r: PlatformDriver constructor called: pnode:\n%s\n"
                      "_platform_attributes=%s",
                      self._platform_id,
                      NetworkUtil._dump_pnode(self._pnode, include_subplatforms=False),
                      self._platform_attributes)

        self.validate_driver_configuration(config)
        self._driver_config = config
예제 #4
0
    def disconnect(self, recursion=None):
        """
        Stops event dispatch and destroys the CIOMSClient instance.
        """
        self._stop_event_dispatch()

        # TODO(OOIION-1495) review the following. Only change is the use
        # of self._pnode.ports instead of self._active_ports,
        # while we address the "active ports" concept mentioned above.
        # BTW, is it OK to turn off ports in this "disconnect driver" operation?

        # power off all ports with connected devices
        if recursion:
            for port in self._pnode.ports:
                log.debug('disconnect power port: %s', port)
                self.turn_off_port(port)

        CIOMSClientFactory.destroy_instance(self._rsn_oms)
        self._rsn_oms = None
        log.debug("%r: CIOMSClient instance destroyed", self._platform_id)
예제 #5
0
    def disconnect(self, recursion=None):
        """
        Stops event dispatch and destroys the CIOMSClient instance.
        """
        self._stop_event_dispatch()

        # TODO(OOIION-1495) review the following. Only change is the use
        # of self._pnode.ports instead of self._active_ports,
        # while we address the "active ports" concept mentioned above.
        # BTW, is it OK to turn off ports in this "disconnect driver" operation?

        # power off all ports with connected devices
        if recursion:
            for port in self._pnode.ports:
                log.debug('disconnect power port: %s', port)
                self.turn_off_port(port)

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