tcp_nosack_twohosts_object_speed.test 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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+10s+20s+1.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. **.tcpApp[*].dataTransferMode = "object" # bytecount | object | bytestream
  105. # NIC configuration
  106. **.ppp[*].queueType = "DropTailQueue" # in routers
  107. #**.ppp[*].queue.frameCapacity = 10
  108. **.ppp[*].queue.frameCapacity = 47 # good:(13,15,16,18,19,21-25, 7) bad:(17,20)
  109. %#--------------------------------------------------------------------------------------------------------------
  110. %postrun-command: Rscript check.r
  111. %#--------------------------------------------------------------------------------------------------------------
  112. %file: check.r
  113. #!/usr/bin/env Rscript
  114. options(echo=FALSE)
  115. options(width=160)
  116. library("omnetpp", warn.conflicts=FALSE)
  117. #TEST parameters
  118. scafile <- 'results/General-#0.sca'
  119. linecount <- 2 * 2
  120. cliBytes <- 10000000
  121. srvBytes <- 2 * cliBytes
  122. # begin TEST:
  123. dataset <- loadDataset(scafile)
  124. cat("\nOMNETPP TEST RESULT:\n")
  125. cli <- dataset$scalars[grep("\\.client\\.tcpApp\\[\\d\\]$",dataset$scalars$module),]
  126. cliSent <- cli[cli$name == "bytesSent",]
  127. cliRcvd <- cli[cli$name == "bytesRcvd",]
  128. srv <- dataset$scalars[grep("\\.server\\.tcpApp\\[\\d\\]$",dataset$scalars$module),]
  129. srvSent <- srv[srv$name == "bytesSent",]
  130. srvRcvd <- srv[srv$name == "bytesRcvd",]
  131. cat("\nTCP SPEED TEST RESULT:\n")
  132. if(length(cliSent$value) == linecount & min(cliSent$value) == cliBytes)
  133. {
  134. cat("CLIENT SENT OK\n")
  135. } else {
  136. cat("CLIENT SENT BAD:\n")
  137. cliSent$rate = cliSent$value*100/cliBytes
  138. print(cliSent[cliSent$value != cliBytes,])
  139. }
  140. if(length(srvRcvd$value) == linecount & min(srvRcvd$value) == cliBytes)
  141. {
  142. cat("SERVER RCVD OK\n")
  143. } else {
  144. cat("SERVER RCVD BAD:\n")
  145. srvRcvd$rate = srvRcvd$value*100/cliBytes
  146. print(srvRcvd[srvRcvd$value != cliBytes,])
  147. }
  148. if(length(srvSent$value) == linecount & min(srvSent$value) == srvBytes)
  149. {
  150. cat("SERVER SENT OK\n")
  151. } else {
  152. cat("SERVER SENT BAD:\n")
  153. srvSent$rate = srvSent$value*100/srvBytes
  154. print(srvSent[srvSent$value != srvBytes,])
  155. }
  156. if(length(cliRcvd$value) == linecount & min(cliRcvd$value) == srvBytes)
  157. {
  158. cat("CLIENT RCVD OK\n")
  159. } else {
  160. cat("CLIENT RCVD BAD:\n")
  161. cliRcvd$rate = cliRcvd$value*100/srvBytes
  162. print(cliRcvd[cliRcvd$value != srvBytes,])
  163. }
  164. cat("\n")
  165. %#--------------------------------------------------------------------------------------------------------------
  166. %contains: postrun-command(1).out
  167. OMNETPP TEST RESULT:
  168. TCP SPEED TEST RESULT:
  169. CLIENT SENT OK
  170. SERVER RCVD OK
  171. SERVER SENT OK
  172. CLIENT RCVD OK
  173. %#--------------------------------------------------------------------------------------------------------------