本文整理汇总了Python中mininet.node.OVSKernelSwitch方法的典型用法代码示例。如果您正苦于以下问题:Python node.OVSKernelSwitch方法的具体用法?Python node.OVSKernelSwitch怎么用?Python node.OVSKernelSwitch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.node
的用法示例。
在下文中一共展示了node.OVSKernelSwitch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mininet import node [as 别名]
# 或者: from mininet.node import OVSKernelSwitch [as 别名]
def __init__(self):
"Create Fat tree Topology"
Topo.__init__(self)
#Add hosts
h7 = self.addHost('h7', cls=Host, ip='10.0.0.7', defaultRoute=None)
h8 = self.addHost('h8', cls=Host, ip='10.0.0.8', defaultRoute=None)
h1 = self.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
h2 = self.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h4 = self.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
h3 = self.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
h5 = self.addHost('h5', cls=Host, ip='10.0.0.5', defaultRoute=None)
h6 = self.addHost('h6', cls=Host, ip='10.0.0.6', defaultRoute=None)
#Add switches
s10 = self.addSwitch('s10', cls=OVSKernelSwitch)
s3 = self.addSwitch('s3', cls=OVSKernelSwitch)
s17 = self.addSwitch('s17', cls=OVSKernelSwitch)
s4 = self.addSwitch('s4', cls=OVSKernelSwitch)
s18 = self.addSwitch('s18', cls=OVSKernelSwitch)
s1 = self.addSwitch('s1', cls=OVSKernelSwitch)
s11 = self.addSwitch('s11', cls=OVSKernelSwitch)
s21 = self.addSwitch('s21', cls=OVSKernelSwitch)
s22 = self.addSwitch('s22', cls=OVSKernelSwitch)
s2 = self.addSwitch('s2', cls=OVSKernelSwitch)
#Add links
self.addLink(h1, s1)
self.addLink(h2, s1)
self.addLink(h3, s2)
self.addLink(h4, s2)
self.addLink(h5, s3)
self.addLink(h6, s3)
self.addLink(h7, s4)
self.addLink(h8, s4)
self.addLink(s1, s21)
self.addLink(s21, s2)
self.addLink(s1, s10)
self.addLink(s2, s10)
self.addLink(s3, s11)
self.addLink(s4, s22)
self.addLink(s11, s4)
self.addLink(s3, s22)
self.addLink(s21, s17)
self.addLink(s11, s17)
self.addLink(s10, s18)
self.addLink(s22, s18)
示例2: myNetwork
# 需要导入模块: from mininet import node [as 别名]
# 或者: from mininet.node import OVSKernelSwitch [as 别名]
def myNetwork():
net = Mininet( topo=None,
build=False,
ipBase='10.0.0.0/8')
info( '*** Adding controller\n' )
c0=net.addController(name='c0',
controller=RemoteController,
ip='127.0.0.1',
protocol='tcp',
port=6653)
info( '*** Add switches\n')
s2 = net.addSwitch('s2', cls=OVSKernelSwitch)
s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
s5 = net.addSwitch('s5', cls=OVSKernelSwitch, failMode='standalone')
info( '*** Add hosts\n')
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
info( '*** Add links\n')
s1s2 = {'bw':400,'loss':0}
net.addLink(s1, s2, cls=TCLink , **s1s2)
s2h1 = {'bw':1000,'loss':10,'max_queue_size':10,'speedup':40}
net.addLink(s2, h1, cls=TCLink , **s2h1)
s2h2 = {'bw':120,'loss':0}
net.addLink(s2, h2, cls=TCLink , **s2h2)
s2h3 = {'bw':400,'loss':20}
net.addLink(s2, h3, cls=TCLink , **s2h3)
s1s5 = {'bw':200,'delay':'12','loss':10}
net.addLink(s1, s5, cls=TCLink , **s1s5)
s5h4 = {'bw':100,'loss':50}
net.addLink(s5, h4, cls=TCLink , **s5h4)
info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info( '*** Starting switches\n')
net.get('s2').start([c0])
net.get('s1').start([c0])
net.get('s5').start([])
info( '*** Post configure switches and hosts\n')
CLI(net)
net.stop()
开发者ID:PacktPublishing,项目名称:Python-Network-Programming-Cookbook-Second-Edition,代码行数:55,代码来源:10_3_sdn_onos.py
示例3: myNetwork
# 需要导入模块: from mininet import node [as 别名]
# 或者: from mininet.node import OVSKernelSwitch [as 别名]
def myNetwork():
net = Mininet( topo=None,
build=False,
ipBase='10.0.0.0/8')
info( '*** Adding controller\n' )
c0=net.addController(name='c0',
controller=RemoteController,
ip='127.0.0.1',
protocol='tcp',
port=6653)
info( '*** Add switches\n')
s2 = net.addSwitch('s2', cls=OVSKernelSwitch)
s1 = net.addSwitch('s1', cls=IVSSwitch)
info( '*** Add hosts\n')
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
info( '*** Add links\n')
s1s2 = {'bw':400,'loss':0}
net.addLink(s1, s2, cls=TCLink , **s1s2)
s2h1 = {'bw':1000,'loss':10,'max_queue_size':10,'speedup':40}
net.addLink(s2, h1, cls=TCLink , **s2h1)
s2h2 = {'bw':120,'loss':0}
net.addLink(s2, h2, cls=TCLink , **s2h2)
s2h3 = {'bw':400,'loss':20}
net.addLink(s2, h3, cls=TCLink , **s2h3)
info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info( '*** Starting switches\n')
net.get('s2').start([c0])
net.get('s1').start([c0])
info( '*** Post configure switches and hosts\n')
CLI(net)
net.stop()
开发者ID:PacktPublishing,项目名称:Python-Network-Programming-Cookbook-Second-Edition,代码行数:48,代码来源:10_4_sdn_floodlight.py