本文整理汇总了Python中TestLib.TestLib.iperf_mc方法的典型用法代码示例。如果您正苦于以下问题:Python TestLib.iperf_mc方法的具体用法?Python TestLib.iperf_mc怎么用?Python TestLib.iperf_mc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestLib.TestLib
的用法示例。
在下文中一共展示了TestLib.iperf_mc方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import iperf_mc [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()
示例2: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import iperf_mc [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()
示例3: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import iperf_mc [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_br = sw.create_bridge(slaves=[sw_if1, sw_if2, sw_if3, sw_if4],
options={"vlan_filtering": 1})
m1_if.set_addresses(["192.168.101.10/24", "2002::1/64"])
m2_if.set_addresses(["192.168.101.11/24", "2002::2/64"])
m3_if.set_addresses(["192.168.101.13/24", "2002::3/64"])
m4_if.set_addresses(["192.168.101.14/24", "2002::4/64"])
sleep(15)
tl = TestLib(ctl, aliases)
tl.iperf_mc(m1_if, [m2_if, m4_if], [m3_if], "239.255.1.3")
tl.iperf_mc(m1_if, [m4_if], [], "239.255.1.4")
tl.iperf_mc(m2_if, [m3_if, m4_if, m1_if] , [], "239.255.1.5")
示例4: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import iperf_mc [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()