当前位置: 首页>>代码示例>>Python>>正文


Python Topo.addNode方法代码示例

本文整理汇总了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
开发者ID:lianjiecao,项目名称:mininet-hd,代码行数:9,代码来源:metisPartitioner1.py

示例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)
开发者ID:USC-NSL,项目名称:miniNExT,代码行数:11,代码来源:topo.py

示例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
开发者ID:CN-UPB,项目名称:MaxiNet,代码行数:22,代码来源:partitioner.py

示例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()
开发者ID:sixleaveakkm,项目名称:mininet-pi,代码行数:33,代码来源:2s-4h-1c.py


注:本文中的mininet.topo.Topo.addNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。