基于yaml文件生成cisco脚本
gen-cisco的Python项目详细描述
gen-cisco是一个api和cli,可以帮助您创建cisco 使用yaml文件的脚本。此文件为每个协议分组一个部分 包括要在相应的Cisco模板中替换的值。
这些模板的创建是在各种ccna 思科提供的培训课程,使用Packet Tracer,a 网络仿真与可视化工具。因此,一些命令可能 需要在真正的硬件上进行修改。
安装
就这么简单:
pip install gen-cisco
用法
Usage: gen-cisco.py [OPTIONS] Generates Cisco scripts based on YAML files Examples: python gen-cisco.py -i examples/router.yml python gen-cisco.py -i examples/router.yml -o r1.txt python gen-cisco.py -i examples/router.yml -o r1.txt -v python gen-cisco.py -i examples/router.yml -o r1.txt --no-comments -v python gen-cisco.py -i examples/router.yml -o r1.txt --no-comments --no-headers -v python gen-cisco.py -i examples/router.yml -o r1.txt --no-override Options: -i, --src FILENAME The YAML file. -o, --dest TEXT The name of the generated script file. --override / --no-override Deletes the old file if it is overwritten. --comments / --no-comments Deletes comments in the generated script. --headers / --no-headers Deletes headers in the generated script. -v, --verbose Outputs the final script to the console. --version Show the version and exit. --help Show this message and exit.
或者,您可以使用Docker运行此工具:
# Build the image docker build -t gen-cisco . # Run the image docker run -v $(pwd):/app gen-cisco python gen-cisco.py [OPTIONS]
支持的功能
以下是可由脚本配置的功能列表:
basic ➔ basic configuration for routers and switches eigrp ➔ advanced distance-vector routing protocol etherchannel ➔ port link aggregation technology or port-channel architecture used primarily on Cisco switches hsrp ➔ Cisco redundancy protocol for establishing a fault-tolerant default gateway nat ➔ method of remapping one IP address space into another ospf ➔ routing protocol for Internet Protocol networks rip ➔ one of the oldest distance-vector routing protocols stp ➔ network protocol that builds a loop-free logical topology for Ethernet networks ssh ➔ cryptographic network protocol for operating network services securely over an unsecured network
有关按设备排序的完整列表,请访问 wiki。
贡献
在脚本中添加新协议以及支持新设备是 容易的。要做到这一点,首先要看看 CONTRIBUTING 文件。另外,也可以通过打开 问题追踪器里的问题,对我们有很大帮助。
许可证
代码在MIT License下面。