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

[vs-test]: support python docker 3.5.0 #1958

Merged
merged 2 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions platform/vs/tests/bgp/test_invalid_nexthop.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def test_InvalidNexthop(dvs):

time.sleep(10)

output = dvs.runcmd(["vtysh", "-c", "show ipv6 bgp"])
(exit_code, output) = dvs.runcmd(["vtysh", "-c", "show ipv6 bgp"])

p.terminate()
p = p.wait()

print output
print exit_code, output

assert "3333::/64" in output
6 changes: 3 additions & 3 deletions platform/vs/tests/bgp/test_no_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def test_bounce(dvs):

time.sleep(60)

sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"])
all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"])
announce_route = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"])
(exit_code, sum_res) = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"])
(exit_code, all_route) = dvs.runcmd(["vtysh", "-c", "show ip bgp"])
(exit_code, announce_route) = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"])

p1.terminate()
p1 = p1.wait()
Expand Down
40 changes: 21 additions & 19 deletions platform/vs/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,7 @@ def __init__(self, dvs):
keys = atbl.getKeys()

assert len(keys) >= 1
# Filter out DTel Acl tables
default_table_found = False
for k in keys:
if default_table_found:
break
(status, fvs) = atbl.get(k)
for item in fvs:
if item[0] == "SAI_ACL_TABLE_ATTR_ACL_BIND_POINT_TYPE_LIST":
if 'SAI_ACL_BIND_POINT_TYPE_PORT' in item[1]:
self.default_acl_table = k
default_table_found = True
break
else:
break
self.default_acl_tables = keys

atbl = swsscommon.Table(self.adb, "ASIC_STATE:SAI_OBJECT_TYPE_ACL_ENTRY")
keys = atbl.getKeys()
Expand Down Expand Up @@ -179,9 +166,13 @@ def __init__(self, name=None):
network_mode="container:%s" % self.ctn_sw.name,
volumes={ self.mount: { 'bind': '/var/run/redis', 'mode': 'rw' } })

self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0")
self.check_ready()
self.init_asicdb_validator()
try:
self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0")
self.check_ready()
self.init_asicdb_validator()
except:
self.destroy()
raise

def destroy(self):
if self.cleanup:
Expand All @@ -199,7 +190,11 @@ def check_ready(self, timeout=30):
started = 0
while True:
# get process status
out = self.ctn.exec_run("supervisorctl status")
res = self.ctn.exec_run("supervisorctl status")
try:
out = res.output
except AttributeError:
out = res
for l in out.split('\n'):
fds = re_space.split(l)
if len(fds) < 2:
Expand Down Expand Up @@ -231,7 +226,14 @@ def init_asicdb_validator(self):
self.asicdb = AsicDbValidator(self)

def runcmd(self, cmd):
return self.ctn.exec_run(cmd)
res = self.ctn.exec_run(cmd)
try:
exitcode = res.exit_code
out = res.output
except AttributeError:
exitcode = 0
out = res
return (exitcode, out)

def copy_file(self, path, filename):
tarstr = StringIO.StringIO()
Expand Down