def is_row_added_to_l2multicast_table(mac_address=None, port_id=None, vlan_id=1, switch_instance=None, result=True):
"""Check if row with specified parameters added to L2Multicast table.
"""
# Need to wait until entry will be added to L2Multicast table.
time.sleep(1)
table = switch_instance.getprop_table("L2Multicast")
is_entry_added = False
if table:
for row in table:
if (row['macAddress'] == mac_address) and (row['portId'] == port_id) and (row['vlanId'] == vlan_id):
is_entry_added = True
if is_entry_added == result:
return True
else:
if is_entry_added is False:
pytest.fail("Entry is not added to L2Multicast table!")
if is_entry_added is True:
pytest.fail("Entry is added to L2Multicast table (should not be)!")
评论列表
文章目录