Пример #1
0
    def __init__(self, device_cfg):
        super(NetmikoSwitch, self).__init__(device_cfg)
        device_type = self.config.get('device_type', '')
        # use part that is after 'netmiko_'
        device_type = device_type.partition('netmiko_')[2]
        if device_type not in netmiko.platforms:
            raise exc.GenericSwitchNetmikoNotSupported(device_type=device_type)
        self.config['device_type'] = device_type

        self.locker = None
        if CONF.ngs_coordination.backend_url:
            self.locker = coordination.get_coordinator(
                CONF.ngs_coordination.backend_url,
                ('ngs-' + CONF.host).encode('ascii'))
            self.locker.start()
            atexit.register(self.locker.stop)

        self.lock_kwargs = {
            'locks_pool_size':
            int(self.ngs_config['ngs_max_connections']),
            'locks_prefix':
            self.config.get('host', '') or self.config.get('ip', ''),
            'timeout':
            CONF.ngs_coordination.acquire_timeout
        }
Пример #2
0
 def __init__(self, device_cfg):
     super(NetmikoSwitch, self).__init__(device_cfg)
     device_type = self.config.get('device_type', '')
     # use part that is after 'netmiko_'
     device_type = device_type.partition('netmiko_')[2]
     if device_type not in netmiko.platforms:
         raise exc.GenericSwitchNetmikoNotSupported(device_type=device_type)
     self.config['device_type'] = device_type