Skip to content

Commit

Permalink
[vs-test]: support python docker 3.5.0 (#1958)
Browse files Browse the repository at this point in the history
* [vs-test]: support python docker 3.5.0

Signed-off-by: Guohan Lu <[email protected]>
  • Loading branch information
lguohan authored Aug 21, 2018
1 parent 788b20e commit a01791e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 24 deletions.
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

0 comments on commit a01791e

Please sign in to comment.