Welcome to rancidcmd’s documentation! — rancidcmd 0.1.8 documentation

# Welcome to rancidcmd’s documentation!

Contents:

RancidCmd.

class `rancidcmd.` `RancidCmd`(**kwargs)

  Class RancidCmd.

  Attributes:

  > login (str): | RANCID login command(clogin, jlogin, etc).
  > user (str): | Login username.
  > password (str): | Login password.
  > address (str): | Host name or ip address.
  > enable_password (str, optional):
  > | Enable password for clogin. Default is None.
  > option(int, optional):
  > | Option example: ‘-d -x “commands.txt”’. Default is None.
  > timeout(int, optional):
  > | Timeout value(seconds). Default is 10 seconds.
  > encoding(str, optional):
  > | Encoding type. Default is ‘utf-8’.

  Using example:

  > - Please see README.

  >     https://github.com/mtoshi/rancidcmd/blob/master/README.rst

  > - Sample code.

  >     https://github.com/mtoshi/rancidcmd/blob/master/samples/sample.py

  static `check_cloginrc`(name='.cloginrc')

    Check rancid settings file.

    Note:

    > If RANCID settings file is not exists, then make empty settings file.

    Args:

    > name (str, optional):
    > | RANCID settings file name. Default is ”.cloginrc”.

    Returns:

    > str: | RANCID settings file path.

  `cmd_exec`(command)

    Login and command execution.

    Args:

    > command (str): | Command for execution.

    Returns:

    > dict: | Example is below.

    > {
    >   ‘std_err’: ‘’, ‘std_out’: ‘’,

    > }

  `decode_bytes`(byte_data)

    Change string with encoding setting.

    Args:

    > byte_data (bytes):
    > | Popen output.

  `execute`(command)

    Command execution.

    Args:

    > command (str): | Example is “show version”.

    Returns:

    > dict: | Example is below.

    > {
    >   ‘std_err’: ‘’, ‘std_out’: ‘’,

    > }

  `generate_cmd`(command)

    Generate command.

    Args:

    > command (str): | Example is “show version”.

    Returns:

    > str: | Return the command string.

    > If there is the “enable_password”.

    >     'xlogin -t 10 -u admin -p password -e enable_password
    >         -c "show version"'

    > If you have not set the “enable_password”.

    >     'xlogin -t 10 -u admin -p password -c "show version"'

  `is_option_x`()

    Check -x option.

    “-c” gets commands from command-line. “-x” gets commnads from file.

    These are for command option and exclusive. If “-x” option is specified, then “-c” command is ignored.

  `show`(command)

    Execute command string check.

    Args:

    > command (str): | Example is “show version”.

    Returns:

    > str: | Return the command string.

  static `touch`(path)

    Make empty file.

    Args:

    > path (str): | File path.

# Indices and tables

- Index
- Module Index
- Search Page