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
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)
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)