rip_2.test 5.7 KB

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