EtherMac_halfduplex_twohosts_speed.test 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. %description:
  2. Testing Ethernet communication between host pairs.
  3. All hosts use EtherMAC implementation with half 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 EtherHostQ extends EtherHost
  18. {
  19. parameters:
  20. queueType = "DropTailQueue";
  21. macType = "EtherMAC";
  22. mac.duplexMode = false;
  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_H_A: EtherHostQ {
  44. parameters:
  45. @display("p=70,70");
  46. }
  47. host_10_H_B: EtherHostQ {
  48. parameters:
  49. @display("p=210,70");
  50. }
  51. host_100_H_A: EtherHostQ {
  52. parameters:
  53. @display("p=70,210");
  54. }
  55. host_100_H_B: EtherHostQ {
  56. parameters:
  57. @display("p=210,210");
  58. }
  59. host_1000_H_A: EtherHostQ {
  60. parameters:
  61. @display("p=70,350");
  62. }
  63. host_1000_H_B: EtherHostQ {
  64. parameters:
  65. @display("p=210,350");
  66. }
  67. connections:
  68. host_10_H_A.ethg <--> C10 <--> host_10_H_B.ethg;
  69. host_100_H_A.ethg <--> C100 <--> host_100_H_B.ethg;
  70. host_1000_H_A.ethg <--> C1000 <--> host_1000_H_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_H_A.cli.destAddress = "host_10_H_B"
  81. *.host_10_H_B.cli.destAddress = "host_10_H_A"
  82. *.host_100_H_A.cli.destAddress = "host_100_H_B"
  83. *.host_100_H_B.cli.destAddress = "host_100_H_A"
  84. *.host_1000_H_A.cli.destAddress = "host_1000_H_B"
  85. *.host_1000_H_B.cli.destAddress = "host_1000_H_A"
  86. **.cli.reqLength = 1250B # 10.000 bit
  87. **.cli.respLength = 0B # no response
  88. *.host_*.cli.startTime = 0s
  89. *.host_1000_H_*.cli.sendInterval = 0.010ms # 10.000 / speed [ / 2 when halfduplex]
  90. *.host_100_H_*.cli.sendInterval = 0.10ms # 10.000 / speed [ / 2 when halfduplex]
  91. *.host_10_H_*.cli.sendInterval = 1.0ms # 10.000 / speed [ / 2 when halfduplex]
  92. **.mac.address = "auto"
  93. **.queue.dataQueue.frameCapacity = 1000
  94. %#--------------------------------------------------------------------------------------------------------------
  95. %postrun-command: Rscript check.r
  96. %#--------------------------------------------------------------------------------------------------------------
  97. %file: check.r
  98. #!/usr/bin/env Rscript
  99. options(echo=FALSE)
  100. options(width=160)
  101. library("omnetpp", warn.conflicts=FALSE)
  102. #TEST parameters
  103. scafile <- 'results/General-#0.sca'
  104. linecount <- 6
  105. idlelimit <- 2.0
  106. usedlimit <- 98.0
  107. # begin TEST:
  108. idle <- loadDataset(scafile, add(type='scalar', select='name("rx channel idle *")'))
  109. used <- loadDataset(scafile, add(type='scalar', select='name("rx channel utilization *")'))
  110. cat("\nOMNETPP TEST RESULT: ")
  111. if(length(idle$scalars$value) == linecount & max(idle$scalars$value) <= idlelimit)
  112. {
  113. cat("IDLE OK\n")
  114. } else {
  115. cat("IDLE BAD:\n")
  116. print(idle$scalars[idle$scalars$value > idlelimit,])
  117. }
  118. cat("\nOMNETPP TEST RESULT: ")
  119. if(length(used$scalars$value) == linecount & min(used$scalars$value) >= usedlimit)
  120. {
  121. cat("USED OK\n")
  122. } else {
  123. cat("USED BAD:\n")
  124. print(used$scalars[used$scalars$value < usedlimit,])
  125. }
  126. cat("\n")
  127. %#--------------------------------------------------------------------------------------------------------------
  128. %contains: postrun-command(1).out
  129. OMNETPP TEST RESULT: IDLE OK
  130. OMNETPP TEST RESULT: USED OK
  131. %#--------------------------------------------------------------------------------------------------------------