本文整理汇总了Python中TestLib.TestLib.check_fdb方法的典型用法代码示例。如果您正苦于以下问题:Python TestLib.check_fdb方法的具体用法?Python TestLib.check_fdb怎么用?Python TestLib.check_fdb使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestLib.TestLib
的用法示例。
在下文中一共展示了TestLib.check_fdb方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_fdb [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m2_if1, sw_if1, sw_if2 = ifaces
m1_if1_10 = m1.create_vlan(m1_if1, 10, ip=test_ip(1,1))
m2_if1_20 = m2.create_vlan(m2_if1, 20, ip=test_ip(1,2))
sw_if1_10 = sw.create_vlan(sw_if1, 10)
sw_if2_20 = sw.create_vlan(sw_if2, 20)
# Ageing time is 10 seconds.
br_options = {"vlan_filtering": 0, "ageing_time": 1000}
sw_br = sw.create_bridge(slaves = [sw_if1_10, sw_if2_20], options=br_options)
sleep(15)
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_if1_10, m2_if1_20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
sleep(20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
# Disable learning and make sure FDB is not populated.
sw_if1_10.set_br_learning(on=False, self=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
# Disable flooding and make sure ping fails.
sw_if1_10.set_br_flooding(on=False, self=True)
tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
# Set a static FDB entry and make sure ping works again.
sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
# Remove static FDB entry. Ping should fail.
sw_if1_10.del_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
# Enable learning_sync and make sure both FDBs are populated.
sw_if1_10.set_br_learning(on=True, self=True)
sw_if1_10.set_br_flooding(on=True, self=True)
sw_if1_10.set_br_learning_sync(on=True, self=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
sleep(20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
# Disable learning_sync and make sure only hardware FDB is populated.
sw_if1_10.set_br_learning_sync(on=False, self=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
# Remove port from bridge and add it back. Disable flooding and learning
# and make sure ping doesn't work. Note that port must be removed from
# bridge when the FDB entry exists only in the hardware table. Otherwise,
# bridge code will flush it himself, instead of driver.
sw_br.slave_del(sw_if1_10.get_id())
sw_br.slave_add(sw_if1_10.get_id()) # Enables learning sync by default.
sw_if1_10.set_br_learning(on=False, self=True)
sw_if1_10.set_br_flooding(on=False, self=True)
tl.ping_simple(m1_if1_10, m2_if1_20, fail_expected=True)
# Enable learning and make sure ping works again.
sw_if1_10.set_br_learning(on=True, self=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software")
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
sleep(20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware", False)
# Insert a static FDB entry and disable learning sync. Ping should work.
sw_if1_10.add_br_fdb(str(m1_if1_10.get_hwaddr()), self=True)
sw_if1_10.set_br_learning_sync(on=False, self=True)
tl.ping_simple(m1_if1_10, m2_if1_20)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
sleep(20)
# Make sure static entry is not aged out.
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "software", False)
tl.check_fdb(sw_if1_10, m1_if1_10.get_hwaddr(), 0, "hardware")
#.........这里部分代码省略.........
示例2: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_fdb [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces
team_config = '{"runner" : {"name" : "lacp"}}'
m1_lag1 = m1.create_team(slaves=[m1_if1, m1_if2], config=team_config,
ip=["192.168.101.10/24", "2002::1/64"])
m2_lag1 = m2.create_team(slaves=[m2_if1, m2_if2], config=team_config,
ip=["192.168.101.11/24", "2002::2/64"])
sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config)
sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config)
# Ageing time is 10 seconds.
br_options = {"vlan_filtering": 1, "ageing_time": 1000}
sw_br = sw.create_bridge(slaves = [sw_lag1, sw_lag2], options=br_options)
sleep(15)
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
sleep(20)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
# Disable learning and make sure FDB is not populated.
sw_lag1.set_br_learning(on=False, self=True)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
# Disable flooding and make sure ping fails.
sw_lag1.set_br_flooding(on=False, self=True)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
# Set a static FDB entry and make sure ping works again.
sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
# Remove static FDB entry. Ping should fail.
sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
# Enable learning_sync and make sure both FDBs are populated.
sw_lag1.set_br_learning(on=True, self=True)
sw_lag1.set_br_flooding(on=True, self=True)
sw_lag1.set_br_learning_sync(on=True, self=True)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
sleep(20)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
# Disable learning_sync and make sure only hardware FDB is populated.
sw_lag1.set_br_learning_sync(on=False, self=True)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
# Remove port from bridge and add it back. Disable flooding and learning
# and make sure ping doesn't work. Note that port must be removed from
# bridge when the FDB entry exists only in the hardware table. Otherwise,
# bridge code will flush it himself, instead of driver.
sw_br.slave_del(sw_lag1.get_id())
sw_br.slave_add(sw_lag1.get_id()) # Enables learning sync by default.
sw_lag1.set_br_learning(on=False, self=True)
sw_lag1.set_br_flooding(on=False, self=True)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
# Enable learning and make sure ping works again.
sw_lag1.set_br_learning(on=True, self=True)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software")
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
sleep(20)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware", False)
# Insert a static FDB entry and disable learning sync. Ping should work.
sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), self=True, vlan_tci=1)
sw_lag1.set_br_learning_sync(on=False, self=True)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, "hardware")
#.........这里部分代码省略.........
示例3: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_fdb [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m2_if1, sw_if1, sw_if2 = ifaces
# We can't set STP state if kernel's STP is running.
br_options = {"stp_state": 0, "vlan_filtering": 1, "ageing_time": 1000}
sw.create_bridge(slaves=[sw_if1, sw_if2], options=br_options)
m1_if1.reset(ip=test_ip(1, 1))
m2_if1.reset(ip=test_ip(1, 2))
sleep(40)
tl = TestLib(ctl, aliases)
# Set STP state to DISABLED and make sure ping fails and FDB is not
# populated.
sw_if1.set_br_state(0)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
# Set STP state to LISTENING and make sure ping fails and FDB is not
# populated.
sw_if1.set_br_state(1)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
# Set STP state to LEARNING and make sure ping fails, but FDB *is*
# populated.
sw_if1.set_br_state(2)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
sleep(20)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
# Set STP state to FORWARDING and make sure ping works and FDB is
# populated.
sw_if1.set_br_state(3)
tl.ping_simple(m1_if1, m2_if1)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software")
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware")
sleep(20)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "software", False)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, "hardware", False)
# Make sure that even with a static FDB record we don't get traffic
# when state is DISABLED, LEARNING or LISTENING.
sw_if2.add_br_fdb(str(m2_if1.get_hwaddr()), self=True, vlan_tci=1)
sw_if1.set_br_state(0)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
sw_if1.set_br_state(1)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
sw_if1.set_br_state(2)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
# Cleanup
sw_if2.del_br_fdb(str(m2_if1.get_hwaddr()), self=True, vlan_tci=1)
示例4: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_fdb [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m2_if1, sw_if1, sw_if2 = ifaces
m1_if1.reset(ip=test_ip(1,1))
m2_if1.reset(ip=test_ip(1,2))
# Ageing time is 10 seconds.
br_options = {"vlan_filtering": 1, "ageing_time": 1000,
"multicast_querier": 1}
sw_br = sw.create_bridge(slaves = [sw_if1, sw_if2], options=br_options)
sleep(30)
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_if1, m2_if1)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
sw_if1.set_br_learning(on=False, master=True)
sleep(30)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Make sure FDB is not populated when learning is disabled.
sw_if1.set_br_learning(on=False, master=True)
tl.ping_simple(m1_if1, m2_if1)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Disable flooding and make sure ping fails.
sw_if1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
# Set a static FDB entry and make sure ping works again. Also check
# its offloaded
sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_if1, m2_if1)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)
# Remove static FDB entry. Ping should fail.
sw_if1.del_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False, False)
# Enable learning and flooding and make sure ping works again.
sw_if1.set_br_learning(on=True, master=True)
sw_if1.set_br_flooding(on=True, master=True)
tl.ping_simple(m1_if1, m2_if1)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True)
sw_if1.set_br_learning(on=False, master=True)
sleep(20)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, True, False)
# Insert a static FDB entry. Ping should work.
sw_if1.add_br_fdb(str(m1_if1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_if1, m2_if1)
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)
sleep(20)
# Make sure static entry is not aged out.
tl.check_fdb(sw_if1, m1_if1.get_hwaddr(), 1, True, False)
# Remove port from bridge and add it back. The static entry added
# before should be flushed. Disable flooding and learning and make
# sure ping doesn't work.
sw_br.slave_del(sw_if1.get_id())
sw_br.slave_add(sw_if1.get_id())
sw_if1.set_br_learning(on=False, master=True)
sw_if1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_if1, m2_if1, fail_expected=True)
示例5: do_task
# 需要导入模块: from TestLib import TestLib [as 别名]
# 或者: from TestLib.TestLib import check_fdb [as 别名]
def do_task(ctl, hosts, ifaces, aliases):
m1, m2, sw = hosts
m1_if1, m1_if2, m2_if1, m2_if2, sw_if1, sw_if2, sw_if3, sw_if4 = ifaces
team_config = '{"runner" : {"name" : "lacp"}}'
m1_lag1 = m1.create_team(slaves=[m1_if1, m1_if2], config=team_config,
ip=["192.168.101.10/24", "2002::1/64"])
m2_lag1 = m2.create_team(slaves=[m2_if1, m2_if2], config=team_config,
ip=["192.168.101.11/24", "2002::2/64"])
sw_lag1 = sw.create_team(slaves=[sw_if1, sw_if2], config=team_config)
sw_lag2 = sw.create_team(slaves=[sw_if3, sw_if4], config=team_config)
# Ageing time is 10 seconds.
br_options = {"vlan_filtering": 1, "ageing_time": 1000, "multicast_querier": 1}
sw_br = sw.create_bridge(slaves = [sw_lag1, sw_lag2], options=br_options)
sleep(30)
tl = TestLib(ctl, aliases)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
sw_lag1.set_br_learning(on=False, master=True)
sleep(30)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)
# Make sure FDB is not populated when learning is disabled.
sw_lag1.set_br_learning(on=False, master=True)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)
# Disable flooding and make sure ping fails.
sw_lag1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
# Set a static FDB entry and make sure ping works again. Also check
# its offloaded
sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)
# Remove static FDB entry. Ping should fail.
sw_lag1.del_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False, False)
# Enable learning and flooading and make sure ping works again.
sw_lag1.set_br_learning(on=True, master=True)
sw_lag1.set_br_flooding(on=True, master=True)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True)
sw_lag1.set_br_learning(on=False, master=True)
sleep(30)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, True, False)
# Insert a static FDB entry. Ping should work.
sw_lag1.add_br_fdb(str(m1_lag1.get_hwaddr()), master=True, vlan_tci=1)
tl.ping_simple(m1_lag1, m2_lag1)
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)
sleep(30)
# Make sure static entry is not aged out.
tl.check_fdb(sw_lag1, m1_lag1.get_hwaddr(), 1, True, False)
# Remove port from bridge and add it back. The static entry added
# before should be flushed. Disable flooding and learning and make
# sure ping doesn't work.
sw_br.slave_del(sw_lag1.get_id())
sw_br.slave_add(sw_lag1.get_id())
sw_lag1.set_br_learning(on=False, master=True)
sw_lag1.set_br_flooding(on=False, master=True)
tl.ping_simple(m1_lag1, m2_lag1, fail_expected=True)