EtherMac_bus_speed.test 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. %description:
  2. Testing Ethernet communication on EtherBus with 10MBps.
  3. The network contains two 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 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 inet.linklayer.ethernet.EtherBus;
  15. import inet.node.ethernet.EtherHost;
  16. import ned.DatarateChannel;
  17. module EtherHostQ extends EtherHost
  18. {
  19. parameters:
  20. queueType = "DropTailQueue";
  21. }
  22. //
  23. // Sample Ethernet LAN: hosts connected via bus
  24. //
  25. network SpeedTest
  26. {
  27. types:
  28. channel C10 extends DatarateChannel
  29. {
  30. delay = 0.1us;
  31. datarate = 10Mbps;
  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=110,290");
  41. }
  42. host_2_H_A: EtherHostQ {
  43. parameters:
  44. @display("p=150,70");
  45. }
  46. host_2_H_B: EtherHostQ {
  47. parameters:
  48. @display("p=190,290");
  49. }
  50. host_3_H_A: EtherHostQ {
  51. parameters:
  52. @display("p=230,70");
  53. }
  54. host_3_H_B: EtherHostQ {
  55. parameters:
  56. @display("p=270,290");
  57. }
  58. host_4_H_A: EtherHostQ {
  59. parameters:
  60. @display("p=310,70");
  61. }
  62. host_4_H_B: EtherHostQ {
  63. parameters:
  64. @display("p=350,290");
  65. }
  66. host_5_H_A: EtherHostQ {
  67. parameters:
  68. @display("p=390,70");
  69. }
  70. host_5_H_B: EtherHostQ {
  71. parameters:
  72. @display("p=430,290");
  73. }
  74. bus: EtherBus {
  75. parameters:
  76. positions = "10 20 30 40 50 60 70 80 90 100";
  77. propagationSpeed = 2e8 mps; // 1us = 200m
  78. @display("p=250,180;b=400,6;o=#408060");
  79. gates:
  80. ethg[10];
  81. }
  82. connections:
  83. bus.ethg++ <--> C10 <--> host_1_H_A.ethg;
  84. bus.ethg++ <--> C10 <--> host_1_H_B.ethg;
  85. bus.ethg++ <--> C10 <--> host_2_H_A.ethg;
  86. bus.ethg++ <--> C10 <--> host_2_H_B.ethg;
  87. bus.ethg++ <--> C10 <--> host_3_H_A.ethg;
  88. bus.ethg++ <--> C10 <--> host_3_H_B.ethg;
  89. bus.ethg++ <--> C10 <--> host_4_H_A.ethg;
  90. bus.ethg++ <--> C10 <--> host_4_H_B.ethg;
  91. bus.ethg++ <--> C10 <--> host_5_H_A.ethg;
  92. bus.ethg++ <--> C10 <--> host_5_H_B.ethg;
  93. }
  94. %#--------------------------------------------------------------------------------------------------------------
  95. %inifile: omnetpp.ini
  96. [General]
  97. sim-time-limit = 5s
  98. tkenv-plugin-path = ../../../etc/plugins
  99. #record-eventlog = true
  100. **.vector-recording = false
  101. network = SpeedTest
  102. *.host_1_H_A.cli.destAddress = "host_1_H_B"
  103. *.host_1_H_B.cli.destAddress = "host_1_H_A"
  104. *.host_2_H_A.cli.destAddress = "host_2_H_B"
  105. *.host_2_H_B.cli.destAddress = "host_2_H_A"
  106. *.host_3_H_A.cli.destAddress = "host_3_H_B"
  107. *.host_3_H_B.cli.destAddress = "host_3_H_A"
  108. *.host_4_H_A.cli.destAddress = "host_4_H_B"
  109. *.host_4_H_B.cli.destAddress = "host_4_H_A"
  110. *.host_5_H_A.cli.destAddress = "host_5_H_B"
  111. *.host_5_H_B.cli.destAddress = "host_5_H_A"
  112. **.cli.reqLength = 1250B # 10.000 bit
  113. **.cli.respLength = 1250B # 10.000 bit
  114. *.host_*_*.cli.startTime = 0s
  115. *.host_*_H_*.mac.duplexMode = false
  116. *.host_*_H_*.cli.sendInterval = 1ms # 10.000 / speed [ / nodecount, when halfduplex]
  117. **.mac.address = "auto"
  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. %#--------------------------------------------------------------------------------------------------------------