EtherMac_hub_speed.test 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. %description:
  2. Testing Ethernet communication on EtherHub with 100MBps.
  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 responses to requests for its pair, too.
  7. checks:
  8. - the idle state of rx is less than or equals to 4% in all hosts
  9. - the utilization state of rx is more than or equals to 96% in all hosts
  10. %#--------------------------------------------------------------------------------------------------------------
  11. %testprog: opp_run
  12. %#--------------------------------------------------------------------------------------------------------------
  13. %file: test.ned
  14. import ned.DatarateChannel;
  15. import inet.node.ethernet.EtherHost;
  16. import inet.linklayer.ethernet.EtherHub;
  17. module EtherHostQ extends EtherHost
  18. {
  19. parameters:
  20. queueType = "DropTailQueue";
  21. }
  22. //
  23. // Sample Ethernet LAN: hosts connected via hub
  24. //
  25. network SpeedTest
  26. {
  27. types:
  28. channel C100 extends DatarateChannel
  29. {
  30. delay = 0s;
  31. datarate = 100Mbps;
  32. }
  33. submodules:
  34. host_1_H_A: EtherHostQ {
  35. parameters:
  36. @display("p=70,70");
  37. }
  38. host_1_H_B: EtherHostQ {
  39. parameters:
  40. @display("p=210,70");
  41. }
  42. host_2_H_A: EtherHostQ {
  43. parameters:
  44. @display("p=70,140");
  45. }
  46. host_2_H_B: EtherHostQ {
  47. parameters:
  48. @display("p=210,140");
  49. }
  50. host_3_H_A: EtherHostQ {
  51. parameters:
  52. @display("p=70,210");
  53. }
  54. host_3_H_B: EtherHostQ {
  55. parameters:
  56. @display("p=210,210");
  57. }
  58. host_4_H_A: EtherHostQ {
  59. parameters:
  60. @display("p=70,280");
  61. }
  62. host_4_H_B: EtherHostQ {
  63. parameters:
  64. @display("p=210,280");
  65. }
  66. host_5_H_A: EtherHostQ {
  67. parameters:
  68. @display("p=70,350");
  69. }
  70. host_5_H_B: EtherHostQ {
  71. parameters:
  72. @display("p=210,350");
  73. }
  74. hub: EtherHub {
  75. parameters:
  76. @display("p=140,210");
  77. gates:
  78. ethg[10];
  79. }
  80. connections:
  81. hub.ethg++ <--> C100 <--> host_1_H_A.ethg;
  82. hub.ethg++ <--> C100 <--> host_1_H_B.ethg;
  83. hub.ethg++ <--> C100 <--> host_2_H_A.ethg;
  84. hub.ethg++ <--> C100 <--> host_2_H_B.ethg;
  85. hub.ethg++ <--> C100 <--> host_3_H_A.ethg;
  86. hub.ethg++ <--> C100 <--> host_3_H_B.ethg;
  87. hub.ethg++ <--> C100 <--> host_4_H_A.ethg;
  88. hub.ethg++ <--> C100 <--> host_4_H_B.ethg;
  89. hub.ethg++ <--> C100 <--> host_5_H_A.ethg;
  90. hub.ethg++ <--> C100 <--> host_5_H_B.ethg;
  91. }
  92. %#--------------------------------------------------------------------------------------------------------------
  93. %inifile: omnetpp.ini
  94. [General]
  95. sim-time-limit = 5s
  96. tkenv-plugin-path = ../../../etc/plugins
  97. #record-eventlog = true
  98. **.vector-recording = false
  99. network = SpeedTest
  100. *.host_1_H_A.cli.destAddress = "host_1_H_B"
  101. *.host_1_H_B.cli.destAddress = "host_1_H_A"
  102. *.host_2_H_A.cli.destAddress = "host_2_H_B"
  103. *.host_2_H_B.cli.destAddress = "host_2_H_A"
  104. *.host_3_H_A.cli.destAddress = "host_3_H_B"
  105. *.host_3_H_B.cli.destAddress = "host_3_H_A"
  106. *.host_4_H_A.cli.destAddress = "host_4_H_B"
  107. *.host_4_H_B.cli.destAddress = "host_4_H_A"
  108. *.host_5_H_A.cli.destAddress = "host_5_H_B"
  109. *.host_5_H_B.cli.destAddress = "host_5_H_A"
  110. **.cli.reqLength = 1250B # 10.000 bit
  111. **.cli.respLength = 1250B # 10.000 bit
  112. *.host_*_*.cli.startTime = 0s
  113. *.host_*_H_*.mac.duplexMode = false
  114. *.host_*_H_*.cli.sendInterval = 0.1ms # 10.000 / speed [ / nodecount when halfduplex]
  115. **.mac.address = "auto"
  116. # Check: "rx channel idle (%)" <= 4.0
  117. # Check: "rx channel utilization (%)" >= 96.0
  118. %#--------------------------------------------------------------------------------------------------------------
  119. %postrun-command: Rscript check.r
  120. %#--------------------------------------------------------------------------------------------------------------
  121. %file: check.r
  122. #!/usr/bin/env Rscript
  123. options(echo=FALSE)
  124. options(width=160)
  125. library("omnetpp", warn.conflicts=FALSE)
  126. #TEST parameters
  127. scafile <- 'results/General-#0.sca'
  128. linecount <- 10
  129. idlelimit <- 4.0
  130. usedlimit <- 96.0
  131. # begin TEST:
  132. idle <- loadDataset(scafile, add(type='scalar', select='name("rx channel idle *")'))
  133. used <- loadDataset(scafile, add(type='scalar', select='name("rx channel utilization *")'))
  134. cat("\nOMNETPP TEST RESULT: ")
  135. if(length(idle$scalars$value) == linecount & max(idle$scalars$value) <= idlelimit)
  136. {
  137. cat("IDLE OK\n")
  138. } else {
  139. cat("IDLE BAD:\n")
  140. print(idle$scalars[idle$scalars$value > idlelimit,])
  141. }
  142. cat("\nOMNETPP TEST RESULT: ")
  143. if(length(used$scalars$value) == linecount & min(used$scalars$value) >= usedlimit)
  144. {
  145. cat("USED OK\n")
  146. } else {
  147. cat("USED BAD:\n")
  148. print(used$scalars[used$scalars$value < usedlimit,])
  149. }
  150. cat("\n")
  151. %#--------------------------------------------------------------------------------------------------------------
  152. %contains: postrun-command(1).out
  153. OMNETPP TEST RESULT: IDLE OK
  154. OMNETPP TEST RESULT: USED OK
  155. %#--------------------------------------------------------------------------------------------------------------