def __init__(self): cisco_switches = conf.get_device_dictionary() self.nexus_switches = dict(((key[1], key[2]), val) for key, val in cisco_switches.items() if key[0] == 'NEXUS_SWITCH') self.credentials = {} self.connections = {}
def initialize(): dev_dict = config.get_device_dictionary() for key in dev_dict: dev_id, dev_ip, dev_key = key if dev_key == const.USERNAME: try: cdb.add_credential( dev_ip, dev_dict[dev_id, dev_ip, const.USERNAME], dev_dict[dev_id, dev_ip, const.PASSWORD], dev_id) except cexc.CredentialAlreadyExists: # We are quietly ignoring this, since it only happens # if this class module is loaded more than once, in # which case, the credentials are already populated pass
def __init__(self): """Extract configuration parameters from the configuration file.""" self._client = importutils.import_object(conf.CISCO.nexus_driver) LOG.debug(_("Loaded driver %s"), conf.CISCO.nexus_driver) self._nexus_switches = conf.get_device_dictionary()