當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。