[vstest]: convert the tests to python3
Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
parent
b3ae7858ca
commit
aa9e1e2f43
@ -6,7 +6,7 @@ import json
|
||||
import random
|
||||
|
||||
def output(dvs, title):
|
||||
print "=========================== %s ===========================" % title
|
||||
print("=========================== %s ===========================" % title)
|
||||
exit_cod, sum_res = dvs.runcmd(["vtysh", "-c", "show ip bgp sum"])
|
||||
exit_code, all_route = dvs.runcmd(["vtysh", "-c", "show ip bgp"])
|
||||
exit_code, neig_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1"])
|
||||
@ -14,22 +14,22 @@ def output(dvs, title):
|
||||
exit_code, received_route_1 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.1 routes"])
|
||||
exit_code, announce_route_3 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 advertised-routes"])
|
||||
exit_code, received_route_3 = dvs.runcmd(["vtysh", "-c", "show ip bgp neighbors 10.0.0.3 routes"])
|
||||
print "Summary:"
|
||||
print sum_res
|
||||
print "Received routes:"
|
||||
print "10.0.0.1"
|
||||
print received_route_1
|
||||
print "10.0.0.3"
|
||||
print received_route_3
|
||||
print "Announces routes:"
|
||||
print "10.0.0.1"
|
||||
print announce_route_1
|
||||
print "10.0.0.3"
|
||||
print announce_route_3
|
||||
print "Neighbors"
|
||||
print "10.0.0.1"
|
||||
print neig_1
|
||||
print "======================================================"
|
||||
print("Summary:")
|
||||
print(sum_res)
|
||||
print("Received routes:")
|
||||
print("10.0.0.1")
|
||||
print(received_route_1)
|
||||
print("10.0.0.3")
|
||||
print(received_route_3)
|
||||
print("Announces routes:")
|
||||
print("10.0.0.1")
|
||||
print(announce_route_1)
|
||||
print("10.0.0.3")
|
||||
print(announce_route_3)
|
||||
print("Neighbors")
|
||||
print("10.0.0.1")
|
||||
print(neig_1)
|
||||
print("======================================================")
|
||||
|
||||
def mkdir(path):
|
||||
if not os.path.exists(path):
|
||||
@ -66,11 +66,11 @@ def run_exa(dvs, idx, cfg):
|
||||
remove(fifo_out_path)
|
||||
os.mkfifo(fifo_in_path)
|
||||
os.mkfifo(fifo_out_path)
|
||||
os.chmod(fifo_in_path, 0666)
|
||||
os.chmod(fifo_out_path, 0666)
|
||||
print "!!! Start exabgp instance %d" % idx
|
||||
os.chmod(fifo_in_path, 0o666)
|
||||
os.chmod(fifo_out_path, 0o666)
|
||||
print("!!! Start exabgp instance %d" % idx)
|
||||
cmd = "exabgp -d --env %s %s" % (get_target_env(idx), cfg)
|
||||
print "Cmd is ___ %s ___" % cmd
|
||||
print("Cmd is ___ %s ___" % cmd)
|
||||
return dvs.servers[idx].runcmd_async(cmd)
|
||||
|
||||
def run_exacli(dvs, idx, cmd):
|
||||
|
@ -17,7 +17,7 @@ def test_InvalidNexthop(dvs, testlog):
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
print dvs.runcmd("supervisorctl status")
|
||||
print(dvs.runcmd("supervisorctl status"))
|
||||
|
||||
p = dvs.servers[0].runcmd_async("exabgp -d bgp/files/invalid_nexthop/invalid_nexthop.conf")
|
||||
|
||||
@ -28,6 +28,6 @@ def test_InvalidNexthop(dvs, testlog):
|
||||
p.terminate()
|
||||
p = p.wait()
|
||||
|
||||
print exit_code, output
|
||||
print(exit_code, output)
|
||||
|
||||
assert "3333::/64" in output
|
||||
|
@ -36,8 +36,8 @@ def test_bounce(dvs, testlog):
|
||||
p2.terminate()
|
||||
p2 = p2.wait()
|
||||
|
||||
print sum_res
|
||||
print announce_route
|
||||
print(sum_res)
|
||||
print(announce_route)
|
||||
assert "1.1.1.1/32" in all_route
|
||||
assert "1.1.1.1/32" not in announce_route
|
||||
assert "2.2.2.2/32" in all_route
|
||||
|
Reference in New Issue
Block a user