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


Python TestLib.mc_ipref_compare_result方法代码示例

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


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

示例1: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import mc_ipref_compare_result [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if, m2_if, m3_if, m4_if, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces

    # Create a bridge
    sw_ports = [sw_if1, sw_if2, sw_if3, sw_if4]
    sw_br = sw.create_bridge(slaves = sw_ports, options={"vlan_filtering": 1})

    m1_if.set_addresses(test_ip(1, 1))
    m2_if.set_addresses(test_ip(1, 2))
    m3_if.set_addresses(test_ip(1, 3))
    m4_if.set_addresses(test_ip(1, 4))
    sleep(15)

    tl = TestLib(ctl, aliases)
    for iface in [m1_if, m2_if, m3_if, m4_if]:
        iface.enable_multicast()

    tl._ctl.wait(2)
    tl.check_cpu_traffic(sw_ports, test=False)

    mcast_iface = [m2_if, m3_if, m4_if]
    sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_ON)
    sw_if2.set_mcast_flood(False)

    result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, False, False])
    tl.check_cpu_traffic(sw_ports)

    sw_br.set_br_mcast_snooping(False)
    tl._ctl.wait(2)
    result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [False, True, True])
    tl.check_cpu_traffic(sw_ports)

    sw_if2.set_mcast_flood(True)
    sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_OFF)
    sw_if3.set_mcast_router(MCAST_ROUTER_PORT.FIXED_ON)
    sw_if3.set_mcast_flood(False)

    result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, False, True])
    tl.check_cpu_traffic(sw_ports)

    sw_br.set_br_mcast_snooping()
    tl._ctl.wait(2)

    result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [False, True, False])
    tl.check_cpu_traffic(sw_ports)

    sw_if2.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)
    sw_if2.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)
    sw_if3.set_mcast_flood(True)
    for iface in [m1_if, m2_if, m3_if, m4_if]:
        iface.disable_multicast()
开发者ID:jpirko,项目名称:lnst,代码行数:58,代码来源:l2-026-bridge_mdb_unreg_flood.py

示例2: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import mc_ipref_compare_result [as 别名]
def do_task(ctl, hosts, ifaces, host_br, aliases):
    m1, m2, sw = hosts
    m1_if, m2_if, m3_if, m4_if, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces

    sw_ports = [sw_if1, sw_if2, sw_if3, sw_if4]
    sw_br = sw.create_bridge(slaves=sw_ports, options={"vlan_filtering": 1})

    m1_if.set_addresses(test_ip(1, 1))
    m2_if.set_addresses(test_ip(1, 2))
    m3_if.set_addresses(test_ip(1, 3))
    m4_if.set_addresses(test_ip(1, 4))

    tl = TestLib(ctl, aliases)
    mcast_iface = [m1_if, m3_if, m4_if]
    m2_if.enable_multicast()
    for iface in mcast_iface:
        iface.enable_multicast()
    for iface in sw_ports:
        iface.set_mcast_router(MCAST_ROUTER_PORT.FIXED_OFF)

    sw_if1.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)
    sleep(15)

    s_procs = tl.iperf_mc_listen(m3_if, mcgrp(1))
    tl._ctl.wait(2)

    tl.check_cpu_traffic(sw_ports, test=False)
    result = tl.iperf_mc(m2_if, mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [False, True, False])
    tl.check_cpu_traffic(sw_ports)

    result = tl.iperf_mc(m2_if, mcast_iface, mcgrp(2))
    tl.mc_ipref_compare_result(mcast_iface, result, [False, False, False])
    tl.check_cpu_traffic(sw_ports)

    host_br.set_br_mcast_snooping()
    host_br.set_br_mcast_querier(True)
    tl._ctl.wait(30)

    result = tl.iperf_mc(m2_if, mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, True, False])
    tl.check_cpu_traffic(sw_ports)

    result = tl.iperf_mc(m2_if, mcast_iface, mcgrp(2))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, False, False])
    tl.check_cpu_traffic(sw_ports)

    for iface in sw_ports:
        iface.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)
    s_procs.intr()

    for iface in mcast_iface:
        iface.disable_multicast()
    m2_if.disable_multicast()
开发者ID:jpirko,项目名称:lnst,代码行数:56,代码来源:l2-024-bridge_mdb_mc_router_port_learning.py

示例3: do_task

# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import mc_ipref_compare_result [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
    m1, m2, sw = hosts
    m1_if, m2_if, m3_if, m4_if, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces

    # Create a bridge
    sw_ports = [sw_if1, sw_if2, sw_if3, sw_if4]
    sw_br = sw.create_bridge(slaves=sw_ports, options={"vlan_filtering": 1})

    m1_if.set_addresses(test_ip(1, 1))
    m2_if.set_addresses(test_ip(1, 2))
    m3_if.set_addresses(test_ip(1, 3))
    m4_if.set_addresses(test_ip(1, 4))
    sleep(15)

    tl = TestLib(ctl, aliases)
    for iface in [m1_if, m2_if, m3_if, m4_if]:
        iface.enable_multicast()

    logging.info("%s  join %s" % (m3_if.get_devname(), mcgrp(1)))
    s_procs_1 = [tl.iperf_mc_listen(m3_if, mcgrp(1))]
    logging.info("%s and %s  join %s" % (m2_if.get_devname(),
                                         m3_if.get_devname(), mcgrp(2)))
    s_procs_2 = [tl.iperf_mc_listen(listener, mcgrp(2))
                 for listener in [m2_if, m3_if]]
    tl._ctl.wait(2)

    logging.info("set mrouter on")
    mcast_iface = [m2_if, m3_if, m4_if]
    sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_ON)

    logging.info("check registered mid flood")
    tl.check_cpu_traffic(sw_ports, test=False)
    result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, True, False])
    tl.check_cpu_traffic(sw_ports)

    logging.info("check registered mid with mrouter flood")
    result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(2))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, True, False])
    tl.check_cpu_traffic(sw_ports)

    logging.info("check unregistered mc flood")
    result = tl.iperf_mc(m1_if, mcast_iface, mcgrp(3))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, False, False])
    tl.check_cpu_traffic(sw_ports)

    logging.info("set mrouter off")
    sw_if2.set_mcast_router(MCAST_ROUTER_PORT.FIXED_OFF)
    tl._ctl.wait(2)

    logging.info("check registered mid flood")
    result = tl.iperf_mc(m1_if,  mcast_iface, mcgrp(1))
    tl.mc_ipref_compare_result(mcast_iface, result, [False, True, False])
    tl.check_cpu_traffic(sw_ports)

    logging.info("check registered mid with mrouter flood")
    result = tl.iperf_mc(m1_if,  mcast_iface, mcgrp(2))
    tl.mc_ipref_compare_result(mcast_iface, result, [True, True, False])
    tl.check_cpu_traffic(sw_ports)

    logging.info("check unregistered mc flood")
    result = tl.iperf_mc(m1_if,  mcast_iface, mcgrp(3))
    tl.mc_ipref_compare_result(mcast_iface, result, [False, False, False])
    tl.check_cpu_traffic(sw_ports)

    sw_if2.set_mcast_router(MCAST_ROUTER_PORT.LEARNING)

    for proc in s_procs_1 + s_procs_2:
        proc.intr()

    for iface in mcast_iface:
        iface.disable_multicast()
开发者ID:jpirko,项目名称:lnst,代码行数:74,代码来源:l2-023-bridge_mdb_mc_router_port_basic.py


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