mininet simulate OVS with ssl session
2014-07-07 11:15
585 查看
##################################################################################
#这个脚本是建立2个swtich和host,并且通过ssl,连接到你的外部controller
#!/usr/bin/python
# this script will add 2 liner swtich with SSH
from mininet.net import Mininet
from mininet.node import Controller,RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel,info
def emptyNet():
net = Mininet( controller=RemoteController )
net.addController( 'c0' )
h1 = net.addHost( 'h1' )
h2 = net.addHost( 'h2' )
s1 = net.addSwitch( 's1' )
s2 = net.addSwitch( 's2' )
net.addLink( h1, s1 )
net.addLink( h2, s2 )
net.start()
s1.cmd('ovs-vsctl set-controller s1 ssl:9.111.85.39:6633')
s2.cmd('ovs-vsctl set-controller s2 ssl:9.111.85.39:6633')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
emptyNet()
#######################################################################################################################
#这个脚本是使用mininet模拟很多个OVS通过SSL连接到你的外部controller
#这个脚本主要用于测试controller的performance测试
#!/usr/bin/python
# author:Spark.liu@cn.ibm.com , date:2014/6/10
# this script will add a linear a topolgoy with your set switch number,
# the switch will connect to remote controller your set by SSL session , so before running it ,pls add your certificaion to local OVS and remote controller
# for running this script ,your system should installed Mininet and OVS
from mininet.net import Mininet
from mininet.node import Controller,RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel,info
# change following parameter to simulate swtich number
switch_number = 10
# change following parameter with your remote controller IP
Controller_ip = "9.111.85.36"
def emptyNet():
net = Mininet( controller=RemoteController )
count = 1
s_list = []
while ( count < switch_number+1 ):
host_str = 'h%d' %(count)
switch_str = 's%d' %(count)
host = net.addHost( host_str )
switch = net.addSwitch( switch_str )
s_list.append(switch)
net.addLink( host, switch)
count += 1
for i,s in enumerate(s_list):
if i < switch_number-1 :
net.addLink(s_list[i],s_list[i+1])
net.start()
# ssh into controller from each swtich instance
for i,s in enumerate(s_list):
# s.cmd("ovs-vsctl set-controller s%s ssl:%s:6633" % (i+1,Controller_ip))
s.cmd("ovs-vsctl set-controller s%s other-config:datapath_id=11100000000%s ssl:%s:6633" % (i+1,i+1,Controller_ip))
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
emptyNet()
##################################################################################################################
#这个脚本是建立2个swtich和host,并且通过ssl,连接到你的外部controller
#!/usr/bin/python
# this script will add 2 liner swtich with SSH
from mininet.net import Mininet
from mininet.node import Controller,RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel,info
def emptyNet():
net = Mininet( controller=RemoteController )
net.addController( 'c0' )
h1 = net.addHost( 'h1' )
h2 = net.addHost( 'h2' )
s1 = net.addSwitch( 's1' )
s2 = net.addSwitch( 's2' )
net.addLink( h1, s1 )
net.addLink( h2, s2 )
net.start()
s1.cmd('ovs-vsctl set-controller s1 ssl:9.111.85.39:6633')
s2.cmd('ovs-vsctl set-controller s2 ssl:9.111.85.39:6633')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
emptyNet()
#######################################################################################################################
#这个脚本是使用mininet模拟很多个OVS通过SSL连接到你的外部controller
#这个脚本主要用于测试controller的performance测试
#!/usr/bin/python
# author:Spark.liu@cn.ibm.com , date:2014/6/10
# this script will add a linear a topolgoy with your set switch number,
# the switch will connect to remote controller your set by SSL session , so before running it ,pls add your certificaion to local OVS and remote controller
# for running this script ,your system should installed Mininet and OVS
from mininet.net import Mininet
from mininet.node import Controller,RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel,info
# change following parameter to simulate swtich number
switch_number = 10
# change following parameter with your remote controller IP
Controller_ip = "9.111.85.36"
def emptyNet():
net = Mininet( controller=RemoteController )
count = 1
s_list = []
while ( count < switch_number+1 ):
host_str = 'h%d' %(count)
switch_str = 's%d' %(count)
host = net.addHost( host_str )
switch = net.addSwitch( switch_str )
s_list.append(switch)
net.addLink( host, switch)
count += 1
for i,s in enumerate(s_list):
if i < switch_number-1 :
net.addLink(s_list[i],s_list[i+1])
net.start()
# ssh into controller from each swtich instance
for i,s in enumerate(s_list):
# s.cmd("ovs-vsctl set-controller s%s ssl:%s:6633" % (i+1,Controller_ip))
s.cmd("ovs-vsctl set-controller s%s other-config:datapath_id=11100000000%s ssl:%s:6633" % (i+1,i+1,Controller_ip))
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
emptyNet()
##################################################################################################################
相关文章推荐
- Android之使用Http协议实现文件上传功能
- Python动态类型的学习---引用的理解
- 垃圾邮件过滤器 python简单实现
- install and upgrade scrapy
- Scrapy的架构介绍
- Centos6 编译安装Python
- 使用Python生成Excel格式的图片
- 让Python文件也可以当bat文件运行
- [Python]推算数独
- Python中zip()函数用法举例
- Python中map()函数浅析
- Python在CAM软件Genesis2000中的应用
- 使用Shiboken为C++和Qt库创建Python绑定
- FREEBASIC 编译可被python调用的dll函数示例
- 通晓网络测试常用命令
- Python使用RethinkDB总结
- Python,Flex 2和Aptana[js开放工具]
- 国外开发者谈为何放弃PHP而改用Python