IPvXTrafGen_lifecycle.test 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. %description:
  2. Test shutdown and startup operations on IPvXTrafGen/IPvXTrafSink modules.
  3. sender[0] and recip start at down
  4. %#--------------------------------------------------------------------------------------------------------------
  5. %inifile: omnetpp.ini
  6. [General]
  7. network = Test
  8. tkenv-plugin-path = ../../../etc/plugins
  9. ned-path = .;../../../../src;../../lib
  10. cmdenv-express-mode = false
  11. #omnetpp 5.0 - 5.1 compatibility:
  12. eventlog-file = "${resultdir}/${configname}-${runnumber}.elog"
  13. output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"
  14. output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
  15. snapshot-file = "${resultdir}/${configname}-${runnumber}.sna"
  16. **.hasStatus = true
  17. *.sender[0].*.initialStatus = "down"
  18. *.recip.*.initialStatus = "down"
  19. **.scenarioManager.script = xmldoc("scenario.xml")
  20. # app config
  21. **.sender[*].trafGenType = "IPvXTrafGen"
  22. **.recip.trafGenType = "IPvXTrafSink"
  23. **.sender[*].trafGen.startTime = 1s
  24. **.sender[*].trafGen.sendInterval = 0.4s
  25. **.sender[0].trafGen.numPackets = 15
  26. **.sender[1].trafGen.stopTime = 7s
  27. **.sender[*].trafGen.protocol = 17
  28. **.sender[*].trafGen.packetLength = 800B
  29. **.sender[*].trafGen.destAddresses = "recip"
  30. **.recip.trafGen.protocol = 17
  31. **.router.ppp[*].frameCapacity = 300
  32. **.router.ppp[*].bitCapacity = 0
  33. # NIC configuration
  34. **.ppp[*].queueType = "DropTailQueue" # in routers
  35. **.ppp[*].queue.frameCapacity = 10 # in routers
  36. %#--------------------------------------------------------------------------------------------------------------
  37. %file: test.ned
  38. import inet.applications.generic.IIPvXTrafficGenerator;
  39. import inet.common.lifecycle.LifecycleController;
  40. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  41. import inet.networklayer.configurator.ipv4.IPv4NodeConfigurator;
  42. import inet.node.inet.NodeBase;
  43. import inet.common.scenario.ScenarioManager;
  44. module TrafGenHost extends NodeBase
  45. {
  46. parameters:
  47. @networkNode();
  48. @display("i=device/pc3");
  49. string trafGenType;
  50. submodules:
  51. trafGen: <trafGenType> like IIPvXTrafficGenerator {
  52. parameters:
  53. protocol = 17; // UDP
  54. @display("p=329,81");
  55. }
  56. connections allowunconnected:
  57. // transport connections
  58. networkLayer.transportOut++ --> trafGen.ipIn;
  59. networkLayer.transportIn++ <-- trafGen.ipOut;
  60. }
  61. network Test
  62. {
  63. submodules:
  64. scenarioManager: ScenarioManager;
  65. lifecycleController: LifecycleController {
  66. @display("p=76,50");
  67. }
  68. sender[2]: TrafGenHost {
  69. @display("p=88,181,c,50");
  70. }
  71. recip: TrafGenHost {
  72. @display("p=359,181");
  73. }
  74. configurator: IPv4NetworkConfigurator {
  75. @display("p=229,36");
  76. }
  77. connections:
  78. sender[0].pppg++ <--> { datarate = 1Mbps; delay = 10us; } <--> recip.pppg++;
  79. sender[1].pppg++ <--> { datarate = 1Mbps; delay = 10us; } <--> recip.pppg++;
  80. }
  81. %#--------------------------------------------------------------------------------------------------------------
  82. %file: scenario.xml
  83. <scenario>
  84. <tell t="1.5" module="lifecycleController" target="recip" operation="NodeStartOperation"/>
  85. <tell t="2.0" module="lifecycleController" target="sender[0]" operation="NodeStartOperation"/>
  86. <tell t="3.0" module="lifecycleController" target="recip" operation="NodeShutdownOperation"/>
  87. <tell t="4.0" module="lifecycleController" target="recip" operation="NodeStartOperation"/>
  88. <tell t="5.0" module="lifecycleController" target="sender[1]" operation="NodeShutdownOperation"/>
  89. <tell t="6.0" module="lifecycleController" target="sender[1]" operation="NodeStartOperation"/>
  90. </scenario>
  91. %#--------------------------------------------------------------------------------------------------------------
  92. %subst: /omnetpp:://
  93. %#--------------------------------------------------------------------------------------------------------------
  94. %contains-regex: stdout
  95. \*\* Event \#\d+ t=1 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  96. Sending packet: \(cPacket\)appData-0
  97. .*
  98. \*\* Event \#\d+ t=1\.4 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  99. Sending packet: \(cPacket\)appData-1
  100. .*
  101. ?\*\* Event #\d+ t=1\.5 Test\.scenarioManager .*
  102. Test\.recip starting up
  103. .*
  104. Test\.recip started
  105. .*
  106. ?\*\* Event \#\d+ t=1\.8 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  107. Sending packet: \(cPacket\)appData-2
  108. .*
  109. ?\*\* Event #\d+ t=2 Test\.scenarioManager .*
  110. Test\.sender\[0\] starting up
  111. .*
  112. Test\.sender\[0\] started
  113. .*
  114. ?\*\* Event \#\d+ t=2 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  115. Sending packet: \(cPacket\)appData-0
  116. .*
  117. ?\*\* Event \#\d+ t=2\.2 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  118. Sending packet: \(cPacket\)appData-3
  119. .*
  120. ?\*\* Event \#\d+ t=2\.4 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  121. Sending packet: \(cPacket\)appData-1
  122. .*
  123. ?\*\* Event \#\d+ t=2\.6 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  124. Sending packet: \(cPacket\)appData-4
  125. .*
  126. ?\*\* Event \#\d+ t=2\.8 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  127. Sending packet: \(cPacket\)appData-2
  128. .*
  129. ?\*\* Event #\d+ t=3 Test\.scenarioManager .*
  130. Test\.recip shutting down
  131. .*
  132. Test\.recip shut down
  133. .*
  134. ?\*\* Event \#\d+ t=3 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  135. Sending packet: \(cPacket\)appData-5
  136. .*
  137. ?\*\* Event \#\d+ t=3\.2 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  138. Sending packet: \(cPacket\)appData-3
  139. .*
  140. ?\*\* Event \#\d+ t=3\.4 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  141. Sending packet: \(cPacket\)appData-6
  142. .*
  143. ?\*\* Event \#\d+ t=3\.6 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  144. Sending packet: \(cPacket\)appData-4
  145. .*
  146. ?\*\* Event \#\d+ t=3\.8 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  147. Sending packet: \(cPacket\)appData-7
  148. .*
  149. ?\*\* Event #\d+ t=4 Test\.scenarioManager .*
  150. Test\.recip starting up
  151. .*
  152. Test\.recip started
  153. .*
  154. ?\*\* Event \#\d+ t=4 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  155. Sending packet: \(cPacket\)appData-5
  156. .*
  157. ?\*\* Event \#\d+ t=4\.2 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  158. Sending packet: \(cPacket\)appData-8
  159. .*
  160. ?\*\* Event \#\d+ t=4\.4 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  161. Sending packet: \(cPacket\)appData-6
  162. .*
  163. ?\*\* Event \#\d+ t=4\.6 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  164. Sending packet: \(cPacket\)appData-9
  165. .*
  166. ?\*\* Event \#\d+ t=4\.8 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  167. Sending packet: \(cPacket\)appData-7
  168. .*
  169. ?\*\* Event #\d+ t=5 Test\.scenarioManager .*
  170. Test\.sender\[1\] shutting down
  171. .*
  172. Test\.sender\[1\] shut down
  173. .*
  174. ?\*\* Event \#\d+ t=5\.2 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  175. Sending packet: \(cPacket\)appData-8
  176. .*
  177. ?\*\* Event \#\d+ t=5\.6 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  178. Sending packet: \(cPacket\)appData-9
  179. .*
  180. ?\*\* Event #\d+ t=6 Test\.scenarioManager .*
  181. Test\.sender\[1\] starting up
  182. .*
  183. Test\.sender\[1\] started
  184. .*
  185. ?\*\* Event \#\d+ t=6 Test\.sender\[0\]\.trafGen \(IPvXTrafGen,.*
  186. Sending packet: \(cPacket\)appData-10
  187. .*
  188. ?\*\* Event \#\d+ t=6 Test\.sender\[1\]\.trafGen \(IPvXTrafGen,.*
  189. Sending packet: \(cPacket\)appData-10
  190. %#--------------------------------------------------------------------------------------------------------------
  191. %contains: results/General-0.sca
  192. scalar Test.sender[0].trafGen sentPk:count 15
  193. attr
  194. %#--------------------------------------------------------------------------------------------------------------
  195. %contains: results/General-0.sca
  196. scalar Test.sender[1].trafGen sentPk:count 13
  197. attr
  198. %#--------------------------------------------------------------------------------------------------------------
  199. %contains: results/General-0.sca
  200. scalar Test.recip.trafGen rcvdPk:count 21
  201. attr
  202. %#--------------------------------------------------------------------------------------------------------------
  203. %not-contains: stdout
  204. undisposed object:
  205. %not-contains: stdout
  206. -- check module destructor
  207. %#--------------------------------------------------------------------------------------------------------------