本文整理汇总了Python中TestLib.TestLib.check_cpu_traffic方法的典型用法代码示例。如果您正苦于以下问题:Python TestLib.check_cpu_traffic方法的具体用法?Python TestLib.check_cpu_traffic怎么用?Python TestLib.check_cpu_traffic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestLib.TestLib
的用法示例。
在下文中一共展示了TestLib.check_cpu_traffic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_cpu_traffic [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,
"multicast_querier": 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(30)
tl = TestLib(ctl, aliases)
tl.check_cpu_traffic(sw_ports, test=False)
for iface in [m1_if, m2_if, m3_if, m4_if]:
iface.enable_multicast()
test_standard_mutlicast(tl, m1_if, [m2_if, m4_if], [m3_if], mcgrp(3))
test_standard_mutlicast(tl, m1_if, [m4_if], [m2_if, m3_if], mcgrp(4))
test_standard_mutlicast(tl, m2_if, [m3_if, m4_if, m1_if], [], mcgrp(5))
for iface in [m1_if, m2_if, m3_if, m4_if]:
iface.disable_multicast()
tl.check_cpu_traffic(sw_ports)
示例2: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_cpu_traffic [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()
示例3: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_cpu_traffic [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()
示例4: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_cpu_traffic [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()
示例5: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_cpu_traffic [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
dev_map = { m1_if : sw_if1, m2_if : sw_if2, m3_if : sw_if3, m4_if : sw_if4 }
# Create a bridge
sw_ifaces = [sw_if1, sw_if2, sw_if3, sw_if4]
sw_br = sw.create_bridge(slaves=sw_ifaces, 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.check_cpu_traffic(sw_ifaces, test=False)
test_mrouter(tl, dev_map, \
sender = m1_if, \
listeners = [], \
bridged = [m3_if, m2_if, m4_if], \
mc_routers = [m4_if], \
group = mcgrp(1))
test_mrouter(tl, dev_map, \
sender = m1_if, \
listeners = [m2_if], \
bridged = [m4_if, m3_if], \
mc_routers = [m3_if], \
group = mcgrp(2))
test_mrouter(tl, dev_map, \
sender = m1_if, \
listeners = [m2_if, m4_if], \
bridged = [m3_if], \
mc_routers = [m3_if], \
group = mcgrp(3))
test_mrouter(tl, dev_map, \
sender = m1_if, \
listeners = [m2_if], \
bridged = [m3_if, m4_if], \
mc_routers = [m3_if, m4_if], \
group = mcgrp(4))
test_mrouter(tl, dev_map, \
sender = m1_if, \
listeners = [m2_if, m4_if], \
bridged = [m3_if], \
mc_routers = [m2_if], \
group = mcgrp(5))
test_mrouter(tl, dev_map, \
sender = m1_if, \
listeners = [m2_if, m4_if], \
bridged = [m3_if], \
mc_routers = [m2_if, m3_if], \
group = mcgrp(6))
tl.check_cpu_traffic(sw_ifaces)
for iface in [m1_if, m2_if, m3_if, m4_if]:
iface.disable_multicast()