可插拔交换机/路由器命令行模拟器
fake-switches的Python项目详细描述
[![构建状态](https://travis-ci.org/internap/fake-switches.svg?branch=master)(https://travis ci.org/internap/fake switches)
[![PYPI版本](https://badge.fury.io/py/fake switches.svg)](http://badge.fury.io/py/fake switches)
fake switches
=
![命令行演示](demo cli.gif)
fake switches是一个可插入的交换机/路由器命令行模拟器。这意味着
有助于对网络设备运行集成测试,而无需承担在实验室中安装设备的负担。这有助于测试与
设备及其所有层的通信,以便进行更可靠的高级测试。由于
它是供其他系统使用而不是供人使用,因此对
不完整命令和防失败的错误处理大部分被忽略,只显示了相关的错误。
可以很容易地扩展库,以对假开关的某些更改作出反应,并控制一组实际的工具,使环境的行为类似于由开关驱动的实际工具。例如,您可以将自己连接到VLAN创建,并使用vconfig在
计算机上创建实际VLAN以进行某些网络测试。
任何供应商都不支持此库,它是由
逆向工程网络设备构建的。
<为了测试什么以及如何测试,已按需要添加了命令支持。因此,请查看可以使用哪些命令及其支持的
行为,请参见每个模型的测试部分。
(tests/cisco/test_-cisco_-switch_-protocol.py)
p rotocol_test.py)
dell ssh和telnet[tests/dell/](tests/dell/)
创建的状态端口名
6eec86849561 internap/fake switches"/bin/sh-c'fake swi"35秒前增加了13秒0.0.0:32776->;22/tcp borning\u thompson
$ssh 127.0.0.1-p 32776-l root
root@127.0.0.1's密码:根
我的交换机>;启用
密码:按<;返回>;
我的交换机显示运行
生成配置…
当前配置:164字节
版本12.1
!
主机名my_switch
!< BR>!
VLAN 1
!
接口快速以太网0/1
!
接口快速以太网0/2
!
接口快速以太网0/3
!
接口快速以太网0/4
!
结束
my_switch
````
|默认值为
<
<<
<
<124<124
-<124
<
<124
<-------<0.0.0.0.0.0.0
<
building image from source
——电休克因子使用
自定义类,这些类可以对资源更改执行操作。例如:
`` python
来自twisted.internet导入reactor
来自fake_switches.switch_配置导入switch configuration,port
来自fake_switches.transports.ssh_服务导入switch service
来自fake_switches.cisco.cisco_core导入ciscoswitchcore
c类myswitchconfiguration(switchconfiguration):
def初始(self,*args,**kwargs):
super(myswitchconfiguration,self)。\uu初始(objects)覆盖={"port":myport},*args,**kwargs)
class myport(port):
def初始(self,name):
self.n=none
super(myport,self)。\uu init(name)
@property
def access_vlan(self):
return self.\u access_vlan
@access_vlan.setter
def access_vlan(self,value):
if self.\u access_vlan!=值:
self.\u access虚拟局域网=值
打印"这可能会将虚拟局域网添加到eth0"
打开("127.0.0.1","我的交换机",端口=[MyPort("FastEthernet0/1")))
ssh_service.hook_to_reactor(reactor)
reactor.run()
````
rd:
配置终端
VLAN 1000
接口快速以太网0/1
交换机端口访问VLAN 1000
`````
您的程序应该说"这可以将VLAN添加到eth0"或执行任何您希望它执行的操作:)
r/>r/>r/>r/>r/>br/>`` shell
pip安装假交换机
r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r<
r/>r/>r<
r/>r/>一支持g。
fake switches--help
用法:fake switches[-h][--model model][--hostname hostname]
[--username username][--password password]
[--listen host listen_host][--listen port listen_port]
fake-s开关模拟器启动程序
可选参数:
-h,--帮助显示此帮助消息并退出
--模型开关模型,允许的值为
juniper_qfx_copper_generic,cisco_2960_24tt_l,
dELL_generic,dell10g_generic,juniper_generic,
Cisco_2960_48tt_l,Cisco_generic,Brocade_generic
(默认值:Cisco_generic)
--主机名交换机主机名(默认值:交换机)
--用户名交换机用户名(默认:根)
--密码密码开关密码(默认:根)
--侦听主机侦听主机
侦听主机(默认:0.0.0)
--侦听端口侦听端口
侦听端口(默认:2222)
交换机型号在编写本文档时,提供以下型号:
*brocade_generic
*cisco_generic
*cisco_2960_24tt_l
*cisco_2960_48tt_l
*dell_generic
*dell10g_generic
*juniper_generic
*juniper_qfx_copper_generic
使用--help标志查找可用的模型。
generic模型主要用于测试目的。它们的端口通常少于一个合适的交换机
型号,但在其他方面表现相同。一旦"核心"可用,就可以非常容易地添加更具体的型号。发送请求:)
/>
请随意提出问题并发送一些请求,
我们将很高兴看到它们!
[![PYPI版本](https://badge.fury.io/py/fake switches.svg)](http://badge.fury.io/py/fake switches)
fake switches
=
![命令行演示](demo cli.gif)
fake switches是一个可插入的交换机/路由器命令行模拟器。这意味着
有助于对网络设备运行集成测试,而无需承担在实验室中安装设备的负担。这有助于测试与
设备及其所有层的通信,以便进行更可靠的高级测试。由于
它是供其他系统使用而不是供人使用,因此对
不完整命令和防失败的错误处理大部分被忽略,只显示了相关的错误。
可以很容易地扩展库,以对假开关的某些更改作出反应,并控制一组实际的工具,使环境的行为类似于由开关驱动的实际工具。例如,您可以将自己连接到VLAN创建,并使用vconfig在
计算机上创建实际VLAN以进行某些网络测试。
任何供应商都不支持此库,它是由
逆向工程网络设备构建的。
<为了测试什么以及如何测试,已按需要添加了命令支持。因此,请查看可以使用哪些命令及其支持的
行为,请参见每个模型的测试部分。
(tests/cisco/test_-cisco_-switch_-protocol.py)
p rotocol_test.py)
dell ssh和telnet[tests/dell/](tests/dell/)
创建的状态端口名
6eec86849561 internap/fake switches"/bin/sh-c'fake swi"35秒前增加了13秒0.0.0:32776->;22/tcp borning\u thompson
$ssh 127.0.0.1-p 32776-l root
root@127.0.0.1's密码:根
我的交换机>;启用
密码:按<;返回>;
我的交换机显示运行
生成配置…
当前配置:164字节
版本12.1
!
主机名my_switch
!< BR>!
VLAN 1
!
接口快速以太网0/1
!
接口快速以太网0/2
!
接口快速以太网0/3
!
接口快速以太网0/4
!
结束
my_switch
````
|默认值为
<
<<
<
<124<124
-<124
<
<124
<-------<0.0.0.0.0.0.0
<
building image from source
——电休克因子使用
自定义类,这些类可以对资源更改执行操作。例如:
`` python
来自twisted.internet导入reactor
来自fake_switches.switch_配置导入switch configuration,port
来自fake_switches.transports.ssh_服务导入switch service
来自fake_switches.cisco.cisco_core导入ciscoswitchcore
c类myswitchconfiguration(switchconfiguration):
def初始(self,*args,**kwargs):
super(myswitchconfiguration,self)。\uu初始(objects)覆盖={"port":myport},*args,**kwargs)
class myport(port):
def初始(self,name):
self.n=none
super(myport,self)。\uu init(name)
@property
def access_vlan(self):
return self.\u access_vlan
@access_vlan.setter
def access_vlan(self,value):
if self.\u access_vlan!=值:
self.\u access虚拟局域网=值
打印"这可能会将虚拟局域网添加到eth0"
打开("127.0.0.1","我的交换机",端口=[MyPort("FastEthernet0/1")))
ssh_service.hook_to_reactor(reactor)
reactor.run()
````
rd:
配置终端
VLAN 1000
接口快速以太网0/1
交换机端口访问VLAN 1000
`````
您的程序应该说"这可以将VLAN添加到eth0"或执行任何您希望它执行的操作:)
r/>r/>r/>r/>r/>br/>`` shell
pip安装假交换机
r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r/>r<
r/>r/>r<
r/>r/>一支持g。
fake switches--help
用法:fake switches[-h][--model model][--hostname hostname]
[--username username][--password password]
[--listen host listen_host][--listen port listen_port]
fake-s开关模拟器启动程序
可选参数:
-h,--帮助显示此帮助消息并退出
--模型开关模型,允许的值为
juniper_qfx_copper_generic,cisco_2960_24tt_l,
dELL_generic,dell10g_generic,juniper_generic,
Cisco_2960_48tt_l,Cisco_generic,Brocade_generic
(默认值:Cisco_generic)
--主机名交换机主机名(默认值:交换机)
--用户名交换机用户名(默认:根)
--密码密码开关密码(默认:根)
--侦听主机侦听主机
侦听主机(默认:0.0.0)
--侦听端口侦听端口
侦听端口(默认:2222)
交换机型号在编写本文档时,提供以下型号:
*brocade_generic
*cisco_generic
*cisco_2960_24tt_l
*cisco_2960_48tt_l
*dell_generic
*dell10g_generic
*juniper_generic
*juniper_qfx_copper_generic
使用--help标志查找可用的模型。
generic模型主要用于测试目的。它们的端口通常少于一个合适的交换机
型号,但在其他方面表现相同。一旦"核心"可用,就可以非常容易地添加更具体的型号。发送请求:)
/>
请随意提出问题并发送一些请求,
我们将很高兴看到它们!