本文整理汇总了Python中TestLib.TestLib.iperf_mc_listen方法的典型用法代码示例。如果您正苦于以下问题:Python TestLib.iperf_mc_listen方法的具体用法?Python TestLib.iperf_mc_listen怎么用?Python TestLib.iperf_mc_listen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestLib.TestLib
的用法示例。
在下文中一共展示了TestLib.iperf_mc_listen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import iperf_mc_listen [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()
示例2: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import iperf_mc_listen [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()