EtherMac_switch_speed.test 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. %description:
  2. Tests Ethernet communication via switch.
  3. All hosts use EtherMAC implementation with external queue.
  4. Simulation has pairs of hosts that communicate with each other via only one switch.
  5. Both hosts in pair have same ethernet configurations.
  6. Both hosts in pair are source and sink, too.
  7. variations:
  8. - speed: 10Mbps / 100Mbps / 1000Mbps
  9. checks:
  10. - the idle state of rx is less than or equals to 2% in all hosts
  11. - the utilization state of rx is more than or equals to 98% in all hosts
  12. %#--------------------------------------------------------------------------------------------------------------
  13. %testprog: opp_run
  14. %#--------------------------------------------------------------------------------------------------------------
  15. %file: test.ned
  16. import ned.DatarateChannel;
  17. import inet.node.ethernet.EtherHost;
  18. import inet.node.ethernet.EtherSwitch;
  19. module EtherHostQ extends EtherHost
  20. {
  21. parameters:
  22. queueType = "DropTailQueue";
  23. }
  24. //
  25. // Sample Ethernet LAN: hosts connected in pairs
  26. //
  27. network SpeedTest
  28. {
  29. types:
  30. channel C10 extends DatarateChannel
  31. {
  32. delay = 0s;
  33. datarate = 10Mbps;
  34. }
  35. channel C100 extends DatarateChannel
  36. {
  37. delay = 0s;
  38. datarate = 100Mbps;
  39. }
  40. channel C1000 extends DatarateChannel
  41. {
  42. delay = 0s;
  43. datarate = 1000Mbps;
  44. }
  45. submodules:
  46. host_10_F_A: EtherHostQ {
  47. parameters:
  48. @display("p=70,70");
  49. }
  50. host_10_F_B: EtherHostQ {
  51. parameters:
  52. @display("p=210,70");
  53. }
  54. host_100_F_A: EtherHostQ {
  55. parameters:
  56. @display("p=70,140");
  57. }
  58. host_100_F_B: EtherHostQ {
  59. parameters:
  60. @display("p=210,140");
  61. }
  62. host_1000_F_A: EtherHostQ {
  63. parameters:
  64. @display("p=70,210");
  65. }
  66. host_1000_F_B: EtherHostQ {
  67. parameters:
  68. @display("p=210,210");
  69. }
  70. switch: EtherSwitch {
  71. parameters:
  72. @display("p=140,140");
  73. gates:
  74. ethg[6];
  75. }
  76. connections:
  77. switch.ethg[0] <--> C10 <--> host_10_F_A.ethg;
  78. switch.ethg[1] <--> C10 <--> host_10_F_B.ethg;
  79. switch.ethg[2] <--> C100 <--> host_100_F_A.ethg;
  80. switch.ethg[3] <--> C100 <--> host_100_F_B.ethg;
  81. switch.ethg[4] <--> C1000 <--> host_1000_F_A.ethg;
  82. switch.ethg[5] <--> C1000 <--> host_1000_F_B.ethg;
  83. }
  84. %#--------------------------------------------------------------------------------------------------------------
  85. %inifile: omnetpp.ini
  86. [General]
  87. sim-time-limit = 5s
  88. tkenv-plugin-path = ../../../etc/plugins
  89. #record-eventlog = true
  90. **.vector-recording = false
  91. network = SpeedTest
  92. *.host_10_F_A.cli.destAddress = "host_10_F_B"
  93. *.host_10_F_B.cli.destAddress = "host_10_F_A"
  94. *.host_100_F_A.cli.destAddress = "host_100_F_B"
  95. *.host_100_F_B.cli.destAddress = "host_100_F_A"
  96. *.host_1000_F_A.cli.destAddress = "host_1000_F_B"
  97. *.host_1000_F_B.cli.destAddress = "host_1000_F_A"
  98. **.cli.reqLength = 1250B # 10.000 bit
  99. **.cli.respLength = 1250B # 10.000 bit
  100. *.host_*_*.cli.startTime = 0s
  101. *.host_*_F_*.mac.duplexMode = true
  102. *.host_1000_F_*.cli.sendInterval = 0.005ms # 10.000 / speed [ / 2 when halfduplex]
  103. *.host_100_F_*.cli.sendInterval = 0.05ms # 10.000 / speed [ / 2 when halfduplex]
  104. *.host_10_F_*.cli.sendInterval = 0.5ms # 10.000 / speed [ / 2 when halfduplex]
  105. **.mac.address = "auto"
  106. %#--------------------------------------------------------------------------------------------------------------
  107. %postrun-command: Rscript check.r
  108. %#--------------------------------------------------------------------------------------------------------------
  109. %file: check.r
  110. #!/usr/bin/env Rscript
  111. options(echo=FALSE)
  112. options(width=160)
  113. library("omnetpp", warn.conflicts=FALSE)
  114. #TEST parameters
  115. scafile <- 'results/General-#0.sca'
  116. linecount <- 12
  117. idlelimit <- 2.0
  118. usedlimit <- 98.0
  119. # begin TEST:
  120. idle <- loadDataset(scafile, add(type='scalar', select='name("rx channel idle *")'))
  121. used <- loadDataset(scafile, add(type='scalar', select='name("rx channel utilization *")'))
  122. cat("\nOMNETPP TEST RESULT: ")
  123. if(length(idle$scalars$value) == linecount & max(idle$scalars$value) <= idlelimit)
  124. {
  125. cat("IDLE OK\n")
  126. } else {
  127. cat("IDLE BAD:\n")
  128. print(idle$scalars[idle$scalars$value > idlelimit,])
  129. }
  130. cat("\nOMNETPP TEST RESULT: ")
  131. if(length(used$scalars$value) == linecount & min(used$scalars$value) >= usedlimit)
  132. {
  133. cat("USED OK\n")
  134. } else {
  135. cat("USED BAD:\n")
  136. print(used$scalars[used$scalars$value < usedlimit,])
  137. }
  138. cat("\n")
  139. %#--------------------------------------------------------------------------------------------------------------
  140. %contains: postrun-command(1).out
  141. OMNETPP TEST RESULT: IDLE OK
  142. OMNETPP TEST RESULT: USED OK
  143. %#--------------------------------------------------------------------------------------------------------------