tcp_nosack_twohosts_speed.test 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. %description:
  2. Testing TCP communication speed
  3. TCP
  4. TCP_NSC
  5. %#--------------------------------------------------------------------------------------------------------------
  6. %testprog: opp_run
  7. %#--------------------------------------------------------------------------------------------------------------
  8. %file: test.ned
  9. import ned.DatarateChannel;
  10. import inet.node.inet.StandardHost;
  11. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  12. channel C extends DatarateChannel
  13. {
  14. delay = 0.01us; // ~ 2m
  15. datarate = 10Mbps;
  16. }
  17. module SubTest
  18. {
  19. parameters:
  20. string cliTcpType = default("n/a");
  21. string srvTcpType = default("n/a");
  22. submodules:
  23. server: StandardHost {
  24. parameters:
  25. numTcpApps = 1;
  26. tcpType = srvTcpType;
  27. }
  28. client: StandardHost {
  29. parameters:
  30. numTcpApps = 1;
  31. tcpType = cliTcpType;
  32. tcpApp[0].connectAddress = substringBeforeLast(fullPath(),".client") + ".server";
  33. }
  34. connections:
  35. server.pppg++ <--> C <--> client.pppg++;
  36. }
  37. module STest
  38. {
  39. parameters:
  40. string srvTcpType = default("n/a");
  41. submodules:
  42. clients_INET: SubTest {
  43. parameters:
  44. srvTcpType = srvTcpType;
  45. cliTcpType = "TCP";
  46. }
  47. clients_NSC: SubTest {
  48. parameters:
  49. srvTcpType = srvTcpType;
  50. cliTcpType = "TCP_NSC";
  51. }
  52. clients_LWIP: SubTest {
  53. parameters:
  54. srvTcpType = srvTcpType;
  55. cliTcpType = "TCP_lwIP";
  56. }
  57. }
  58. network TcpSpeedTest
  59. {
  60. submodules:
  61. server_INET: STest {
  62. parameters:
  63. srvTcpType = "TCP";
  64. }
  65. server_NSC: STest {
  66. parameters:
  67. srvTcpType = "TCP_NSC";
  68. }
  69. server_LWIP: STest {
  70. parameters:
  71. srvTcpType = "TCP_lwIP";
  72. }
  73. configurator: IPv4NetworkConfigurator {
  74. @display("p=70,40");
  75. }
  76. }
  77. %#--------------------------------------------------------------------------------------------------------------
  78. %inifile: omnetpp.ini
  79. [General]
  80. network = TcpSpeedTest
  81. total-stack = 7MiB
  82. tkenv-plugin-path = ../../../etc/plugins
  83. #debug-on-errors = true
  84. #record-eventlog = true
  85. **.vector-recording = false
  86. #sim-time-limit = 2s+20s
  87. sim-time-limit = 2s+20s+4.2s
  88. **.server*.tcpApp[0].typename = "TCPEchoApp"
  89. **.client*.tcpApp[0].typename = "TCPSessionApp"
  90. #client app:
  91. **.client*.tcpApp[0].active = true
  92. **.client*.tcpApp[0].localPort = -1
  93. **.client*.tcpApp[0].connectPort = 1000
  94. **.client*.tcpApp[0].tOpen = 1s
  95. **.client*.tcpApp[0].tSend = 2s
  96. **.client*.tcpApp[0].sendBytes = 10000000B
  97. **.client*.tcpApp[0].sendScript = ""
  98. **.client*.tcpApp[0].tClose = 100s
  99. #server app:
  100. **.server*.tcpApp[0].localPort = 1000
  101. **.server*.tcpApp[0].echoFactor = 2.0
  102. **.server*.tcpApp[0].echoDelay = 0
  103. ## tcp apps
  104. # NIC configuration
  105. **.ppp[*].queueType = "DropTailQueue" # in routers
  106. #**.ppp[*].queue.frameCapacity = 10
  107. **.ppp[*].queue.frameCapacity = 47 # good:(13,15,16,18,19,21-25, 7) bad:(17,20)
  108. %#--------------------------------------------------------------------------------------------------------------
  109. %postrun-command: Rscript check.r
  110. %#--------------------------------------------------------------------------------------------------------------
  111. %file: check.r
  112. #!/usr/bin/env Rscript
  113. options(echo=FALSE)
  114. options(width=160)
  115. library("omnetpp", warn.conflicts=FALSE)
  116. #TEST parameters
  117. scafile <- 'results/General-#0.sca'
  118. linecount <- 3 * 3
  119. cliBytes <- 10000000
  120. srvBytes <- 2 * cliBytes
  121. # begin TEST:
  122. dataset <- loadDataset(scafile)
  123. cat("\nOMNETPP TEST RESULT:\n")
  124. cli <- dataset$scalars[grep("\\.client\\.tcpApp\\[\\d\\]$",dataset$scalars$module),]
  125. cliSent <- cli[cli$name == "bytesSent",]
  126. cliRcvd <- cli[cli$name == "bytesRcvd",]
  127. srv <- dataset$scalars[grep("\\.server\\.tcpApp\\[\\d\\]$",dataset$scalars$module),]
  128. srvSent <- srv[srv$name == "bytesSent",]
  129. srvRcvd <- srv[srv$name == "bytesRcvd",]
  130. cat("\nTCP SPEED TEST RESULT:\n")
  131. if(length(cliSent$value) == linecount & min(cliSent$value) == cliBytes)
  132. {
  133. cat("CLIENT SENT OK\n")
  134. } else {
  135. cat("CLIENT SENT BAD:\n")
  136. cliSent$rate = cliSent$value*100/cliBytes
  137. print(cliSent[cliSent$value != cliBytes,])
  138. }
  139. if(length(srvRcvd$value) == linecount & min(srvRcvd$value) == cliBytes)
  140. {
  141. cat("SERVER RCVD OK\n")
  142. } else {
  143. cat("SERVER RCVD BAD:\n")
  144. srvRcvd$rate = srvRcvd$value*100/cliBytes
  145. print(srvRcvd[srvRcvd$value != cliBytes,])
  146. }
  147. if(length(srvSent$value) == linecount & min(srvSent$value) == srvBytes)
  148. {
  149. cat("SERVER SENT OK\n")
  150. } else {
  151. cat("SERVER SENT BAD:\n")
  152. srvSent$rate = srvSent$value*100/srvBytes
  153. print(srvSent[srvSent$value != srvBytes,])
  154. }
  155. if(length(cliRcvd$value) == linecount & min(cliRcvd$value) == srvBytes)
  156. {
  157. cat("CLIENT RCVD OK\n")
  158. } else {
  159. cat("CLIENT RCVD BAD:\n")
  160. cliRcvd$rate = cliRcvd$value*100/srvBytes
  161. print(cliRcvd[cliRcvd$value != srvBytes,])
  162. }
  163. cat("\n")
  164. %#--------------------------------------------------------------------------------------------------------------
  165. %contains: postrun-command(1).out
  166. OMNETPP TEST RESULT:
  167. TCP SPEED TEST RESULT:
  168. CLIENT SENT OK
  169. SERVER RCVD OK
  170. SERVER SENT OK
  171. CLIENT RCVD OK
  172. %#--------------------------------------------------------------------------------------------------------------