Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions tests/common/fixtures/duthost_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import logging
import re

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -72,3 +73,18 @@ def disable_route_checker_module(duthosts, rand_one_dut_hostname):
duthost = duthosts[rand_one_dut_hostname]
for func in _disable_route_checker(duthost):
yield func

@pytest.fixture(scope='module')
def disable_fdb_aging(duthost):
"""
Disable fdb aging by bcmcmd 'age 0'.
The original config will be recovered after running test.
"""
cmd = "bcmcmd \'age {}\'"
output = duthost.shell("bcmcmd \'age\'")['stdout']
default_age = re.findall("Current age timer is (\d+).", output)
duthost.shell(cmd.format(0))
yield
# recover default aging time
duthost.shell(cmd.format(default_age))

4 changes: 3 additions & 1 deletion tests/fdb/test_fdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@

from tests.common.fixtures.ptfhost_utils import change_mac_addresses # lgtm[py/unused-import]
from tests.common.fixtures.ptfhost_utils import remove_ip_addresses # lgtm[py/unused-import]
from tests.common.fixtures.duthost_utils import disable_fdb_aging

pytestmark = [
pytest.mark.topology('t0')
pytest.mark.topology('t0'),
pytest.mark.usefixtures('disable_fdb_aging')
]

DEFAULT_FDB_ETHERNET_TYPE = 0x1234
Expand Down