EtherMac_fullduplex_twohosts_speed.test 4.7 KB

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