本文整理汇总了Python中mininet.topo.Topo.addNode方法的典型用法代码示例。如果您正苦于以下问题:Python Topo.addNode方法的具体用法?Python Topo.addNode怎么用?Python Topo.addNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.topo.Topo
的用法示例。
在下文中一共展示了Topo.addNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _convert_to_plain_topo
# 需要导入模块: from mininet.topo import Topo [as 别名]
# 或者: from mininet.topo.Topo import addNode [as 别名]
def _convert_to_plain_topo(self, topo):
r = Topo()
for node in topo.nodes():
r.addNode(node,**topo.nodeInfo(node))
for edge in topo.links():
r.addLink(edge[0],edge[1],**topo.linkInfo(edge[0],edge[1]))
return r
示例2: addHost
# 需要导入模块: from mininet.topo import Topo [as 别名]
# 或者: from mininet.topo.Topo import addNode [as 别名]
def addHost(self, name, cls=Host, **opts):
"""Adds a host using the MiniNExT host constructor.
name: host name
cls: host constructor
opts: host options
returns: host name"""
if not opts and self.hopts:
opts = self.hopts
return BaseTopo.addNode(self, name, cls=cls, **opts)
示例3: _convert_to_plain_topo
# 需要导入模块: from mininet.topo import Topo [as 别名]
# 或者: from mininet.topo.Topo import addNode [as 别名]
def _convert_to_plain_topo(self, topo):
"""Convert topo to mininet.topo.Topo instance.
This helper function allows the user to use topologys which are not
direct instances of mininet.topo.Topo in MaxiNet. If the topology was
not converted to a Topo instance the transfer via pyro most likely
fails as the original class might not be available at the pyro remote.
Args:
topo: Instance which fullfills the interface of mininet.topo.Topo.
Returns:
Instance of mininet.topo.Topo,
"""
r = Topo()
for node in topo.nodes():
r.addNode(node, **topo.nodeInfo(node))
for edge in topo.links():
r.addLink(**topo.linkInfo(edge[0], edge[1]))
return r
示例4: Topo
# 需要导入模块: from mininet.topo import Topo [as 别名]
# 或者: from mininet.topo.Topo import addNode [as 别名]
controller
"""
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.node import OVSSwitch , OVSController, Ryu, RemoteController
from mininet.cli import CLI
topo = Topo()
s1 = topo.addSwitch('s1' , cls=OVSSwitch)
s2 = topo.addSwitch('s2' , cls=OVSSwitch)
h1 = topo.addNode('h1')
h2 = topo.addNode('h2')
h3 = topo.addNode('h3')
h4 = topo.addNode('h4')
c1 = RemoteController('c1',port=6633)
topo.addLink(s1 , h1)
topo.addLink(s1 , h2)
topo.addLink(s2 , h3)
topo.addLink(s2 , h4)
topo.addLink(s1 , s2)
net = Mininet(topo=topo, switch=OVSSwitch, build=False)
net.addController(c1)
net.build()