Skip to main content

Rancid Command Wrapper.

Project description

Rancidcmd is a utility tool for network operators. This module is wrapper of RANCID login commands.(like cloing, jlogin …) So if you use this moudle, then you have to install RANCID in some way. Why did I make this module? As everybody knows RANCID is popular as auto login solutions. Of course I want to use RANCID. And I wanted to do using without password of “.cloginrc”. This Rancidcmd can use RANCID login command like a clogin with empty “.clgoinrc”.

https://secure.travis-ci.org/mtoshi/rancidcmd.svg?branch=master https://coveralls.io/repos/mtoshi/rancidcmd/badge.svg?branch=coverall Latest Version

Requirements

  • Python 2.7, 3.3, 3.4, PyPy

Installation

  1. Please install the RANCID in advance.

    For CentOS

    $ yum install rancid

    For Debian, Ubuntu

    $ apt-get install rancid

    For MacOS X(Port)

    $ port install rancid
  2. After RANCID, please install Rancidcmd

    $ pip install rancidcmd
    
    or
    
    $ git clone https://github.com/mtoshi/rancidcmd
    $ cd rancidcmd
    $ sudo python setup.py install
  • Care of “~/.cloginrc” existence is not necessary.

    If executed user doesn’t have “~/.cloginrc”, then Rancidcmd makes empty “~/.cloginrc”.

Using example

Example for cisco(clogin).

>>> from rancidcmd import RancidCmd
>>> rancidcmd = RancidCmd(login='/usr/libexec/rancid/clogin',
...                       user='username',
...                       password='xxxx',
...                       enable_password='xxxx',
...                       timeout=10,
...                       address='192.168.1.1')
>>> rancidcmd.execute("show version")

Example for junos(jlogin).

>>> from rancidcmd import RancidCmd
>>> rancidcmd = RancidCmd(login='/usr/libexec/rancid/jlogin',
...                       user='username',
...                       password='xxxx',
...                       timeout=30,
...                       address='192.168.1.2')
>>> rancidcmd.execute("show version")
  • RancidCmd() needs “login, user, password, enable_password, timeout, address”.

  • “enable_password” is not must for jlogin.

  • “enable_password” default value is None.

  • “timeout” is not must.

  • “timeout” default value is 10(sec).

Output format.

{'std_err': '', 'std_out': ''}

Output sucess sample.

{'std_err': '', 'std_out': '... Copyright (c) 2002-2013, Cisco Systems, Inc. All ...'}

Output error sample. (Not found “clogin”)

{'std_err': '/bin/sh: clogin: command not fond\n', 'std_out': ''}

Please see sample code.

If you want to use another settings(prompt, method, etc), please edit “.cloginrc” same with previus.

See also

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rancidcmd-0.1.5.tar.gz (52.0 kB view hashes)

Uploaded Source

Built Distribution

rancidcmd-0.1.5-py3.4.egg (9.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page