EtherMac_hub_reconnect_speed.test 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. %description:
  2. Testing Ethernet communication on EtherHub with 100MBps, with disconnecting and reconnecting some hosts.
  3. Simulation has 5 pairs of hosts that communicate with each other.
  4. All hosts use EtherMAC implementation with half duplex mode.
  5. All hosts have same ethernet configurations.
  6. All hosts send requests and also reply to requests sent to them.
  7. checks:
  8. - the idle state of rx is less than or equals to 6.5% in all hosts
  9. - the utilization state of rx is more than or equals to 93% in all hosts
  10. %#--------------------------------------------------------------------------------------------------------------
  11. %testprog: opp_run
  12. %#--------------------------------------------------------------------------------------------------------------
  13. %file: test.ned
  14. import inet.linklayer.ethernet.EtherHub;
  15. import inet.node.ethernet.EtherHost;
  16. import inet.common.scenario.ScenarioManager;
  17. import ned.DatarateChannel;
  18. module EtherHostQ extends EtherHost
  19. {
  20. parameters:
  21. queueType = "DropTailQueue";
  22. }
  23. //
  24. // Sample Ethernet LAN: hosts connected via hub
  25. //
  26. network SpeedTest
  27. {
  28. types:
  29. channel C100 extends DatarateChannel
  30. {
  31. delay = 0.1us;
  32. datarate = 100Mbps;
  33. }
  34. submodules:
  35. host_1_H_A: EtherHostQ {
  36. parameters:
  37. @display("p=70,70");
  38. }
  39. host_1_H_B: EtherHostQ {
  40. parameters:
  41. @display("p=210,70");
  42. }
  43. host_2_H_A: EtherHostQ {
  44. parameters:
  45. @display("p=70,140");
  46. }
  47. host_2_H_B: EtherHostQ {
  48. parameters:
  49. @display("p=210,140");
  50. }
  51. host_3_H_A: EtherHostQ {
  52. parameters:
  53. @display("p=70,210");
  54. }
  55. host_3_H_B: EtherHostQ {
  56. parameters:
  57. @display("p=210,210");
  58. }
  59. host_4_H_A: EtherHostQ {
  60. parameters:
  61. @display("p=70,280");
  62. }
  63. host_4_H_B: EtherHostQ {
  64. parameters:
  65. @display("p=210,280");
  66. }
  67. host_5_H_A: EtherHostQ {
  68. parameters:
  69. @display("p=70,350");
  70. }
  71. host_5_H_B: EtherHostQ {
  72. parameters:
  73. @display("p=210,350");
  74. }
  75. hub: EtherHub {
  76. parameters:
  77. @display("p=140,210");
  78. gates:
  79. ethg[10];
  80. }
  81. scenarioManager: ScenarioManager {
  82. @display("p=184,180");
  83. }
  84. connections:
  85. hub.ethg++ <--> C100 <--> host_1_H_A.ethg;
  86. hub.ethg++ <--> C100 <--> host_1_H_B.ethg;
  87. hub.ethg++ <--> C100 <--> host_2_H_A.ethg;
  88. hub.ethg++ <--> C100 <--> host_2_H_B.ethg;
  89. hub.ethg++ <--> C100 <--> host_3_H_A.ethg;
  90. hub.ethg++ <--> C100 <--> host_3_H_B.ethg;
  91. hub.ethg++ <--> C100 <--> host_4_H_A.ethg;
  92. hub.ethg++ <--> C100 <--> host_4_H_B.ethg;
  93. hub.ethg++ <--> C100 <--> host_5_H_A.ethg;
  94. hub.ethg++ <--> C100 <--> host_5_H_B.ethg;
  95. }
  96. %#--------------------------------------------------------------------------------------------------------------
  97. %file: scenario.xml
  98. <!-- This file is used by the ScenarioManager. -->
  99. <scenario>
  100. <at t="1.4">
  101. <disconnect src-module="host_1_H_A" src-gate="ethg$o" />
  102. <disconnect src-module="hub" src-gate="ethg$o[0]" />
  103. </at>
  104. <at t="1.5">
  105. <connect src-module="host_1_H_A" src-gate="ethg"
  106. dest-module="hub" dest-gate="ethg[0]"
  107. channel-type="ned.DatarateChannel">
  108. <param name="datarate" value="100Mbps" />
  109. <param name="delay" value="0.1us" />
  110. </connect>
  111. </at>
  112. <at t="1.6">
  113. <disconnect src-module="host_3_H_A" src-gate="ethg$o" />
  114. <disconnect src-module="hub" src-gate="ethg$o[4]" />
  115. </at>
  116. <at t="1.7">
  117. <connect src-module="host_3_H_A" src-gate="ethg"
  118. dest-module="hub" dest-gate="ethg[4]"
  119. channel-type="ned.DatarateChannel">
  120. <param name="datarate" value="100Mbps" />
  121. <param name="delay" value="0.1us" />
  122. </connect>
  123. </at>
  124. <at t="1.8">
  125. <disconnect src-module="host_5_H_B" src-gate="ethg$o" />
  126. <disconnect src-module="hub" src-gate="ethg$o[9]" />
  127. </at>
  128. <at t="1.9">
  129. <connect src-module="host_5_H_B" src-gate="ethg"
  130. dest-module="hub" dest-gate="ethg[9]"
  131. channel-type="ned.DatarateChannel">
  132. <param name="datarate" value="100Mbps" />
  133. <param name="delay" value="0.1us" />
  134. </connect>
  135. </at>
  136. <at t="3.4">
  137. <disconnect src-module="host_1_H_A" src-gate="ethg$o" />
  138. <disconnect src-module="hub" src-gate="ethg$o[0]" />
  139. </at>
  140. <at t="3.5">
  141. <connect src-module="host_1_H_A" src-gate="ethg"
  142. dest-module="hub" dest-gate="ethg[0]"
  143. channel-type="ned.DatarateChannel">
  144. <param name="datarate" value="100Mbps" />
  145. <param name="delay" value="0.1us" />
  146. </connect>
  147. </at>
  148. <at t="3.6">
  149. <disconnect src-module="host_3_H_A" src-gate="ethg$o" />
  150. <disconnect src-module="hub" src-gate="ethg$o[4]" />
  151. </at>
  152. <at t="3.7">
  153. <connect src-module="host_3_H_A" src-gate="ethg"
  154. dest-module="hub" dest-gate="ethg[4]"
  155. channel-type="ned.DatarateChannel">
  156. <param name="datarate" value="100Mbps" />
  157. <param name="delay" value="0.1us" />
  158. </connect>
  159. </at>
  160. <at t="3.8">
  161. <disconnect src-module="host_5_H_B" src-gate="ethg$o" />
  162. <disconnect src-module="hub" src-gate="ethg$o[9]" />
  163. </at>
  164. <at t="3.9">
  165. <connect src-module="host_5_H_B" src-gate="ethg"
  166. dest-module="hub" dest-gate="ethg[9]"
  167. channel-type="ned.DatarateChannel">
  168. <param name="datarate" value="100Mbps" />
  169. <param name="delay" value="0.1us" />
  170. </connect>
  171. </at>
  172. </scenario>
  173. %#--------------------------------------------------------------------------------------------------------------
  174. %inifile: omnetpp.ini
  175. [General]
  176. sim-time-limit = 5.2s
  177. tkenv-plugin-path = ../../../etc/plugins
  178. #record-eventlog = true
  179. **.vector-recording = false
  180. network = SpeedTest
  181. **.scenarioManager.script = xmldoc("scenario.xml")
  182. *.host_1_H_A.cli.destAddress = "host_1_H_B"
  183. *.host_1_H_B.cli.destAddress = "host_1_H_A"
  184. *.host_2_H_A.cli.destAddress = "host_2_H_B"
  185. *.host_2_H_B.cli.destAddress = "host_2_H_A"
  186. *.host_3_H_A.cli.destAddress = "host_3_H_B"
  187. *.host_3_H_B.cli.destAddress = "host_3_H_A"
  188. *.host_4_H_A.cli.destAddress = "host_4_H_B"
  189. *.host_4_H_B.cli.destAddress = "host_4_H_A"
  190. *.host_5_H_A.cli.destAddress = "host_5_H_B"
  191. *.host_5_H_B.cli.destAddress = "host_5_H_A"
  192. **.cli.reqLength = 1250B # 10.000 bit
  193. **.cli.respLength = 1250B # 10.000 bit
  194. *.host_*_*.cli.startTime = 0s
  195. *.host_*_H_*.mac.duplexMode = false
  196. *.host_*_H_*.cli.sendInterval = 0.1ms # 10.000 / speed [ / nodecount, when halfduplex]
  197. **.mac.address = "auto"
  198. # Check: "rx channel idle (%)" <= 4.0
  199. # Check: "rx channel utilization (%)" >= 96.0
  200. %#--------------------------------------------------------------------------------------------------------------
  201. %postrun-command: Rscript check.r
  202. %#--------------------------------------------------------------------------------------------------------------
  203. %file: check.r
  204. #!/usr/bin/env Rscript
  205. options(echo=FALSE)
  206. options(width=160)
  207. library("omnetpp", warn.conflicts=FALSE)
  208. #TEST parameters
  209. scafile <- 'results/General-#0.sca'
  210. linecount <- 10
  211. idlelimit <- 6.5
  212. usedlimit <- 93.0
  213. # begin TEST:
  214. idle <- loadDataset(scafile, add(type='scalar', select='name("rx channel idle *")'))
  215. used <- loadDataset(scafile, add(type='scalar', select='name("rx channel utilization *")'))
  216. cat("\nOMNETPP TEST RESULT: ")
  217. if(length(idle$scalars$value) == linecount & max(idle$scalars$value) <= idlelimit)
  218. {
  219. cat("IDLE OK\n")
  220. } else {
  221. cat("IDLE BAD:\n")
  222. print(idle$scalars[idle$scalars$value > idlelimit,])
  223. }
  224. cat("\nOMNETPP TEST RESULT: ")
  225. if(length(used$scalars$value) == linecount & min(used$scalars$value) >= usedlimit)
  226. {
  227. cat("USED OK\n")
  228. } else {
  229. cat("USED BAD:\n")
  230. print(used$scalars[used$scalars$value < usedlimit,])
  231. }
  232. cat("\n")
  233. %#--------------------------------------------------------------------------------------------------------------
  234. %contains: postrun-command(1).out
  235. OMNETPP TEST RESULT: IDLE OK
  236. OMNETPP TEST RESULT: USED OK
  237. %#--------------------------------------------------------------------------------------------------------------