|
22 | 22 | from dvslib import dvs_mirror
|
23 | 23 | from dvslib import dvs_policer
|
24 | 24 |
|
| 25 | +from buffer_model import enable_dynamic_buffer |
| 26 | + |
25 | 27 | # FIXME: For the sake of stabilizing the PR pipeline we currently assume there are 32 front-panel
|
26 | 28 | # ports in the system (much like the rest of the test suite). This should be adjusted to accomodate
|
27 | 29 | # a dynamic number of ports. GitHub Issue: Azure/sonic-swss#1384.
|
@@ -71,6 +73,11 @@ def pytest_addoption(parser):
|
71 | 73 | default=None,
|
72 | 74 | help="Topology file for the Virtual Chassis Topology")
|
73 | 75 |
|
| 76 | + parser.addoption("--buffer_model", |
| 77 | + action="store", |
| 78 | + default="traditional", |
| 79 | + help="Buffer model") |
| 80 | + |
74 | 81 |
|
75 | 82 | def random_string(size=4, chars=string.ascii_uppercase + string.digits):
|
76 | 83 | return "".join(random.choice(chars) for x in range(size))
|
@@ -221,7 +228,8 @@ def __init__(
|
221 | 228 | forcedvs: bool = None,
|
222 | 229 | vct: str = None,
|
223 | 230 | newctnname: str = None,
|
224 |
| - ctnmounts: Dict[str, str] = None |
| 231 | + ctnmounts: Dict[str, str] = None, |
| 232 | + buffer_model: str = None, |
225 | 233 | ):
|
226 | 234 | self.basicd = ["redis-server", "rsyslogd"]
|
227 | 235 | self.swssd = [
|
@@ -366,6 +374,10 @@ def __init__(
|
366 | 374 | # Make sure everything is up and running before turning over control to the caller
|
367 | 375 | self.check_ready_status_and_init_db()
|
368 | 376 |
|
| 377 | + # Switch buffer model to dynamic if necessary |
| 378 | + if buffer_model == 'dynamic': |
| 379 | + enable_dynamic_buffer(self.get_config_db(), self.runcmd) |
| 380 | + |
369 | 381 | def destroy(self) -> None:
|
370 | 382 | if self.appldb:
|
371 | 383 | del self.appldb
|
@@ -1477,10 +1489,11 @@ def dvs(request) -> DockerVirtualSwitch:
|
1477 | 1489 | keeptb = request.config.getoption("--keeptb")
|
1478 | 1490 | imgname = request.config.getoption("--imgname")
|
1479 | 1491 | max_cpu = request.config.getoption("--max_cpu")
|
| 1492 | + buffer_model = request.config.getoption("--buffer_model") |
1480 | 1493 | fakeplatform = getattr(request.module, "DVS_FAKE_PLATFORM", None)
|
1481 | 1494 | log_path = name if name else request.module.__name__
|
1482 | 1495 |
|
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) |
1484 | 1497 |
|
1485 | 1498 | yield dvs
|
1486 | 1499 |
|
|
0 commit comments