EtherMacFullDuplex_twohosts_speed.test 4.7 KB

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