本文整理匯總了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