VoIPStreamLargeNet.ned 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. //
  2. // Copyright (C) 2003 CTIE, Monash University
  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.voipstream.VoIPStreamLargeNet;
  19. import inet.linklayer.ethernet.EtherBus;
  20. import inet.linklayer.ethernet.EtherHub;
  21. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  22. import inet.node.ethernet.EtherHost;
  23. import inet.node.ethernet.EtherSwitch;
  24. import inet.node.inet.StandardHost;
  25. import ned.DatarateChannel;
  26. channel cable extends DatarateChannel
  27. {
  28. parameters:
  29. delay = 0.1us;
  30. datarate = 100Mbps;
  31. }
  32. //
  33. // Several hosts on an Ethernet hub
  34. //
  35. module VoIPStreamSmallLAN
  36. {
  37. parameters:
  38. int h; // number of hosts on the hub
  39. @display("i=old/cloud_s");
  40. gates:
  41. inout ethg;
  42. submodules:
  43. hub: EtherHub {
  44. @display("is=s");
  45. }
  46. host[h]: EtherHost {
  47. @display("is=s");
  48. }
  49. connections:
  50. for i=0..h-1 {
  51. hub.ethg++ <--> cable <--> host[i].ethg;
  52. }
  53. hub.ethg++ <--> ethg;
  54. }
  55. //
  56. // Several hosts and an Ethernet hub on a switch
  57. //
  58. module VoIPStreamMediumLAN
  59. {
  60. parameters:
  61. int n; // number of hosts on the switch
  62. int h; // number of hosts on the hub
  63. @display("i=old/cloud_s");
  64. gates:
  65. inout ethg;
  66. submodules:
  67. switch: EtherSwitch {
  68. @display("is=s");
  69. }
  70. host[n]: EtherHost {
  71. @display("is=s");
  72. }
  73. hub: EtherHub {
  74. @display("is=s");
  75. }
  76. hhost[h]: EtherHost {
  77. @display("is=s");
  78. }
  79. connections:
  80. for i=0..n-1 {
  81. switch.ethg++ <--> cable <--> host[i].ethg;
  82. }
  83. switch.ethg++ <--> ethg;
  84. for i=0..h-1 {
  85. hub.ethg++ <--> cable <--> hhost[i].ethg;
  86. }
  87. switch.ethg++ <--> cable <--> hub.ethg++;
  88. }
  89. //
  90. // Several hosts and an Ethernet hub on a switch. One port of the hub
  91. // connect to a 10Base2 segment.
  92. //
  93. module VoIPStreamLargeLAN
  94. {
  95. parameters:
  96. int n; // number of hosts on the switch
  97. int h; // number of hosts on the hub
  98. int b; // number of hosts on the bus
  99. @display("i=old/cloud");
  100. gates:
  101. inout ethg;
  102. submodules:
  103. switch: EtherSwitch {
  104. @display("is=s");
  105. }
  106. host[n]: EtherHost {
  107. @display("is=s");
  108. }
  109. hub: EtherHub {
  110. @display("is=s");
  111. }
  112. hhost[h]: EtherHost {
  113. @display("is=s");
  114. }
  115. bus: EtherBus {
  116. parameters:
  117. positions = "5 10 15"; // every 5 meters
  118. propagationSpeed = 2e8 mps; // 1us = 200m
  119. @display("b=424,6;o=#408060");
  120. }
  121. bhost[b]: EtherHost {
  122. parameters:
  123. @display("is=s;p=,,r");
  124. }
  125. connections:
  126. for i=0..n-1 {
  127. switch.ethg++ <--> cable <--> host[i].ethg;
  128. }
  129. switch.ethg++ <--> ethg;
  130. for i=0..h-1 {
  131. hub.ethg++ <--> cable <--> hhost[i].ethg;
  132. }
  133. switch.ethg++ <--> cable <--> hub.ethg++;
  134. for i=0..b-1 {
  135. bus.ethg++ <--> cable <--> bhost[i].ethg;
  136. }
  137. bus.ethg++ <--> cable <--> hub.ethg++;
  138. }
  139. //
  140. // This is a copy of the LargeNet Ethernet demo simulation in the INET Framework,
  141. // modified to add a VoIP server and a VoIP client. It can be used to test VoIP
  142. // transmission on a LAN with high background traffic.
  143. //
  144. network VoIPStreamLargeNet
  145. {
  146. parameters:
  147. int n; // length of the "backbone" (n>5!)
  148. int bbs; // number of small LANs on "backbone" switches
  149. int bbm; // number of medium LANs on "backbone" switches
  150. int bbl; // number of large LANs on "backbone" switches
  151. int as; // number of small LANs on switch A
  152. int am; // number of medium LANs on switch A
  153. int al; // number of large LANs on switch A
  154. int bs; // number of small LANs on switch B
  155. int bm; // number of medium LANs on switch B
  156. int bl; // number of large LANs on switch B
  157. int cs; // number of small LANs on switch C
  158. int cm; // number of medium LANs on switch C
  159. int cl; // number of large LANs on switch C
  160. int ds; // number of small LANs on switch D
  161. int dm; // number of medium LANs on switch D
  162. int dl; // number of large LANs on switch D
  163. submodules:
  164. switchBB[n]: EtherSwitch {
  165. @display("is=s");
  166. }
  167. slanBB[n*bbs]: VoIPStreamSmallLAN;
  168. mlanBB[n*bbm]: VoIPStreamMediumLAN;
  169. llanBB[n*bbl]: VoIPStreamLargeLAN;
  170. switchA: EtherSwitch;
  171. serverA: EtherHost;
  172. slanA[as]: VoIPStreamSmallLAN;
  173. mlanA[am]: VoIPStreamMediumLAN;
  174. llanA[al]: VoIPStreamLargeLAN;
  175. switchB: EtherSwitch;
  176. serverB: EtherHost;
  177. slanB[bs]: VoIPStreamSmallLAN;
  178. mlanB[bm]: VoIPStreamMediumLAN;
  179. llanB[bl]: VoIPStreamLargeLAN;
  180. switchC: EtherSwitch;
  181. serverC: EtherHost;
  182. slanC[cs]: VoIPStreamSmallLAN;
  183. mlanC[cm]: VoIPStreamMediumLAN;
  184. llanC[cl]: VoIPStreamLargeLAN;
  185. switchD: EtherSwitch;
  186. serverD: EtherHost;
  187. slanD[ds]: VoIPStreamSmallLAN;
  188. mlanD[dm]: VoIPStreamMediumLAN;
  189. llanD[dl]: VoIPStreamLargeLAN;
  190. voipClient: StandardHost;
  191. voipServer: StandardHost;
  192. configurator: IPv4NetworkConfigurator {
  193. parameters:
  194. config = xml("<config><interface hosts='*' address='10.x.x.x' netmask='255.x.x.x'/></config>");
  195. @display("p=495,160;i=block/cogwheel_s");
  196. }
  197. connections:
  198. // "backbone" switches
  199. for k=0..n-1, for i=0..bbs-1 {
  200. switchBB[k].ethg++ <--> cable <--> slanBB[k*bbs+i].ethg;
  201. }
  202. for k=0..n-1, for i=0..bbm-1 {
  203. switchBB[k].ethg++ <--> cable <--> mlanBB[k*bbm+i].ethg;
  204. }
  205. for k=0..n-1, for i=0..bbl-1 {
  206. switchBB[k].ethg++ <--> cable <--> llanBB[k*bbl+i].ethg;
  207. }
  208. for k=0..n-2 {
  209. switchBB[k].ethg++ <--> cable <--> switchBB[k+1].ethg++;
  210. }
  211. // switch A
  212. for i=0..as-1 {
  213. switchA.ethg++ <--> cable <--> slanA[i].ethg;
  214. }
  215. for i=0..am-1 {
  216. switchA.ethg++ <--> cable <--> mlanA[i].ethg;
  217. }
  218. for i=0..al-1 {
  219. switchA.ethg++ <--> cable <--> llanA[i].ethg;
  220. }
  221. switchA.ethg++ <--> cable <--> serverA.ethg;
  222. // switch B
  223. for i=0..bs-1 {
  224. switchB.ethg++ <--> cable <--> slanB[i].ethg;
  225. }
  226. for i=0..bm-1 {
  227. switchB.ethg++ <--> cable <--> mlanB[i].ethg;
  228. }
  229. for i=0..bl-1 {
  230. switchB.ethg++ <--> cable <--> llanB[i].ethg;
  231. }
  232. switchB.ethg++ <--> cable <--> serverB.ethg;
  233. // switch C
  234. for i=0..cs-1 {
  235. switchC.ethg++ <--> cable <--> slanC[i].ethg;
  236. }
  237. for i=0..cm-1 {
  238. switchC.ethg++ <--> cable <--> mlanC[i].ethg;
  239. }
  240. for i=0..cl-1 {
  241. switchC.ethg++ <--> cable <--> llanC[i].ethg;
  242. }
  243. switchC.ethg++ <--> cable <--> serverC.ethg;
  244. // switch D
  245. for i=0..ds-1 {
  246. switchD.ethg++ <--> cable <--> slanD[i].ethg;
  247. }
  248. for i=0..dm-1 {
  249. switchD.ethg++ <--> cable <--> mlanD[i].ethg;
  250. }
  251. for i=0..dl-1 {
  252. switchD.ethg++ <--> cable <--> llanD[i].ethg;
  253. }
  254. switchD.ethg++ <--> cable <--> serverD.ethg;
  255. // connect switches
  256. switchA.ethg++ <--> cable <--> switchB.ethg++;
  257. switchB.ethg++ <--> cable <--> switchC.ethg++;
  258. switchC.ethg++ <--> cable <--> switchD.ethg++;
  259. switchB.ethg++ <--> cable <--> switchBB[4].ethg++;
  260. switchA.ethg++ <--> cable <--> voipClient.ethg++;
  261. switchD.ethg++ <--> cable <--> voipServer.ethg++;
  262. // voipClient.ethg++ <--> cable <--> voipServer.ethg++;
  263. }