diff --git a/platform/vs/tests/bgp/test_invalid_nexthop.py b/platform/vs/tests/bgp/test_invalid_nexthop.py index b6e7cfc86e5e..616f26df6e61 100644 --- a/platform/vs/tests/bgp/test_invalid_nexthop.py +++ b/platform/vs/tests/bgp/test_invalid_nexthop.py @@ -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 diff --git a/platform/vs/tests/bgp/test_no_export.py b/platform/vs/tests/bgp/test_no_export.py index 371d5f0b29ec..57f9bb322b01 100644 --- a/platform/vs/tests/bgp/test_no_export.py +++ b/platform/vs/tests/bgp/test_no_export.py @@ -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() diff --git a/platform/vs/tests/conftest.py b/platform/vs/tests/conftest.py index 48ad7e15661a..8acaed5e9062 100644 --- a/platform/vs/tests/conftest.py +++ b/platform/vs/tests/conftest.py @@ -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() @@ -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: @@ -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: @@ -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()