rip_3.test 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. %description:
  2. Testing dynamic behavior of RIP routing
  3. Topology with 2 hosts and 4 routers:
  4. RA
  5. / \
  6. H1---R1 R2---H2
  7. \ /
  8. RB
  9. Each link has metric 1, except between R1 and RB which has metric 2.
  10. RA is shut down 200s and restarted at 400s.
  11. It is checked that:
  12. - initially the route from R1 to H2 goes through RA and has metric 3.
  13. - at 220s R1 has a route to H2 through RB and has metric 4.
  14. - at 430s R1 has a route to H2 through RA again and has metric 3.
  15. %#--------------------------------------------------------------------------------------------------------------
  16. %file: test.ned
  17. import inet.common.lifecycle.LifecycleController;
  18. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  19. import inet.node.inet.StandardHost;
  20. import inet.node.rip.RIPRouter;
  21. import inet.common.scenario.ScenarioManager;
  22. import ned.DatarateChannel;
  23. network Test1
  24. {
  25. types:
  26. channel C extends DatarateChannel
  27. {
  28. delay = 0.1us;
  29. datarate = 100Mbps;
  30. }
  31. submodules:
  32. H1: StandardHost;
  33. R1: RIPRouter { gates: ethg[3]; }
  34. RA: RIPRouter { gates: ethg[2]; }
  35. RB: RIPRouter { gates: ethg[2]; }
  36. R2: RIPRouter { gates: ethg[3]; }
  37. H2: StandardHost;
  38. configurator: IPv4NetworkConfigurator {
  39. parameters:
  40. config = xml("<config>"
  41. + "<interface among='H1 R1' address='192.168.1.x' netmask='255.255.255.x' />"
  42. + "<interface among='H2 R2' address='192.168.2.x' netmask='255.255.255.x' />"
  43. + "<interface among='R*' address='10.0.0.x' netmask='255.255.255.x' />"
  44. + "<route hosts='H1' destination='*' gateway='R1'/>"
  45. + "<route hosts='H2' destination='*' gateway='R2'/>"
  46. + "<route hosts='R*' destination='224.0.0.0' netmask='240.0.0.0' interface='eth0'/>"
  47. + "<route hosts='R*' destination='224.0.0.0' netmask='240.0.0.0' interface='eth1'/>"
  48. + "<route hosts='R1 R2' destination='224.0.0.0' netmask='240.0.0.0' interface='eth2'/>"
  49. + "</config>");
  50. addStaticRoutes = false;
  51. addSubnetRoutes = false;
  52. addDefaultRoutes = false;
  53. }
  54. lifecycleController: LifecycleController;
  55. scenarioManager: ScenarioManager;
  56. routingTableLogger: RoutingTableLogger;
  57. connections:
  58. H1.ethg++ <--> C <--> R1.ethg[0];
  59. R1.ethg[1] <--> C <--> RA.ethg[0];
  60. R1.ethg[2] <--> C <--> RB.ethg[0];
  61. RA.ethg[1] <--> C <--> R2.ethg[1];
  62. RB.ethg[1] <--> C <--> R2.ethg[2];
  63. R2.ethg[0] <--> C <--> H2.ethg++;
  64. }
  65. %#--------------------------------------------------------------------------------------------------------------
  66. %file: RIPConfig.xml
  67. <?xml version="1.0"?>
  68. <RIPConfig>
  69. <interface among="R1 RB" metric="2"/>
  70. <interface among="R? R?" metric="1"/>
  71. </RIPConfig>
  72. %#--------------------------------------------------------------------------------------------------------------
  73. %file: scenario.xml
  74. <scenario>
  75. <at t="0"><dump-routes module="routingTableLogger" nodes="R1" dest="10.0.0.0/8 192.0.0.0/8"/></at>
  76. <at t="10"><dump-routes module="routingTableLogger" nodes="R1" dest="10.0.0.0/8 192.0.0.0/8"/></at>
  77. <at t="200"><tell module="lifecycleController" target="RA" operation="NodeShutdownOperation"/></at>
  78. <at t="220"><dump-routes module="routingTableLogger" nodes="R1" dest="10.0.0.0/8 192.0.0.0/8"/></at>
  79. <at t="400"><tell module="lifecycleController" target="RA" operation="NodeStartOperation"/></at>
  80. <at t="430"><dump-routes module="routingTableLogger" nodes="R1" dest="10.0.0.0/8 192.0.0.0/8"/></at>
  81. </scenario>
  82. %#--------------------------------------------------------------------------------------------------------------
  83. %inifile: omnetpp.ini
  84. [General]
  85. description = "Dynamic test"
  86. network = Test1
  87. ned-path = .;../../../../src;../../lib
  88. # record-eventlog = true
  89. # cmdenv-express-mode = false
  90. # debug-on-errors = true
  91. tkenv-plugin-path = ../../../etc/plugins
  92. sim-time-limit = 600s
  93. #omnetpp 5.0 - 5.1 compatibility:
  94. eventlog-file = "${resultdir}/${configname}-${runnumber}.elog"
  95. output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"
  96. output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
  97. snapshot-file = "${resultdir}/${configname}-${runnumber}.sna"
  98. **.arp.cacheTimeout = 1s
  99. **.ripConfig = xmldoc("RIPConfig.xml")
  100. **.rip.startupTime = 0s
  101. *.scenarioManager.script = xmldoc("scenario.xml")
  102. *.routingTableLogger.outputFile = "routes.txt"
  103. # *.rtr.module-eventlog-recording = true
  104. # **.module-eventlog-recording = true
  105. %#--------------------------------------------------------------------------------------------------------------
  106. %contains-regex: routes.txt
  107. R1 0
  108. 10.0.0.0/30 <unspec> eth1 IFACENETMASK .*
  109. 10.0.0.4/30 <unspec> eth2 IFACENETMASK .*
  110. 192.168.1.0/30 <unspec> eth0 IFACENETMASK .*
  111. R1 10
  112. 10.0.0.0/30 <unspec> eth1 IFACENETMASK .*
  113. 10.0.0.4/30 <unspec> eth2 IFACENETMASK .*
  114. 10.0.0.8/30 10.0.0.2 eth1 RIP 2
  115. 10.0.0.12/30 10.0.0.6 eth2 RIP 3
  116. 192.168.1.0/30 <unspec> eth0 IFACENETMASK .*
  117. 192.168.2.0/30 10.0.0.2 eth1 RIP 3
  118. R1 220
  119. 10.0.0.0/30 <unspec> eth1 IFACENETMASK .*
  120. 10.0.0.4/30 <unspec> eth2 IFACENETMASK .*
  121. 10.0.0.8/30 10.0.0.6 eth2 RIP 4
  122. 10.0.0.12/30 10.0.0.6 eth2 RIP 3
  123. 192.168.1.0/30 <unspec> eth0 IFACENETMASK .*
  124. 192.168.2.0/30 10.0.0.6 eth2 RIP 4
  125. R1 430
  126. 10.0.0.0/30 <unspec> eth1 IFACENETMASK .*
  127. 10.0.0.4/30 <unspec> eth2 IFACENETMASK .*
  128. 10.0.0.8/30 10.0.0.2 eth1 RIP 2
  129. 10.0.0.12/30 10.0.0.6 eth2 RIP 3
  130. 192.168.1.0/30 <unspec> eth0 IFACENETMASK .*
  131. 192.168.2.0/30 10.0.0.2 eth1 RIP 3
  132. END