multi.ned 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //
  2. // Copyright (C) 2008 Irene Ruengeler
  3. //
  4. // This program is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU General Public License
  6. // as published by the Free Software Foundation; either version 2
  7. // of the License, or (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with this program; if not, write to the Free Software
  16. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. //
  18. package inet.examples.sctp.multihomed;
  19. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  20. import inet.node.inet.Router;
  21. import inet.node.inet.StandardHost;
  22. import ned.DatarateChannel;
  23. network multi
  24. {
  25. parameters:
  26. double testTimeout @unit(s) = default(0s);
  27. bool testing = default(false);
  28. types:
  29. channel ppp1line extends DatarateChannel
  30. {
  31. delay = 10ms;
  32. datarate = 1 Mbps;
  33. }
  34. channel ppp2line extends DatarateChannel
  35. {
  36. delay = 0ms;
  37. datarate = 1 Gbps;
  38. }
  39. submodules:
  40. cli1: StandardHost {
  41. parameters:
  42. forwarding = false;
  43. @display("p=61,142;i=device/laptop");
  44. gates:
  45. pppg[1];
  46. }
  47. srv1: StandardHost {
  48. parameters:
  49. forwarding = false;
  50. @display("p=426,135;i=device/server2");
  51. gates:
  52. pppg[1];
  53. }
  54. router1: Router {
  55. parameters:
  56. @display("p=188,77;i=abstract/router");
  57. gates:
  58. pppg[2];
  59. }
  60. router2: Router {
  61. parameters:
  62. @display("p=323,75;i=abstract/router");
  63. gates:
  64. pppg[2];
  65. }
  66. router3: Router {
  67. parameters:
  68. @display("p=188,192;i=abstract/router");
  69. gates:
  70. pppg[2];
  71. }
  72. router4: Router {
  73. parameters:
  74. @display("p=328,188;i=abstract/router");
  75. gates:
  76. pppg[2];
  77. }
  78. configurator: IPv4NetworkConfigurator {
  79. addStaticRoutes = false;
  80. config = xml("<config>"+
  81. "<interface hosts='cli1' towards='router1' address='10.1.1.1' netmask='255.255.255.0' />"+
  82. "<interface hosts='cli1' towards='router3' address='10.2.1.1' netmask='255.255.255.0' />"+
  83. "<interface hosts='srv1' towards='router2' address='10.1.3.1' netmask='255.255.255.0' />"+
  84. "<interface hosts='srv1' towards='router4' address='10.2.3.1' netmask='255.255.255.0' />"+
  85. "<interface hosts='router1' towards='cli1' address='10.1.1.254' netmask='255.255.255.0' />"+
  86. "<interface hosts='router1' towards='router2' address='10.1.2.254' netmask='255.255.255.0' />"+
  87. "<interface hosts='router2' towards='router1' address='10.1.2.253' netmask='255.255.255.0' />"+
  88. "<interface hosts='router2' towards='srv1' address='10.1.3.254' netmask='255.255.255.0' />"+
  89. "<interface hosts='router3' towards='cli1' address='10.2.1.254' netmask='255.255.255.0' />"+
  90. "<interface hosts='router3' towards='router4' address='10.2.2.254' netmask='255.255.255.0' />"+
  91. "<interface hosts='router4' towards='router3' address='10.2.2.253' netmask='255.255.255.0' />"+
  92. "<interface hosts='router4' towards='srv1' address='10.2.3.254' netmask='255.255.255.0' />"+
  93. "<route hosts='cli1' destination='10.1.0.0' netmask='/16' gateway='router1' />"+
  94. "<route hosts='cli1' destination='10.2.0.0' netmask='/16' gateway='router3' />"+
  95. "<route hosts='srv1' destination='10.1.0.0' netmask='/16' gateway='router2' />"+
  96. "<route hosts='srv1' destination='10.2.0.0' netmask='/16' gateway='router4' />"+
  97. "<route hosts='router1' destination='10.1.1.1' netmask='/32' gateway='10.1.1.1' />"+
  98. "<route hosts='router1' destination='*' gateway='10.1.2.253' />"+
  99. "<route hosts='router2' destination='10.1.3.1' netmask='/32' gateway='10.1.3.1' />"+
  100. "<route hosts='router2' destination='*' gateway='10.1.2.254' />"+
  101. "<route hosts='router3' destination='10.2.1.1' netmask='/32' gateway='10.2.1.1' />"+
  102. "<route hosts='router3' destination='*' gateway='10.2.2.253' />"+
  103. "<route hosts='router4' destination='10.2.3.1' netmask='/32' gateway='10.2.3.1' />"+
  104. "<route hosts='router4' destination='*' gateway='10.2.2.254' />"+
  105. "</config>");
  106. }
  107. connections:
  108. cli1.pppg++ <--> ppp2line <--> router1.pppg++;
  109. router1.pppg++ <--> ppp1line <--> router2.pppg++;
  110. router2.pppg++ <--> ppp2line <--> srv1.pppg++;
  111. cli1.pppg++ <--> ppp2line <--> router3.pppg++;
  112. router3.pppg++ <--> ppp1line <--> router4.pppg++;
  113. router4.pppg++ <--> ppp2line <--> srv1.pppg++;
  114. }