微软正式宣布75亿美元收购GitHub


640?wx_fmt=jpeg

640?wx_fmt=jpeg

Headkarl

IT设备自动化管理工具forward开源项目核心开发者。 

GitHub ID:Headkarl

https://github.com/tecstack/forward


Authors

  • Forward由Headkarl创建,并且由cheung kei-chuen、Leann Mak、Shawn.T等多位用户参与贡献。


  • Forward was created by Wang Zhe(Headkarl) and contributed by many users, such as Zhang Qichuan(cheung kei-chuen), Mai Yi Fan(Leann Mak) and Dai Sheng(Shawn.T), and sincerely thanks each one.


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.


 
 
  1. pyenv virtualenv 2.7.10 forward

  2. pyenv activate forward

  • Pull 拉取当前版本

 
 
  1. git clone https://github.com/tecstack/forward.git

  2. cd forward

  • Dependency 安装依赖包

 
 
  1. pip install -r requirements.txt

  • Setup 安装

 
 
  1. 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.


 
 
  1. from forward import Forward

  2. new = Forward()

  3. new.addTargets(['192.168.113.1-192.168.113.2'], 'n7018', 'username', 'password')

  4. instances = new.getInstances()

  5. cisco1 = instances['192.168.113.1']

  6. cisco2 = instances['192.168.113.2']

  7. result1 = cisco1.execute('show version')

  8. result2 = cisco2.execute('show version')

  9. if result1['status']:

  10.    print '[%s] OS version info: %s' % ('cisco1', result1['content'])

  11. if result2['status']:

  12.    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

  • 初始化 Initialize

  • 预登陆 PreLogin

  • 自定义指令 command

Class

  • Forward目前包含40多种特定型号设备类库,查看详细的类库文档。

  • Forward currently contains more than 40 specific type of device class libraries, here to look at the detailed library documents.

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.


640?wx_fmt=gif
640?wx_fmt=jpegPython中文社区

全球Python中文开发者的

精神部落

640?wx_fmt=jpeg


为促进Python中文开发者的开源项目的发展,Python中文社区全平台将定期报导华人Python开发者开源项目的发展情况,让更多的开发者关注和参与您的开源项目,并且我们将凭借在业界的影响力努力开拓更多资源,为开源项目开发者提供更多支持,欢迎开源项目开发者踊跃报名,也欢迎您推荐优秀的开源项目,请点击阅读原文报名。

640?wx_fmt=gif


Python中文社区作为一个去中心化的全球技术社区,以成为全球20万Python中文开发者的精神部落为愿景,目前覆盖各大主流媒体和协作平台,与阿里、腾讯、百度、微软、亚马逊、开源中国、CSDN等业界知名公司和技术社区建立了广泛的联系,拥有来自十多个国家和地区数万名登记会员,会员来自以公安部、工信部、清华大学、北京大学、北京邮电大学、中国人民银行、中科院、中金、华为、BAT、谷歌、微软等为代表的政府机关、科研单位、金融机构以及海内外知名公司,全平台近20万开发者关注。

640?wx_fmt=jpeg


往期开源项目介绍

Python开源项目介绍:用zmail简单地发邮件

Python开源项目介绍:网站日志分析工具

Python中文社区开源项目计划:ImagePy

Amas:基于大数据平台技术开发的统一监控平台


点击下方阅读原文参与报名或推荐

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值