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


Python Mininet.run方法代码示例

本文整理汇总了Python中mininet.net.Mininet.run方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.run方法的具体用法?Python Mininet.run怎么用?Python Mininet.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mininet.net.Mininet的用法示例。


在下文中一共展示了Mininet.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testNet

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
def testNet():
	net = Mininet(topo = LobaTopo(), build = False, switch = UserSwitch)
    
	# Add my remote controller
	info('*** Adding controller\n')
	net.addController('c0', RemoteController, ip = '10.37.129.2', port = 8888)
	info('c0\n')

	net.run(CLI, net)
开发者ID:ankur8931,项目名称:lobafx-python,代码行数:11,代码来源:test-hl-net.py

示例2: testLinkBandwidth

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
    def testLinkBandwidth( self ):
        "Verify that link bandwidths are accurate within a bound."
        if self.switchClass is UserSwitch:
            self.skipTest( 'UserSwitch has very poor performance -'
                           ' skipping for now' )
        BW = 5  # Mbps
        BW_TOLERANCE = 0.8  # BW fraction below which test should fail
        # Verify ability to create limited-link topo first;
        lopts = { 'bw': BW, 'use_htb': True }
        # Also verify correctness of limit limitng within a bound.
        mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ),
                      link=TCLink, switch=self.switchClass,
                      waitConnected=True )
        bw_strs = mn.run( mn.iperf, fmt='m' )
        loptsStr = ', '.join( '%s: %s' % ( opt, value )
                              for opt, value in lopts.items() )
        msg = ( '\nTesting link bandwidth limited to %d Mbps per link\n'
                'iperf results[ client, server ]: %s\n'
                'Topo = SingleSwitchTopo, %s hosts\n'
                'Link = TCLink\n'
                'lopts = %s\n'
                'host = default\n'
                'switch = %s\n'
                % ( BW, bw_strs, N, loptsStr, self.switchClass ) )

        # On the client side, iperf doesn't wait for ACKs - it simply
        # reports how long it took to fill up the TCP send buffer.
        # As long as the kernel doesn't wait a long time before
        # delivering bytes to the iperf server, its reported data rate
        # should be close to the actual receive rate.
        serverRate, _clientRate = bw_strs
        bw = float( serverRate.split(' ')[0] )
        self.assertWithinTolerance( bw, BW, BW_TOLERANCE, msg )
开发者ID:1514louluo,项目名称:mininet,代码行数:35,代码来源:test_hifi.py

示例3: runOptionsTopoTest

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def runOptionsTopoTest( self, n, hopts=None, lopts=None ):
     "Generic topology-with-options test runner."
     mn = Mininet( topo=SingleSwitchOptionsTopo( n=n, hopts=hopts,
                                                 lopts=lopts ),
                   host=CPULimitedHost, link=TCLink, switch=self.switchClass )
     dropped = mn.run( mn.ping )
     self.assertEqual( dropped, 0 )
开发者ID:mukurogawa,项目名称:mininet,代码行数:9,代码来源:test_hifi.py

示例4: testLinkBandwidth

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
    def testLinkBandwidth( self ):
        "Verify that link bandwidths are accurate within a bound."
        if self.switchClass is UserSwitch:
            self.skipTest ( 'UserSwitch has very poor performance, so skip for now' )
        BW = 5  # Mbps
        BW_TOLERANCE = 0.8  # BW fraction below which test should fail
        # Verify ability to create limited-link topo first;
        lopts = { 'bw': BW, 'use_htb': True }
        # Also verify correctness of limit limitng within a bound.
        mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ),
                      link=TCLink, switch=self.switchClass,
                      waitConnected=True )
        bw_strs = mn.run( mn.iperf, format='m' )
        loptsStr = ', '.join( '%s: %s' % ( opt, value )
                              for opt, value in lopts.items() )
        msg = ( '\nTesting link bandwidth limited to %d Mbps per link\n'
                'iperf results[ client, server ]: %s\n'
                'Topo = SingleSwitchTopo, %s hosts\n'
                'Link = TCLink\n'
                'lopts = %s\n'
                'host = default\n'
                'switch = %s\n'
                % ( BW, bw_strs, N, loptsStr, self.switchClass ) )

        for bw_str in bw_strs:
            bw = float( bw_str.split(' ')[0] )
            self.assertWithinTolerance( bw, BW, BW_TOLERANCE, msg )
开发者ID:EricEllett,项目名称:mininet,代码行数:29,代码来源:test_hifi.py

示例5: testLinear5

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testLinear5( self ):
     "Ping test with both datapaths on a 5-switch topology"
     init()
     for switch in SWITCHES.values():
         controllerParams = ControllerParams( '10.0.0.0', 8 )
         mn = Mininet( LinearTopo( k=5 ), switch, Host, Controller,
                      controllerParams )
         dropped = mn.run( mn.ping )
         self.assertEqual( dropped, 0 )
开发者ID:09zwcbupt,项目名称:mininet,代码行数:11,代码来源:test_nets.py

示例6: testMinimal

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testMinimal( self ):
     "Ping test with both datapaths on minimal topology"
     init()
     for switch in SWITCHES.values():
         controllerParams = ControllerParams( '10.0.0.0', 8 )
         mn = Mininet( SingleSwitchTopo(), switch, Host, Controller,
                      controllerParams )
         dropped = mn.run( mn.ping )
         self.assertEqual( dropped, 0 )
开发者ID:09zwcbupt,项目名称:mininet,代码行数:11,代码来源:test_nets.py

示例7: testLinkBandwidth

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testLinkBandwidth(self):
     "Verify that link bandwidths are accurate within a bound."
     BW = 5  # Mbps
     BW_TOLERANCE = 0.8  # BW fraction below which test should fail
     # Verify ability to create limited-link topo first;
     lopts = {"bw": BW, "use_htb": True}
     # Also verify correctness of limit limitng within a bound.
     mn = Mininet(SingleSwitchOptionsTopo(n=N, lopts=lopts), link=TCLink)
     bw_strs = mn.run(mn.iperf)
     for bw_str in bw_strs:
         bw = float(bw_str.split(" ")[0])
         self.assertWithinTolerance(bw, BW, BW_TOLERANCE)
开发者ID:RimHaw,项目名称:mn-ccnx,代码行数:14,代码来源:test_hifi.py

示例8: testLinkBandwidth

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testLinkBandwidth( self ):
     "Verify that link bandwidths are accurate within a bound."
     if self.switchClass is UserSwitch:
         self.skipTest ( 'UserSwitch has very poor performance, so skip for now' )
     BW = 5  # Mbps
     BW_TOLERANCE = 0.8  # BW fraction below which test should fail
     # Verify ability to create limited-link topo first;
     lopts = { 'bw': BW, 'use_htb': True }
     # Also verify correctness of limit limitng within a bound.
     mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ),
                   link=TCLink, switch=self.switchClass,
                   waitConnected=True )
     bw_strs = mn.run( mn.iperf, format='m' )
     for bw_str in bw_strs:
         bw = float( bw_str.split(' ')[0] )
         self.assertWithinTolerance( bw, BW, BW_TOLERANCE )
开发者ID:rr2vicky,项目名称:Mininet1,代码行数:18,代码来源:test_hifi.py

示例9: testLinkDelay

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testLinkDelay(self):
     "Verify that link delays are accurate within a bound."
     DELAY_MS = 15
     DELAY_TOLERANCE = 0.8  # Delay fraction below which test should fail
     lopts = {"delay": "%sms" % DELAY_MS, "use_htb": True}
     mn = Mininet(SingleSwitchOptionsTopo(n=N, lopts=lopts), link=TCLink)
     ping_delays = mn.run(mn.pingFull)
     test_outputs = ping_delays[0]
     # Ignore unused variables below
     # pylint: disable-msg=W0612
     node, dest, ping_outputs = test_outputs
     sent, received, rttmin, rttavg, rttmax, rttdev = ping_outputs
     self.assertEqual(sent, received)
     # pylint: enable-msg=W0612
     for rttval in [rttmin, rttavg, rttmax]:
         # Multiply delay by 4 to cover there & back on two links
         self.assertWithinTolerance(rttval, DELAY_MS * 4.0, DELAY_TOLERANCE)
开发者ID:RimHaw,项目名称:mn-ccnx,代码行数:19,代码来源:test_hifi.py

示例10: runOptionsTopoTest

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
    def runOptionsTopoTest( self, n, msg, hopts=None, lopts=None ):
        "Generic topology-with-options test runner."
        mn = Mininet( topo=SingleSwitchOptionsTopo( n=n, hopts=hopts,
                                                    lopts=lopts ),
                      host=CPULimitedHost, link=TCLink,
                      switch=self.switchClass, waitConnected=True )
        dropped = mn.run( mn.ping )
        hoptsStr = ', '.join( '%s: %s' % ( opt, value )
                              for opt, value in hopts.items() )
        loptsStr = ', '.join( '%s: %s' % ( opt, value )
                              for opt, value in lopts.items() )
        msg += ( '%s%% of pings were dropped during mininet.ping().\n'
                 'Topo = SingleSwitchTopo, %s hosts\n'
                 'hopts = %s\n'
                 'lopts = %s\n'
                 'host = CPULimitedHost\n'
                 'link = TCLink\n'
                 'Switch = %s\n'
                 % ( dropped, n, hoptsStr, loptsStr, self.switchClass ) )

        self.assertEqual( dropped, 0, msg=msg )
开发者ID:1514louluo,项目名称:mininet,代码行数:23,代码来源:test_hifi.py

示例11: range

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
	for i in range(sw_head, sw_head + max_sw):
	    Switchs.append('sw%d'  %i)
	    self.addNode('sw%d'  %i)

	for i in range(h_head, h_head + max_h):
	    Hosts.append('h%d'  %i)
	    self.addNode('h%d'  %i)

        #"""偶数と奇数をここで分ける"""
	Hostknum = Hosts[0::2] #偶数
	Hostgnum = Hosts[1::2] #奇数

	for (i,j,sw) in zip(Hostknum, Hostgnum, Switchs):
	    if i != None: self.addLink(sw,i)
	    if j != None: self.addLink(sw,j)

	for i in range(0, max_sw-1):
	    self.addLink(Switchs[i], Switchs[i+1])
        self.addLink(Switchs[max_sw-1], Switchs[0])

# topos = { 'myringtopo': ( lambda: MyRingTopo() ) }

if __name__ == '__main__':
    setLogLevel( 'info' )
    topo    = MyRingTopo( max_sw=22 )
    network = Mininet(topo, switch=OVSSwitch )
    network.run( CLI, network )


开发者ID:8Uchi29,项目名称:mininettopo,代码行数:29,代码来源:topo-ring.py

示例12: testLinear5

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testLinear5( self ):
     "Ping test on a 5-switch topology"
     mn = Mininet( LinearTopo( k=5 ), self.switchClass, Host, Controller )
     dropped = mn.run( mn.ping )
     self.assertEqual( dropped, 0 )
开发者ID:HaiVu,项目名称:mininet,代码行数:7,代码来源:test_nets.py

示例13: testSingle5

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testSingle5( self ):
     "Ping test on 5-host single-switch topology"
     mn = Mininet( SingleSwitchTopo( k=5 ), self.switchClass, Host, Controller )
     dropped = mn.run( mn.ping )
     self.assertEqual( dropped, 0 )
开发者ID:HaiVu,项目名称:mininet,代码行数:7,代码来源:test_nets.py

示例14: testMinimal

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testMinimal( self ):
     "Ping test on minimal topology"
     mn = Mininet( SingleSwitchTopo(), self.switchClass, Host, Controller )
     dropped = mn.run( mn.ping )
     self.assertEqual( dropped, 0 )
开发者ID:HaiVu,项目名称:mininet,代码行数:7,代码来源:test_nets.py

示例15: testLinear5

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import run [as 别名]
 def testLinear5( self ):
     "Ping test with both datapaths on a 5-switch topology"
     for switch in SWITCHES.values():
         mn = Mininet( LinearTopo( k=5 ), switch, Host, Controller )
         dropped = mn.run( mn.ping )
         self.assertEqual( dropped, 0 )
开发者ID:BoussahaRyma,项目名称:mn-ccnx,代码行数:8,代码来源:test_nets.py


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