Code Monkey home page Code Monkey logo

forward's Introduction

Forward

Build Status Download Status


Introduce 介绍

  • Forward是一个python模块,提供与目标设备之间的通道封装,基于指令行(Command Lines)的方式实现多数功能的封装,供开发者快速简便调用,屏蔽不同设备上指令差异。
  • 建议使用Forward用于多种(厂家、型号)网络设备的自动化管理场景,可以快速构建出运维场景脚本。
  • Forward is a python module, which provides channel encapsulation between target devices, and realizes most functions encapsulation based on Command Lines. It allows developers to invoke quickly and simply, and screen instructions on different devices.
  • We recommend the use of Forward for a variety of (manufacturer, model) network equipment automation management scene, can quickly build the operation and maintenance scenario script.

Installation

  • Building virtual environment (optional) 构建虚拟环境 (可选)

    • 开发者用户推荐,使用pyenv和virtualenv构建纯净的python环境,基于python版本2.7.10
    • We recommend that developer users use pyenv and virtualenv to build a pure Python environment which is based on Python version 2.7.10.
    pyenv virtualenv 2.7.10 forward
    pyenv activate forward
  • Pull 拉取当前版本

    git clone https://github.com/tecstack/forward.git
    cd forward
  • Dependency 安装依赖包

    pip install -r requirements.txt
  • Setup 安装

    python setup.py install

Getting Started

  • 下方代码段展示了一个简易的forward场景实现,批量连接到两台设备(思科Nexus7018),执行指令并获取结果。

  • The code section below shows a simple forward scenario implementation that is batch connected to two devices (CISCO Nexus7018), executes instructions and gets the results.

    from forward import Forward
    
    new = Forward()
    new.addTargets(['192.168.113.1-192.168.113.2'], 'n7018', 'username', 'password')
    instances = new.getInstances()
    
    cisco1 = instances['192.168.113.1']
    cisco2 = instances['192.168.113.2']
    
    result1 = cisco1.execute('show version')
    result2 = cisco2.execute('show version')
    
    if result1['status']:
        print '[%s] OS version info: %s' % ('cisco1', result1['content'])
    if result2['status']:
        print '[%s] OS version info: %s' % ('cisco2', result2['content'])
  • 上述代码段中出现的'cisco1'和'cisco2'就是Forward设备类实例(N7018),不同设备类实例包含的方法可能不同,具体请查阅类库文档

  • The 'cisco1' and 'cisco2' appearing in the above code segment are Forward device class instances (N7018). Different device class instances contain different methods. Please consult the detailed library documents.


Advanced Usage


Class

  • Forward目前包含40多种特定型号设备类库,查看详细的类库文档
  • Forward currently contains more than 40 specific type of device class libraries, here to look at the detailed library documents.

Authors


License

  • GNU General Public License v3.0
  • See COPYING to see the full text.

Branch Info

  • RC,Releases和Stables分支都以版本号+各种鱼类命名。
  • devel分支对应正在开发的分支。
  • alpha分支对应一个早期的内部测试版本。
  • RC,Releases and Stables are named after the version number plus any kind of fish.
  • The devel branch corresponds to the release actively under development.
  • The alpha branch corresponds to a early release which is used for In-House test.

Version Info

  • 版本记录中查看所有历史记录,开源前的版本更新仅可以看到记录。
  • Looking at all the history records in Version Info, the pre - source version updates can only see the records.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.