Skip to main content

Library for IBN

Project description

网络自动化运维工具

该工具包含了网络设备一些基础操作,极大的简化了编程难度,对国产设备有着良好的支持。

目前支持的设备如下:

  • 山石防火墙
  • 华为路由交换设备
  • 思科的asa防火墙,路由器

运行环境

[root@local ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 

[root@szzabbixt01 ~]# python
Python 2.7.5 (default, Nov 20 2015, 02:00:19) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2

[root@local ~]# pip show netmiko
Metadata-Version: 1.1
Name: netmiko
Version: 2.0.2

编程示例

ac_info = namedtuple('ac_info', ['username', 'password', 'enable_pass'])
ac_info.username = "username"
ac_info.password = "password"
ac_info.enable_pass = "en_pass"

dev_info = namedtuple('dev_info', ["dev_ip", "dev_name"])
dev_info.dev_ip = "192.168.0.1"

# 这里的 hs_SG6000 指的是所支持的山石防火墙的型号
# 目前支持 huawei_S5720 , asa_5545, srx_550 等等
dev_ob = hs_SG6000(ac_info,dev_info)

# 可以进行账号校验,判断账号是否登录成功且具有config权限
if dev_ob.account_verification():
    print("账号校验成功,具有CONFIG权限")

# 可以配置脚本
cmd_lines = []
cmd_lines.append('address "BCEL_185.22.9.97"')
cmd_lines.append('  ip 185.22.9.97/32')
cmd_lines.append('exit')

dev_ob.execute_script(cmd_lines):

版本记录

1.3.2

  • 优化了山石防火墙的账号校验部分
  • 添加中文的介绍,以后会优先更新中文
  • 添加了一个思科路由器的型号 cisco_C3900,把原本的 asa_5545 变成基类
  • setup 的版本和这个保持同步

ibnsession

Multi-vendor library to control network devices

tool introducition

This tool is for ibn design

Environment

[root@local ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 

[root@szzabbixt01 ~]# python
Python 2.7.5 (default, Nov 20 2015, 02:00:19) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2

[root@local ~]# pip show netmiko
Metadata-Version: 1.1
Name: netmiko
Version: 2.0.2

Dir tree introduction

Update log

0.01 Design this package

0.02 Add hillstone related update

  • add function : generate_access_script(self,basic_info,session_list)
  • add function : execute_access_script(self,access_script_list)

0.1.0 Add SRX related update

  • add function : generate_routing_script(self, route_info_list)
  • add function : get_running_config(self)

1.3 Add new module

  • add huawei.py
  • add cisco.py

1.3.1 update huawei module

  • remove print info
  • update all module , add new parameter:config_mode_tag
account_verification(self, config_mode_tag="config"):

Project details


Download files

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

Source Distribution

ibnsession-1.3.2.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file ibnsession-1.3.2.tar.gz.

File metadata

  • Download URL: ibnsession-1.3.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.8

File hashes

Hashes for ibnsession-1.3.2.tar.gz
Algorithm Hash digest
SHA256 196424d79b4b345e6aaf479354d68819bc5397aed4438f22196bce088870dce4
MD5 747795b07d467905d5b8d2bc79e3e1dc
BLAKE2b-256 b762bcae20fef6cc02df26289067c4de2ed7c14a7c93dcaa1c799ebc67082585

See more details on using hashes here.

Supported by

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