Checks if the device is in configuration mode or not.

        Cisco IOS devices abbreviate the prompt at 20 chars in config mode
508943
def check_config_mode(self, check_string=")#", pattern="#"):
        
        return super(CiscoIosBase, self).check_config_mode(
            check_string=check_string, pattern=pattern
        )
876789
def is_char_device(self):
        
        try:
            return S_ISCHR(self.stat().st_mode)
        except OSError as e:
            if e.errno != ENOENT:
                raise
            # Path doesn't exist or is a broken symlink
            # (see https://bitbucket.org/pitrou/pathlib/issue/12/)
            return False
192780
def config_mode(self, config_command="configure", pattern="#"):
        
        return super(AlcatelSrosSSH, self).config_mode(
            config_command=config_command, pattern=pattern
        )
273853
def autoconf(self):
        
        apcinfo = APCinfo(self._host, self._port, self._user, self._password, 
                          self._monpath, self._ssl)
        return apcinfo is not None
761903
def check_config(config):
    ""
    shortnames = [count['shortname'] for count in config['count']]
    if len(shortnames) != len(set(shortnames)):
        logger.error("error: duplicate `shortname' in count configuration.")
        return False
    return True
7625
private function _checkLayerConfig()
    {
        $errorString = array();
        if ($this->_providerID == '') {
            array_push($errorString, 'LAYER_PROVIDER_ID');
        }

        if ($this->_keyID == '') {
            array_push($errorString, 'LAYER_PRIVATE_KEY_ID');
        }

        if ($this->_privateKey == '') {
            array_push($errorString, 'LAYER_PRIVATE_KEY');
        }

        if (count($errorString) > 0) {
            $joined = implode(',', $errorString);
            trigger_error("$joined  not configured. See README.md", E_USER_ERROR);
        }
    }
1321370
def compare_config(self):
        """"""
        diff = self.device.cu.diff()

        if diff is None:
            return ''
        else:
            return diff.strip()
1107892
def exit_config_mode(self, exit_config="end", pattern="#"):
        """"""
        return super(CiscoBaseConnection, self).exit_config_mode(
            exit_config=exit_config, pattern=pattern
        )
1223565
def _determine_beacon_config(self, current_beacon_config, key):
        '''
        
        '''

        interval = False
        if isinstance(current_beacon_config, dict):
            interval = current_beacon_config.get(key, False)

        return interval
654809
def is_provider_configured(opts, provider, required_keys=(), log_message=True, aliases=()):
    '''
    
    '''
    if ':' in provider:
        alias, driver = provider.split(':')
        if alias not in opts['providers']:
            return False
        if driver not in opts['providers'][alias]:
            return False
        for key in required_keys:
            if opts['providers'][alias][driver].get(key, None) is None:
                if log_message is True:
                    # There's at least one require configuration key which is not
                    # set.
                    log.warning(
                        "The required '%s' configuration setting is missing "
                        "from the '%s' driver, which is configured under the "
                        "'%s' alias.", key, provider, alias
                    )
                return False
        # If we reached this far, there's a properly configured provider.
        # Return it!
        return opts['providers'][alias][driver]

    for alias, drivers in six.iteritems(opts['providers']):
        for driver, provider_details in six.iteritems(drivers):
            if driver != provider and driver not in aliases:
                continue

            # If we reached this far, we have a matching provider, let's see if
            # all required configuration keys are present and not None.
            skip_provider = False
            for key in required_keys:
                if provider_details.get(key, None) is None:
                    if log_message is True:
                        # This provider does not include all necessary keys,
                        # continue to next one.
                        log.warning(
                            "The required '%s' configuration setting is "
                            "missing from the '%s' driver, which is configured "
                            "under the '%s' alias.", key, provider, alias
                        )
                    skip_provider = True
                    break

            if skip_provider:
                continue

            # If we reached this far, the provider included all required keys
            return provider_details

    # If we reached this point, the provider is not configured.
    return False
1017514
def checkconfig():
    '''
    
    '''
    cmd = ['lxc-checkconfig']
    return subprocess.check_output(cmd).replace('[1;32m', '').replace('[1;33m', '').replace('[0;39m', '').replace('[1;32m', '').replace(' ', '').split('\n')
343814
def validate(config):
    '''
    
    '''

    # Configuration for load beacon should be a list of dicts
    if not isinstance(config, list):
        return False, ('Configuration for load beacon must be a list.')
    else:
        _config = {}
        list(map(_config.update, config))

        if 'emitatstartup' in _config:
            if not isinstance(_config['emitatstartup'], bool):
                return False, ('Configuration for load beacon option '
                               'emitatstartup must be a boolean.')

        if 'onchangeonly' in _config:
            if not isinstance(_config['onchangeonly'], bool):
                return False, ('Configuration for load beacon option '
                               'onchangeonly must be a boolean.')

        if 'averages' not in _config:
            return False, ('Averages configuration is required'
                           ' for load beacon.')
        else:

            if not any(j in ['1m', '5m', '15m'] for j
                       in _config.get('averages', {})):
                return False, ('Averages configuration for load beacon '
                               'must contain 1m, 5m or 15m items.')

            for item in ['1m', '5m', '15m']:
                if not isinstance(_config['averages'][item], list):
                    return False, ('Averages configuration for load beacon: '
                                   '1m, 5m and 15m items must be '
                                   'a list of two items.')
                else:
                    if len(_config['averages'][item]) != 2:
                        return False, ('Configuration for load beacon: '
                                       '1m, 5m and 15m items must be '
                                       'a list of two items.')

    return True, 'Valid beacon configuration'
1140545
def _verify_config(self):
        '''
        
        '''
        if not self.config_dict:
            self._raise_config_exception('No config found')
        # Check for device conifg, if there isn't anything then just log, do not raise an exception
        for dev_os, dev_config in self.config_dict.items():
            if not dev_config:
                log.warning('No config found for %s', dev_os)
                continue
            # Compare the valid opts with the conifg
            self._verify_config_dict(CONFIG.VALID_CONFIG, dev_config, dev_os)
        log.debug('Read the config without error')
342950
def _check(self):
        
        if conf.contribs['LLDP'].strict_mode() and self._length != 2:
            raise LLDPInvalidLengthField('length must be 2 - got '
                                         '{}'.format(self._length))
631317
def check_config_mode(self, check_string="config", pattern="#"):
        
        return super(AlcatelSrosSSH, self).check_config_mode(
            check_string=check_string, pattern=pattern
        )
448029
def write_config(ip, mac, single, double, long, touch):
    """"""
    click.echo("Write configuration to device %s" % ip)
    data = {
        'single': single,
        'double': double,
        'long': long,
        'touch': touch,
    }
    request = requests.post(
        'http://{}/{}/{}/'.format(ip, URI, mac), data=data, timeout=TIMEOUT)

    if request.status_code == 200:
        click.echo("Configuration of %s set" % mac)
1105367
def graceful_restart=(enable)
      if platform == :ios_xr && @vrf != 'default'
        fail Cisco::UnsupportedError.new('bgp', 'graceful_restart', 'set',
                                         'graceful_restart is not ' \
                                         'configurable ' \
                                         'on a per-VRF basis on IOS XR')
      end
      @set_args[:state] = (enable ? '' : 'no')
      config_set('bgp', 'graceful_restart', @set_args)
      set_args_keys_default
    end