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


Python Mininet.stopMobility方法代码示例

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


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

示例1: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import stopMobility [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    sta2 = net.addStation( 'sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid1', mode= 'g', channel= '1', position='15,50,0' )
    ap2 = net.addBaseStation( 'ap2', ssid= 'new-ssid2', mode= 'g', channel= '6', position='25,30,0' )
    c1 = net.addController( 'c1', controller=Controller )

    print "*** Creating links"
    net.addLink(ap1, ap2)
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)

    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start( [c1] )
    ap2.start( [c1] )

    ap1.cmd('ifconfig ap1-eth1 20.0.0.2/8')
    ap2.cmd('ifconfig ap2-eth1 20.0.0.3/8')

    print "*** Starting Wishful framework"
    folder = './'

    print "*** ... agents ..."
    agent1 = WishfulAgent(ap1, folder + 'agent', folder + 'agent_config_1.yaml')
    agent2 = WishfulAgent(ap2, folder + 'agent', folder + 'agent_config_2.yaml')
    agent1.start()
    agent2.start()

    print "*** ... controller ..."
    wf_ctrl = WishfulController(ap1, folder + 'global_controller', folder + 'controller_config.yaml')
    wf_ctrl.start()

    print "*** Starting network"

    """uncomment to plot graph"""
    net.plotGraph(max_x=100, max_y=100)

    net.startMobility(startTime=0)
    net.mobility('sta1', 'start', time=0, position='10,45,0')
    net.mobility('sta1', 'stop', time=60, position='50,20,0')
    net.mobility('sta2', 'start', time=0, position='0,60,0')
    net.mobility('sta2', 'stop', time=60, position='30,10,0')
    net.stopMobility(stopTime=60)

    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    wf_ctrl.stop()    
    agent1.stop()
    agent2.stop()
    net.stop()
开发者ID:wishful-project,项目名称:wishful_mininet,代码行数:61,代码来源:wishful_mininet.py

示例2: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import stopMobility [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid1', mode= 'g', channel= '1', position='15,30,0' )
    ap2 = net.addBaseStation( 'ap2', ssid= 'new-ssid1', mode= 'g', channel= '6', position='55,30,0' )
    s3 = net.addSwitch( 's3' )
    h4 = net.addHost( 'h4', ip='10.0.0.4/8' )
    c1 = net.addController( 'c1', controller=Controller, port=6653 )

    net.plotHost(h4, position='35,90,0')
    net.plotHost(s3, position='35,80,0')

    print "*** Creating links"
    net.addLink(ap1, s3)
    net.addLink(ap2, s3)
    net.addLink(h4, s3)

    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start( [c1] )
    ap2.start( [c1] )
    s3.start( [c1] )

    """uncomment to plot graph"""
    net.plotGraph(max_x=100, max_y=100)

    net.startMobility(startTime=0)
    net.mobility('sta1', 'start', time=1, position='10,30,0')
    net.mobility('sta1', 'stop', time=40, position='60,30,0')
    net.stopMobility(stopTime=40)

    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    net.stop()
开发者ID:ramonfontes,项目名称:miscellaneous,代码行数:43,代码来源:handover.py

示例3: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import stopMobility [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    sta2 = net.addStation( 'sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid1', mode= 'g', channel= '1', position='15,50,0' )
    ap2 = net.addBaseStation( 'ap2', ssid= 'new-ssid2', mode= 'g', channel= '6', position='25,30,0' )
    c1 = net.addController( 'c1', controller=Controller )

    """uncomment to plot graph"""
    #net.plotGraph(max_x=100, max_y=100)

    print "*** Creating links"
    net.addLink(ap1, ap2)
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)

    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start( [c1] )
    ap2.start( [c1] )

    net.startMobility(0)
    net.mobility('sta1', 'start', time=1, position='10.0,45.0,0.0')
    net.mobility('sta2', 'start', time=2, position='10.0,40.0,0.0')
    net.mobility('sta1', 'stop', time=12, position='15.0,10,0.0')
    net.mobility('sta2', 'stop', time=22, position='25.0,25,0.0')
    net.stopMobility(23)

    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    net.stop()
开发者ID:unixcore,项目名称:mininet-wifi-1,代码行数:40,代码来源:handover.py

示例4: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import stopMobility [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print "*** Creating nodes"
    h1 = net.addHost( 'h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8' )
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    sta2 = net.addStation( 'sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid', mode= 'g', channel= '1', position='45,40,0' )
    c1 = net.addController( 'c1', controller=Controller )

    print "*** Associating and Creating links"
    net.addLink(ap1, h1)
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)

    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start( [c1] )

    """uncomment to plot graph"""
    net.plotGraph(max_x=100, max_y=100)

    net.startMobility(startTime=0)
    net.mobility('sta1', 'start', time=1, position='40.0,30.0,0.0')
    net.mobility('sta2', 'start', time=2, position='40.0,40.0,0.0')
    net.mobility('sta1', 'stop', time=12, position='31.0,10.0,0.0')
    net.mobility('sta2', 'stop', time=22, position='55.0,31.0,0.0')
    net.stopMobility(stopTime=23)

    print "*** Running CLI"
    CLI( net )

    print "*** Stopping network"
    net.stop()
开发者ID:EliseuTorres,项目名称:mininet-wifi-1,代码行数:39,代码来源:wifiMobility.py

示例5: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import stopMobility [as 别名]
def topology():

    "Create a network."
    net = Mininet(controller=Controller, link=TCLink, switch=OVSKernelSwitch)

    print "*** Creating nodes"
    h1 = net.addHost("h1", mac="00:00:00:00:00:01", ip="10.0.0.1/8")
    sta1 = net.addStation("sta1", mac="00:00:00:00:00:02", ip="10.0.0.2/8")
    sta2 = net.addStation("sta2", mac="00:00:00:00:00:03", ip="10.0.0.3/8")
    ap1 = net.addBaseStation("ap1", ssid="new-ssid", mode="g", channel="1", position="15,30,0")
    c1 = net.addController("c1", controller=Controller)

    print "*** Associating and Creating links"
    net.addLink(ap1, h1)
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)

    print "*** Starting network"
    net.build()
    c1.start()
    ap1.start([c1])

    """uncomment to plot graph"""
    # net.plotGraph(max_x=60, max_y=60)

    net.startMobility(startTime=0)
    net.mobility("sta1", "start", time=1, position="10.0,20.0,0.0")
    net.mobility("sta2", "start", time=2, position="10.0,30.0,0.0")
    net.mobility("sta1", "stop", time=12, position="1.0,0.0,0.0")
    net.mobility("sta2", "stop", time=22, position="25.0,21.0,0.0")
    net.stopMobility(stopTime=23)

    print "*** Running CLI"
    CLI(net)

    print "*** Stopping network"
    net.stop()
开发者ID:shub1905,项目名称:mininet-wifi,代码行数:39,代码来源:wifiMobility.py

示例6: topology

# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import stopMobility [as 别名]
def topology():

    "Create a network."
    net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )

    print("*** Creating nodes")
    sta1 = net.addStation( 'sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8' )
    sta2 = net.addStation( 'sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8' )
    ap1 = net.addBaseStation( 'ap1', ssid= 'new-ssid1', mode= 'g', channel= '1', position='15,50,0' )
    ap2 = net.addBaseStation( 'ap2', ssid= 'new-ssid2', mode= 'g', channel= '6', position='25,30,0' )
    c1 = net.addController( 'c1', controller=Controller )

    print("*** Creating links")
    net.addLink(ap1, ap2)
    net.addLink(ap1, sta1)
    net.addLink(ap1, sta2)

    print("*** Starting network")
    net.build()
    c1.start()
    ap1.start( [c1] )
    ap2.start( [c1] )

    "Configure IP addresses on APs for binding Wishful agent"
    ap1.cmd('ifconfig ap1-eth1 20.0.0.2/8')
    ap2.cmd('ifconfig ap2-eth1 20.0.0.3/8')

    print("*** Starting Wishful framework")
    folder = './'

    print("*** ... agents ...")
    agent1 = WishfulAgent(ap1, folder + 'agent', folder + 'agent1_cfg.yaml')
    agent2 = WishfulAgent(ap2, folder + 'agent', folder + 'agent2_cfg.yaml')
    agent1.start()
    agent2.start()

    print("*** ... controller ...")
    wf_ctrl = WishfulController(ap1, folder + 'global_controller', folder + 'controller_cfg.yaml')
    wf_ctrl.start()

    print("*** Starting network")

    """uncomment to plot graph"""
    if GUI:
        net.plotGraph(max_x=100, max_y=100)

    if MOBILITY:
        net.startMobility(startTime=0)
        net.mobility('sta1', 'start', time=0, position='10,45,0')
        net.mobility('sta1', 'stop', time=60, position='50,20,0')
        net.mobility('sta2', 'start', time=0, position='0,60,0')
        net.mobility('sta2', 'stop', time=60, position='30,10,0')
        net.stopMobility(stopTime=60)

    print("*** Starting network")

    print("*** wait for node discovery")
    time.sleep(3)

    print("*** perform ping")
    sta1.cmd('ping -c20 %s' % sta2.IP())

    print("*** Check that Wishful agents/controllers are still running ...")
    if not wf_ctrl.check_is_running() or not agent1.check_is_running() or not agent2.check_is_running():
        raise Exception("Error; wishful controller or agents not running; check logfiles ... ")
    else:
        print("*** Wishful agents/controllers: OK")

    if MN_CLI:
        print("*** Running CLI")
        CLI( net )

    # Show controller log file
    print('WiSHFUL agent #1 logfile content:')
    print(agent1.read_log_file())
    print('')

    print('WiSHFUL agent #2 logfile content:')
    print(agent2.read_log_file())
    print('')

    print('WiSHFUL controller logfile content:')
    print(wf_ctrl.read_log_file())
    print('')

    print("*** Stopping network")
    wf_ctrl.stop()    
    agent1.stop()
    agent2.stop()
    net.stop()
开发者ID:wishful-project,项目名称:examples,代码行数:92,代码来源:mn_script.py


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