lifecycle.test 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. %description:
  2. This test shows how the LifecycleController should be used to manage the
  3. turned on/off state of network nodes. The nodes in the test network contain
  4. three submodules: a test protocol, a test radio and a test mobility. The Nodes
  5. can be turned on/off using the NodeStartOperation or the NodeShutdownOperation.
  6. Other operations could be implemented similarly for nodes, interfaces or links.
  7. The startup and shutting process of the individual submodules takes time and
  8. some operation phases may depend on some other. This is implemented by splitting
  9. up the operations into more zero simulation time duration stages. Each submodule
  10. provides its own code that runs concurrently in the predefined stages of the
  11. given operation. The time it takes to run a specific stage for a specific submodule
  12. may be different. The LifecycleContoller will figure out the total time to properly
  13. run each stage one after the other.
  14. %file: test.ned
  15. import inet.base.LifecycleController;
  16. import inet.status.NodeStatus;
  17. import inet.common.scenario.ScenarioManager;
  18. network Test
  19. {
  20. parameters:
  21. **.initialStatus = default("DOWN");
  22. submodules:
  23. lifecycleController: LifecycleController {
  24. @display("p=50,100");
  25. }
  26. scenarioManager: ScenarioManager {
  27. script = xmldoc("scenario.xml");
  28. @display("p=50,50");
  29. }
  30. nodeA: TestNode;
  31. nodeB: TestNode;
  32. }
  33. %file: scenario.xml
  34. <scenario>
  35. <at t="10.0">
  36. <tell module="lifecycleController" target="nodeA" operation="TestNodeStartOperation"/>
  37. </at>
  38. <at t="20.0">
  39. <tell module="lifecycleController" target="nodeB" operation="TestNodeStartOperation"/>
  40. </at>
  41. <at t="30.0">
  42. <tell module="lifecycleController" target="nodeB" operation="TestNodeShutdownOperation"/>
  43. </at>
  44. <at t="40.0">
  45. <tell module="lifecycleController" target="nodeA" operation="TestNodeShutdownOperation"/>
  46. </at>
  47. </scenario>
  48. %inifile: omnetpp.ini
  49. [General]
  50. network = Test
  51. tkenv-plugin-path = ../../../../etc/plugins
  52. ned-path = .;../../../../../src;../../lib
  53. cmdenv-express-mode = false
  54. %contains: stdout
  55. ** Event #1 T=10 Test.scenarioManager (ScenarioManager, id=3)
  56. processing <at> command...
  57. processing <tell> command...
  58. Doing stage 0/4 of operation TestNodeStartOperation on Test.nodeA
  59. Test.nodeA starting up
  60. Test.nodeA.mobility starting to move
  61. Test.nodeA.radio turning on transmitter
  62. ** Event #2 T=11 Test.nodeA.radio (TestRadio, id=9)
  63. Test.nodeA.radio transmitter turned on
  64. Module Test.nodeA.radio completed stage 0 of operation TestNodeStartOperation, 0 more module(s) pending, stage completed
  65. Doing stage 1/4 of operation TestNodeStartOperation on Test.nodeA
  66. Test.nodeA.protocol opening connection
  67. Test.nodeA.radio turning on receiver
  68. ** Event #3 T=13 Test.nodeA.radio (TestRadio, id=9)
  69. Test.nodeA.radio receiver turned on
  70. Module Test.nodeA.radio completed stage 1 of operation TestNodeStartOperation, 1 more module(s) pending
  71. ** Event #4 T=14 Test.nodeA.protocol (TestProtocol, id=8)
  72. Test.nodeA.protocol connection open
  73. Module Test.nodeA.protocol completed stage 1 of operation TestNodeStartOperation, 0 more module(s) pending, stage completed
  74. Doing stage 2/4 of operation TestNodeStartOperation on Test.nodeA
  75. Test.nodeA.protocol sending initial data
  76. ** Event #5 T=16 Test.nodeA.protocol (TestProtocol, id=8)
  77. Test.nodeA.protocol data sent
  78. Module Test.nodeA.protocol completed stage 2 of operation TestNodeStartOperation, 1 more module(s) pending
  79. ** Event #6 T=19 Test.nodeA.mobility (TestMobility, id=7)
  80. Test.nodeA.mobility moving started
  81. Module Test.nodeA.mobility completed stage 2 of operation TestNodeStartOperation, 0 more module(s) pending, stage completed
  82. Doing stage 3/4 of operation TestNodeStartOperation on Test.nodeA
  83. Test.nodeA started
  84. ** Event #7 T=20 Test.scenarioManager (ScenarioManager, id=3)
  85. processing <at> command...
  86. processing <tell> command...
  87. Doing stage 0/4 of operation TestNodeStartOperation on Test.nodeB
  88. Test.nodeB starting up
  89. Test.nodeB.mobility starting to move
  90. Test.nodeB.radio turning on transmitter
  91. ** Event #8 T=21 Test.nodeB.radio (TestRadio, id=13)
  92. Test.nodeB.radio transmitter turned on
  93. Module Test.nodeB.radio completed stage 0 of operation TestNodeStartOperation, 0 more module(s) pending, stage completed
  94. Doing stage 1/4 of operation TestNodeStartOperation on Test.nodeB
  95. Test.nodeB.protocol opening connection
  96. Test.nodeB.radio turning on receiver
  97. ** Event #9 T=23 Test.nodeB.radio (TestRadio, id=13)
  98. Test.nodeB.radio receiver turned on
  99. Module Test.nodeB.radio completed stage 1 of operation TestNodeStartOperation, 1 more module(s) pending
  100. ** Event #10 T=24 Test.nodeB.protocol (TestProtocol, id=12)
  101. Test.nodeB.protocol connection open
  102. Module Test.nodeB.protocol completed stage 1 of operation TestNodeStartOperation, 0 more module(s) pending, stage completed
  103. Doing stage 2/4 of operation TestNodeStartOperation on Test.nodeB
  104. Test.nodeB.protocol sending initial data
  105. ** Event #11 T=26 Test.nodeB.protocol (TestProtocol, id=12)
  106. Test.nodeB.protocol data sent
  107. Module Test.nodeB.protocol completed stage 2 of operation TestNodeStartOperation, 1 more module(s) pending
  108. ** Event #12 T=29 Test.nodeB.mobility (TestMobility, id=11)
  109. Test.nodeB.mobility moving started
  110. Module Test.nodeB.mobility completed stage 2 of operation TestNodeStartOperation, 0 more module(s) pending, stage completed
  111. Doing stage 3/4 of operation TestNodeStartOperation on Test.nodeB
  112. Test.nodeB started
  113. ** Event #13 T=30 Test.scenarioManager (ScenarioManager, id=3)
  114. processing <at> command...
  115. processing <tell> command...
  116. Doing stage 0/4 of operation TestNodeShutdownOperation on Test.nodeB
  117. Test.nodeB shutting down
  118. Test.nodeB.mobility stopping to move
  119. Test.nodeB.protocol sending final data
  120. ** Event #14 T=32 Test.nodeB.protocol (TestProtocol, id=12)
  121. Test.nodeB.protocol data sent
  122. Module Test.nodeB.protocol completed stage 0 of operation TestNodeShutdownOperation, 0 more module(s) pending, stage completed
  123. Doing stage 1/4 of operation TestNodeShutdownOperation on Test.nodeB
  124. Test.nodeB.protocol closing connection
  125. Test.nodeB.radio turning off receiver
  126. ** Event #15 T=34 Test.nodeB.radio (TestRadio, id=13)
  127. Test.nodeB.radio receiver turned off
  128. Module Test.nodeB.radio completed stage 1 of operation TestNodeShutdownOperation, 1 more module(s) pending
  129. ** Event #16 T=35 Test.nodeB.protocol (TestProtocol, id=12)
  130. Test.nodeB.protocol connection closed
  131. Module Test.nodeB.protocol completed stage 1 of operation TestNodeShutdownOperation, 0 more module(s) pending, stage completed
  132. Doing stage 2/4 of operation TestNodeShutdownOperation on Test.nodeB
  133. Test.nodeB.radio turning off transmitter
  134. ** Event #17 T=36 Test.nodeB.radio (TestRadio, id=13)
  135. Test.nodeB.radio transmitter turned off
  136. Module Test.nodeB.radio completed stage 2 of operation TestNodeShutdownOperation, 1 more module(s) pending
  137. ** Event #18 T=39 Test.nodeB.mobility (TestMobility, id=11)
  138. Test.nodeB.mobility moving stopped
  139. Module Test.nodeB.mobility completed stage 2 of operation TestNodeShutdownOperation, 0 more module(s) pending, stage completed
  140. Doing stage 3/4 of operation TestNodeShutdownOperation on Test.nodeB
  141. Test.nodeB shut down
  142. ** Event #19 T=40 Test.scenarioManager (ScenarioManager, id=3)
  143. processing <at> command...
  144. processing <tell> command...
  145. Doing stage 0/4 of operation TestNodeShutdownOperation on Test.nodeA
  146. Test.nodeA shutting down
  147. Test.nodeA.mobility stopping to move
  148. Test.nodeA.protocol sending final data
  149. ** Event #20 T=42 Test.nodeA.protocol (TestProtocol, id=8)
  150. Test.nodeA.protocol data sent
  151. Module Test.nodeA.protocol completed stage 0 of operation TestNodeShutdownOperation, 0 more module(s) pending, stage completed
  152. Doing stage 1/4 of operation TestNodeShutdownOperation on Test.nodeA
  153. Test.nodeA.protocol closing connection
  154. Test.nodeA.radio turning off receiver
  155. ** Event #21 T=44 Test.nodeA.radio (TestRadio, id=9)
  156. Test.nodeA.radio receiver turned off
  157. Module Test.nodeA.radio completed stage 1 of operation TestNodeShutdownOperation, 1 more module(s) pending
  158. ** Event #22 T=45 Test.nodeA.protocol (TestProtocol, id=8)
  159. Test.nodeA.protocol connection closed
  160. Module Test.nodeA.protocol completed stage 1 of operation TestNodeShutdownOperation, 0 more module(s) pending, stage completed
  161. Doing stage 2/4 of operation TestNodeShutdownOperation on Test.nodeA
  162. Test.nodeA.radio turning off transmitter
  163. ** Event #23 T=46 Test.nodeA.radio (TestRadio, id=9)
  164. Test.nodeA.radio transmitter turned off
  165. Module Test.nodeA.radio completed stage 2 of operation TestNodeShutdownOperation, 1 more module(s) pending
  166. ** Event #24 T=49 Test.nodeA.mobility (TestMobility, id=7)
  167. Test.nodeA.mobility moving stopped
  168. Module Test.nodeA.mobility completed stage 2 of operation TestNodeShutdownOperation, 0 more module(s) pending, stage completed
  169. Doing stage 3/4 of operation TestNodeShutdownOperation on Test.nodeA
  170. Test.nodeA shut down