Skip to content
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
9 changes: 6 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def pytest_addoption(parser):
help="dvs name")
parser.addoption("--keeptb", action="store_true", default=False,
help="keep testbed after test")
parser.addoption("--imgname", action="store", default="docker-sonic-vs",
help="image name")

class AsicDbValidator(object):
def __init__(self, dvs):
Expand Down Expand Up @@ -142,7 +144,7 @@ def runcmd_output(self, cmd):
return subprocess.check_output("ip netns exec %s %s" % (self.nsname, cmd), shell=True)

class DockerVirtualSwitch(object):
def __init__(self, name=None, keeptb=False, fakeplatform=None):
def __init__(self, name=None, imgname=None, keeptb=False, fakeplatform=None):
self.basicd = ['redis-server',
'rsyslogd']
self.swssd = ['orchagent',
Expand Down Expand Up @@ -214,7 +216,7 @@ def __init__(self, name=None, keeptb=False, fakeplatform=None):
self.environment = ["fake_platform={}".format(fakeplatform)] if fakeplatform else []

# create virtual switch container
self.ctn = self.client.containers.run('docker-sonic-vs', privileged=True, detach=True,
self.ctn = self.client.containers.run(imgname, privileged=True, detach=True,
environment=self.environment,
network_mode="container:%s" % self.ctn_sw.name,
volumes={ self.mount: { 'bind': '/var/run/redis', 'mode': 'rw' } })
Expand Down Expand Up @@ -794,8 +796,9 @@ def setReadOnlyAttr(self, obj, attr, val):
def dvs(request):
name = request.config.getoption("--dvsname")
keeptb = request.config.getoption("--keeptb")
imgname = request.config.getoption("--imgname")
fakeplatform = getattr(request.module, "DVS_FAKE_PLATFORM", None)
dvs = DockerVirtualSwitch(name, keeptb, fakeplatform)
dvs = DockerVirtualSwitch(name, imgname, keeptb, fakeplatform)
yield dvs
if name == None:
dvs.get_logs(request.module.__name__)
Expand Down