tcp_sack_twohosts_speed.test 5.4 KB

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