Skip to content

Commit aa9e1e2

Browse files
committed
[vstest]: convert the tests to python3
Signed-off-by: Guohan Lu <[email protected]>
1 parent b3ae785 commit aa9e1e2

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

platform/vs/tests/bgp/test_gr_livelock.py

+21-21
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,30 @@
66
import random
77

88
def output(dvs, title):
9-
print "=========================== %s ===========================" % title
9+
print("=========================== %s ===========================" % title)
1010
exit_cod, sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"])
1111
exit_code, all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"])
1212
exit_code, neig_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1"])
1313
exit_code, announce_route_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1 advertised-routes"])
1414
exit_code, received_route_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1 routes"])
1515
exit_code, announce_route_3 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"])
1616
exit_code, received_route_3 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 routes"])
17-
print "Summary:"
18-
print sum_res
19-
print "Received routes:"
20-
print "10.0.0.1"
21-
print received_route_1
22-
print "10.0.0.3"
23-
print received_route_3
24-
print "Announces routes:"
25-
print "10.0.0.1"
26-
print announce_route_1
27-
print "10.0.0.3"
28-
print announce_route_3
29-
print "Neighbors"
30-
print "10.0.0.1"
31-
print neig_1
32-
print "======================================================"
17+
print("Summary:")
18+
print(sum_res)
19+
print("Received routes:")
20+
print("10.0.0.1")
21+
print(received_route_1)
22+
print("10.0.0.3")
23+
print(received_route_3)
24+
print("Announces routes:")
25+
print("10.0.0.1")
26+
print(announce_route_1)
27+
print("10.0.0.3")
28+
print(announce_route_3)
29+
print("Neighbors")
30+
print("10.0.0.1")
31+
print(neig_1)
32+
print("======================================================")
3333

3434
def mkdir(path):
3535
if not os.path.exists(path):
@@ -66,11 +66,11 @@ def run_exa(dvs, idx, cfg):
6666
remove(fifo_out_path)
6767
os.mkfifo(fifo_in_path)
6868
os.mkfifo(fifo_out_path)
69-
os.chmod(fifo_in_path, 0666)
70-
os.chmod(fifo_out_path, 0666)
71-
print "!!! Start exabgp instance %d" % idx
69+
os.chmod(fifo_in_path, 0o666)
70+
os.chmod(fifo_out_path, 0o666)
71+
print("!!! Start exabgp instance %d" % idx)
7272
cmd = "exabgp -d --env %s %s" % (get_target_env(idx), cfg)
73-
print "Cmd is ___ %s ___" % cmd
73+
print("Cmd is ___ %s ___" % cmd)
7474
return dvs.servers[idx].runcmd_async(cmd)
7575

7676
def run_exacli(dvs, idx, cmd):

platform/vs/tests/bgp/test_invalid_nexthop.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_InvalidNexthop(dvs, testlog):
1717

1818
time.sleep(5)
1919

20-
print dvs.runcmd("supervisorctl status")
20+
print(dvs.runcmd("supervisorctl status"))
2121

2222
p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/invalid_nexthop/invalid_nexthop.conf")
2323

@@ -28,6 +28,6 @@ def test_InvalidNexthop(dvs, testlog):
2828
p.terminate()
2929
p = p.wait()
3030

31-
print exit_code, output
31+
print(exit_code, output)
3232

3333
assert "3333::/64" in output

platform/vs/tests/bgp/test_no_export.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def test_bounce(dvs, testlog):
3636
p2.terminate()
3737
p2 = p2.wait()
3838

39-
print sum_res
40-
print announce_route
39+
print(sum_res)
40+
print(announce_route)
4141
assert "1.1.1.1/32" in all_route
4242
assert "1.1.1.1/32" not in announce_route
4343
assert "2.2.2.2/32" in all_route

0 commit comments

Comments
 (0)