Skip to content

Commit bfc28a9

Browse files
committed
Support the CLI option by which dynamic buffer model can be enabled
Signed-off-by: Stephen Sun <stephens@nvidia.com>
1 parent c6765b6 commit bfc28a9

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/conftest.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
from dvslib import dvs_mirror
2323
from dvslib import dvs_policer
2424

25+
from buffer_model import enable_dynamic_buffer
26+
2527
# FIXME: For the sake of stabilizing the PR pipeline we currently assume there are 32 front-panel
2628
# ports in the system (much like the rest of the test suite). This should be adjusted to accomodate
2729
# a dynamic number of ports. GitHub Issue: Azure/sonic-swss#1384.
@@ -71,6 +73,11 @@ def pytest_addoption(parser):
7173
default=None,
7274
help="Topology file for the Virtual Chassis Topology")
7375

76+
parser.addoption("--buffer_model",
77+
action="store",
78+
default="traditional",
79+
help="Buffer model")
80+
7481

7582
def random_string(size=4, chars=string.ascii_uppercase + string.digits):
7683
return "".join(random.choice(chars) for x in range(size))
@@ -221,7 +228,8 @@ def __init__(
221228
forcedvs: bool = None,
222229
vct: str = None,
223230
newctnname: str = None,
224-
ctnmounts: Dict[str, str] = None
231+
ctnmounts: Dict[str, str] = None,
232+
buffer_model: str = None,
225233
):
226234
self.basicd = ["redis-server", "rsyslogd"]
227235
self.swssd = [
@@ -366,6 +374,10 @@ def __init__(
366374
# Make sure everything is up and running before turning over control to the caller
367375
self.check_ready_status_and_init_db()
368376

377+
# Switch buffer model to dynamic if necessary
378+
if buffer_model == 'dynamic':
379+
enable_dynamic_buffer(self.get_config_db(), self.runcmd)
380+
369381
def destroy(self) -> None:
370382
if self.appldb:
371383
del self.appldb
@@ -1477,10 +1489,11 @@ def dvs(request) -> DockerVirtualSwitch:
14771489
keeptb = request.config.getoption("--keeptb")
14781490
imgname = request.config.getoption("--imgname")
14791491
max_cpu = request.config.getoption("--max_cpu")
1492+
buffer_model = request.config.getoption("--buffer_model")
14801493
fakeplatform = getattr(request.module, "DVS_FAKE_PLATFORM", None)
14811494
log_path = name if name else request.module.__name__
14821495

1483-
dvs = DockerVirtualSwitch(name, imgname, keeptb, fakeplatform, log_path, max_cpu, forcedvs)
1496+
dvs = DockerVirtualSwitch(name, imgname, keeptb, fakeplatform, log_path, max_cpu, forcedvs, buffer_model = buffer_model)
14841497

14851498
yield dvs
14861499

0 commit comments

Comments
 (0)