Guest User

rr_test.py

a guest
Apr 20th, 2017
70
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from lnst.Controller.Task import ctl
  2. m1 = ctl.get_host("machine1")
  3. m2 = ctl.get_host("machine2")
  4.  
  5. m1.sync_resources(modules=["Netperf"])
  6. m2.sync_resources(modules=["Netperf"])
  7.  
  8. m1_testiface = m1.get_interface("testiface")
  9.  
  10. netperf_duration = 3
  11.  
  12. # TCP_RR, UDP_RR, SCTP_RR, TCP_CRR
  13. stream_tests = []
  14. rr_tests = []
  15. for testname in ["TCP_STREAM", "UDP_STREAM", "SCTP_STREAM"]:
  16. stream_tests.append(ctl.get_module("Netperf",
  17. options={
  18. "role" : "client",
  19. "netperf_server" : m1_testiface.get_ip(0),
  20. "duration" : netperf_duration,
  21. "testname" : testname,
  22. "confidence" : "99,5"
  23. }))
  24.  
  25. for testname in ["TCP_RR", "TCP_CRR"]:
  26. rr_tests.append(ctl.get_module("Netperf",
  27. options={
  28. "role" : "client",
  29. "netperf_server" : m1_testiface.get_ip(0),
  30. "duration" : netperf_duration,
  31. "testname" : testname,
  32. "confidence" : "99,5"
  33. }))
  34.  
  35. netperf_srv = ctl.get_module("Netperf",
  36. options={
  37. "role" : "server",
  38. "bind" : m1_testiface.get_ip(0)
  39. })
  40.  
  41. srv_proc = m1.run(netperf_srv, bg=True)
  42. ctl.wait(2)
  43.  
  44. for test in stream_tests:
  45. m2.run(test, timeout = 120)
  46. for test in rr_tests:
  47. m2.run(test, timeout = 120)
  48.  
  49. srv_proc.intr()
RAW Paste Data