Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[action] [PR:9542] Restore the MAC address of VLAN at the end of test_host_vlan #9682

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions tests/vlan/test_host_vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from tests.common.utilities import is_ipv4_address
from tests.common.utilities import wait_until, delete_running_config
from tests.common.utilities import skip_release

from tests.common.helpers.assertions import pytest_assert

pytestmark = [
pytest.mark.topology("t0", "m0", "mx")
Expand Down Expand Up @@ -94,10 +94,16 @@ def setup_host_vlan_intf_mac(duthosts, rand_one_dut_hostname, testbed_params, ve
if duthost.get_facts()['asic_type'] == 'mellanox':
DUT_VLAN_INTF_MAC = get_new_vlan_intf_mac_mellanox(dut_vlan_mac)
duthost.shell('redis-cli -n 4 hmset "VLAN|%s" mac %s' % (vlan_intf["attachto"], DUT_VLAN_INTF_MAC))
wait_until(10, 2, 2, lambda: duthost.get_dut_iface_mac(vlan_intf["attachto"]) == DUT_VLAN_INTF_MAC)
pytest_assert(wait_until(10, 2, 2, lambda: duthost.get_dut_iface_mac(vlan_intf["attachto"]) == DUT_VLAN_INTF_MAC),
"Failed to set mac address for vlan interface %s" % vlan_intf["attachto"])

yield

# Restore the original mac address of the vlan interface
duthost.shell('redis-cli -n 4 hmset "VLAN|%s" mac %s' % (vlan_intf["attachto"], dut_vlan_mac))
pytest_assert(wait_until(10, 2, 2, lambda: duthost.get_dut_iface_mac(vlan_intf["attachto"]) == dut_vlan_mac),
"Failed to restore mac address for vlan interface %s" % vlan_intf["attachto"])

if "dualtor" not in tbinfo["topo"]["name"]:
del_vlan_json = json.loads("""
[{
Expand All @@ -110,8 +116,6 @@ def setup_host_vlan_intf_mac(duthosts, rand_one_dut_hostname, testbed_params, ve
""" % (vlan_intf["attachto"], dut_vlan_mac))
delete_running_config(del_vlan_json, duthost)

wait_until(10, 2, 2, lambda: duthost.get_dut_iface_mac(vlan_intf["attachto"]) == dut_vlan_mac)


def test_host_vlan_no_floodling(
duthosts,
Expand Down