udp_twohosts_speed.test 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. %description:
  2. Testing TCP communication speed
  3. TCP
  4. TCP_NSC
  5. %#--------------------------------------------------------------------------------------------------------------
  6. %testprog: opp_run
  7. %#--------------------------------------------------------------------------------------------------------------
  8. %file: test.ned
  9. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  10. import inet.node.inet.StandardHost;
  11. import ned.DatarateChannel;
  12. network UdpClientServer
  13. {
  14. @display("bgb=232,193");
  15. types:
  16. channel C extends DatarateChannel
  17. {
  18. datarate = 10Mbps;
  19. delay = 0.1us;
  20. }
  21. submodules:
  22. host1: StandardHost {
  23. parameters:
  24. @display("p=53,67;i=device/pc3");
  25. }
  26. host2: StandardHost {
  27. parameters:
  28. @display("p=181,67;i=device/pc2");
  29. }
  30. host1snap: StandardHost {
  31. parameters:
  32. @display("p=53,67;i=device/pc3");
  33. }
  34. host2snap: StandardHost {
  35. parameters:
  36. @display("p=181,67;i=device/pc2");
  37. }
  38. configurator: IPv4NetworkConfigurator {
  39. parameters:
  40. @display("p=109,142");
  41. }
  42. connections:
  43. host1.ethg++ <--> C <--> host2.ethg++;
  44. host1snap.ethg++ <--> C <--> host2snap.ethg++;
  45. }
  46. %#--------------------------------------------------------------------------------------------------------------
  47. %inifile: omnetpp.ini
  48. [General]
  49. network = UdpClientServer
  50. total-stack = 7MiB
  51. tkenv-plugin-path = ../../../etc/plugins
  52. #debug-on-errors = true
  53. #record-eventlog = true
  54. #**.vector-recording = false
  55. sim-time-limit = 20s
  56. ## UDP apps
  57. **.numUdpApps = 2
  58. **.udpApp[0].typename = "UDPBasicApp"
  59. **.udpApp[0].destPort = 1234
  60. #**.udpApp[0].sendInterval = 2ms
  61. #**.udpApp[0].stopTime = 20s
  62. **.host*snap.udpApp[0].sendInterval = 1.719ms #etherframe with snap and gap: 1074 bytes, 2 packets (sent, echoed): 1074*8/10000000*2 = 17.184ms
  63. **.host*snap.udpApp[0].stopTime = 17.19s
  64. **.udpApp[0].sendInterval = 1.706ms #etherframe and gap: 1066 bytes, 2 packets (sent, echoed): 1066*8/10000000*2 = 17.056ms
  65. **.udpApp[0].startTime = 0s
  66. **.udpApp[0].stopTime = 17.06s
  67. **.host1.udpApp[0].destAddresses = "host2"
  68. **.host2.udpApp[0].destAddresses = "host1"
  69. **.host1snap.udpApp[0].destAddresses = "host2snap"
  70. **.host2snap.udpApp[0].destAddresses = "host1snap"
  71. **.udpApp[0].messageLength = 1000 bytes
  72. **.udpApp[1].typename = "UDPEchoApp"
  73. **.udpApp[1].localPort = 1234
  74. **.host*snap.eth[*].useSNAP = true
  75. **.host*.eth[*].queue.frameCapacity = 1
  76. # ARP
  77. **.arpType = "GlobalARP"
  78. %#--------------------------------------------------------------------------------------------------------------
  79. %postrun-command: Rscript check.r
  80. %#--------------------------------------------------------------------------------------------------------------
  81. %file: check.r
  82. #!/usr/bin/env Rscript
  83. options(echo=FALSE)
  84. options(width=160)
  85. library("omnetpp", warn.conflicts=FALSE)
  86. #TEST parameters
  87. scafile <- 'results/General-#0.sca'
  88. linecount <- 4
  89. sentPk <- 10000
  90. echoedPk <- 10000
  91. # begin TEST:
  92. dataset <- loadDataset(scafile)
  93. cat("\nOMNETPP TEST RESULT:\n")
  94. udpApp <- dataset$scalars[grep("\\.host\\d\\w*\\.udpApp\\[\\d\\]$",dataset$scalars$module),]
  95. udpSent <- udpApp[udpApp$name == "sentPk:count",]
  96. udpRcvd <- udpApp[udpApp$name == "echoedPk:count",]
  97. cat(" UDP SPEED TEST RESULT:\n")
  98. #print(udpSent)
  99. cat(" UDP SENT ")
  100. if(length(udpSent$value) == linecount & min(udpSent$value) >= sentPk)
  101. {
  102. cat("OK\n")
  103. } else {
  104. cat("BAD:\n")
  105. udpSent$rate = udpSent$value*100/sentPk
  106. print(udpSent[udpSent$value < sentPk,])
  107. }
  108. #print(udpRcvd)
  109. cat(" UDP RCVD ")
  110. if(length(udpRcvd$value) == linecount & min(udpRcvd$value) >= echoedPk)
  111. {
  112. cat("OK\n")
  113. } else {
  114. cat("BAD:\n")
  115. udpRcvd$rate = udpRcvd$value*100/sentPk
  116. print(udpRcvd[udpRcvd$value < echoedPk,])
  117. }
  118. cat("\n")
  119. %#--------------------------------------------------------------------------------------------------------------
  120. %contains: postrun-command(1).out
  121. OMNETPP TEST RESULT:
  122. UDP SPEED TEST RESULT:
  123. UDP SENT OK
  124. UDP RCVD OK
  125. %#--------------------------------------------------------------------------------------------------------------