Skip to content

Commit a01791e

Browse files
authored
[vs-test]: support python docker 3.5.0 (#1958)
* [vs-test]: support python docker 3.5.0 Signed-off-by: Guohan Lu <[email protected]>
1 parent 788b20e commit a01791e

File tree

3 files changed

+26
-24
lines changed

3 files changed

+26
-24
lines changed

platform/vs/tests/bgp/test_invalid_nexthop.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def test_InvalidNexthop(dvs):
2222

2323
time.sleep(10)
2424

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

2727
p.terminate()
2828
p = p.wait()
2929

30-
print output
30+
print exit_code, output
3131

3232
assert "3333::/64" in output

platform/vs/tests/bgp/test_no_export.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ def test_bounce(dvs):
2727

2828
time.sleep(60)
2929

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

3434
p1.terminate()
3535
p1 = p1.wait()

platform/vs/tests/conftest.py

+21-19
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,7 @@ def __init__(self, dvs):
5555
keys = atbl.getKeys()
5656

5757
assert len(keys) >= 1
58-
# Filter out DTel Acl tables
59-
default_table_found = False
60-
for k in keys:
61-
if default_table_found:
62-
break
63-
(status, fvs) = atbl.get(k)
64-
for item in fvs:
65-
if item[0] == "SAI_ACL_TABLE_ATTR_ACL_BIND_POINT_TYPE_LIST":
66-
if 'SAI_ACL_BIND_POINT_TYPE_PORT' in item[1]:
67-
self.default_acl_table = k
68-
default_table_found = True
69-
break
70-
else:
71-
break
58+
self.default_acl_tables = keys
7259

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

182-
self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0")
183-
self.check_ready()
184-
self.init_asicdb_validator()
169+
try:
170+
self.ctn.exec_run("sysctl -w net.ipv6.conf.all.disable_ipv6=0")
171+
self.check_ready()
172+
self.init_asicdb_validator()
173+
except:
174+
self.destroy()
175+
raise
185176

186177
def destroy(self):
187178
if self.cleanup:
@@ -199,7 +190,11 @@ def check_ready(self, timeout=30):
199190
started = 0
200191
while True:
201192
# get process status
202-
out = self.ctn.exec_run("supervisorctl status")
193+
res = self.ctn.exec_run("supervisorctl status")
194+
try:
195+
out = res.output
196+
except AttributeError:
197+
out = res
203198
for l in out.split('\n'):
204199
fds = re_space.split(l)
205200
if len(fds) < 2:
@@ -231,7 +226,14 @@ def init_asicdb_validator(self):
231226
self.asicdb = AsicDbValidator(self)
232227

233228
def runcmd(self, cmd):
234-
return self.ctn.exec_run(cmd)
229+
res = self.ctn.exec_run(cmd)
230+
try:
231+
exitcode = res.exit_code
232+
out = res.output
233+
except AttributeError:
234+
exitcode = 0
235+
out = res
236+
return (exitcode, out)
235237

236238
def copy_file(self, path, filename):
237239
tarstr = StringIO.StringIO()

0 commit comments

Comments
 (0)