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

Migrating sonic-swss tests to use hwsku instead of fakeplatform #4

Closed
wants to merge 7 commits into from
Closed
20 changes: 10 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def __init__(
name: str = None,
imgname: str = None,
keeptb: bool = False,
fakeplatform: str = None,
hwsku: str = None,
log_path: str = None,
max_cpu: int = 2,
forcedvs: bool = None,
Expand Down Expand Up @@ -350,7 +350,7 @@ def __init__(
self.mount = f"/var/run/redis-vs/{self.ctn_sw.name}"
ensure_system(f"mkdir -p {self.mount}")

self.environment = [f"fake_platform={fakeplatform}"] if fakeplatform else []
self.environment = [f"HWSKU={hwsku}"] if hwsku else []

kwargs = {}
if newctnname:
Expand Down Expand Up @@ -1217,7 +1217,7 @@ def __init__(
namespace=None,
imgname=None,
keeptb=False,
fakeplatform=None,
hwsku=None,
log_path=None,
max_cpu=2,
forcedvs=None,
Expand All @@ -1226,7 +1226,7 @@ def __init__(
self.ns = namespace
self.chassbr = "br4chs"
self.keeptb = keeptb
self.fakeplatform = fakeplatform
self.hwsku = hwsku
self.topoFile = topoFile
self.imgname = imgname
self.ctninfo = {}
Expand Down Expand Up @@ -1285,7 +1285,7 @@ def find_all_ctns(self):
for ctn in docker.from_env().containers.list():
if ctn.name.endswith(suffix):
self.dvss[ctn.name] = DockerVirtualSwitch(ctn.name, self.imgname, self.keeptb,
self.fakeplatform, log_path=ctn.name,
self.hwsku, log_path=ctn.name,
max_cpu=self.max_cpu, forcedvs=self.forcedvs,
vct=self)
if self.chassbr is None and len(self.dvss) > 0:
Expand Down Expand Up @@ -1403,7 +1403,7 @@ def create_vct_ctn(self, ctndir):
if ctnname not in self.dvss:
self.dvss[ctnname] = DockerVirtualSwitch(name=None, imgname=self.imgname,
keeptb=self.keeptb,
fakeplatform=self.fakeplatform,
hwsku=self.hwsku,
log_path=self.log_path,
max_cpu=self.max_cpu,
forcedvs=self.forcedvs,
Expand Down Expand Up @@ -1570,10 +1570,10 @@ def dvs(request) -> DockerVirtualSwitch:
imgname = request.config.getoption("--imgname")
max_cpu = request.config.getoption("--max_cpu")
buffer_model = request.config.getoption("--buffer_model")
fakeplatform = getattr(request.module, "DVS_FAKE_PLATFORM", None)
hwsku = getattr(request.module, "DVS_HWSKU", None)
log_path = name if name else request.module.__name__

dvs = DockerVirtualSwitch(name, imgname, keeptb, fakeplatform, log_path, max_cpu, forcedvs, buffer_model = buffer_model)
dvs = DockerVirtualSwitch(name, imgname, keeptb, hwsku, log_path, max_cpu, forcedvs, buffer_model = buffer_model)

yield dvs

Expand All @@ -1594,11 +1594,11 @@ def vct(request):
imgname = request.config.getoption("--imgname")
max_cpu = request.config.getoption("--max_cpu")
log_path = vctns if vctns else request.module.__name__
fakeplatform = getattr(request.module, "DVS_FAKE_PLATFORM", None)
hwsku = getattr(request.module, "DVS_HWSKU", None)
if not topo:
# use ecmp topology as default
topo = "virtual_chassis/chassis_with_ecmp_neighbors.json"
vct = DockerVirtualChassisTopology(vctns, imgname, keeptb, fakeplatform, log_path, max_cpu,
vct = DockerVirtualChassisTopology(vctns, imgname, keeptb, hwsku, log_path, max_cpu,
forcedvs, topo)
yield vct
vct.get_logs(request.module.__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mirror_ipv6_combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from swsscommon import swsscommon

DVS_FAKE_PLATFORM = "broadcom"
DVS_HWSKU = "Force10-S6000"


class TestMirror(object):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mirror_ipv6_separate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from swsscommon import swsscommon

DVS_FAKE_PLATFORM = "mellanox"
DVS_HWSKU = "Mellanox-SN2700"


class TestMirror(object):
Expand Down