MixedNetwork.ned 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // This program is property of its copyright holder. All rights reserved.
  3. //
  4. package inet.examples.rip.mixednetwork;
  5. import inet.common.lifecycle.LifecycleController;
  6. import inet.common.scenario.ScenarioManager;
  7. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  8. import inet.node.inet.Router;
  9. import inet.node.inet.StandardHost;
  10. import ned.DatarateChannel;
  11. //
  12. // TODO Auto-generated network
  13. //
  14. network MixedNetwork
  15. {
  16. parameters:
  17. int numCHosts;
  18. int numRipRouters;
  19. types:
  20. channel C extends DatarateChannel
  21. {
  22. datarate = 10Mbps;
  23. delay = 0.1us;
  24. }
  25. submodules:
  26. cHost[numCHosts]: StandardHost {
  27. @display("p=40,120,ri,180,180");
  28. }
  29. cRouter: Router {
  30. @display("p=220,300");
  31. }
  32. bRouter: Router {
  33. @display("p=450,100");
  34. }
  35. rRouter[numRipRouters]: Router {
  36. hasRIP = true;
  37. @display("p=580,200,ri,180,180");
  38. }
  39. rHost: StandardHost {
  40. @display("p=580,641");
  41. }
  42. configurator: IPv4NetworkConfigurator {
  43. @display("p=59,31");
  44. config = xml(
  45. "<config>"
  46. +"<interface among='cHost[*] cRouter' address='10.1.x.x' netmask='255.255.x.x'/>"
  47. +"<interface among='cRouter bRouter' address='10.0.x.x' netmask='255.255.x.x'/>"
  48. +"<interface hosts='bRouter' towards='rRouter[0]' address='10.0.x.x' netmask='255.255.x.x'/>"
  49. +"<interface hosts='rRouter[0]' towards='bRouter' address='10.0.x.x' netmask='255.255.x.x' add-static-route='off'/>"
  50. +"<interface among='rRouter[*]' address='10.2.x.x' netmask='255.255.x.x' add-static-route='off'/>"
  51. +"<interface among='rRouter[*] rHost' address='10.2.x.x' netmask='255.255.x.x'/>"
  52. +"<route hosts='rRouter[0]' destination='10.1.0.0' netmask='255.255.0.0' gateway='bRouter'/>"
  53. +"</config>");
  54. }
  55. scenarioManager: ScenarioManager {
  56. @display("p=59,100");
  57. }
  58. lifecycleController: LifecycleController {
  59. @display("p=59,150");
  60. }
  61. connections:
  62. cRouter.ethg++ <--> C <--> bRouter.ethg++;
  63. bRouter.ethg++ <--> C <--> rRouter[0].ethg++;
  64. for i=0..numCHosts-1 {
  65. cHost[i].ethg++ <--> C <--> cRouter.ethg++;
  66. }
  67. for i=0..numRipRouters-1 {
  68. rRouter[i].ethg++ <--> C <--> rRouter[(i+1)%numRipRouters].ethg++ if numRipRouters>1;
  69. rRouter[i].ethg++ <--> C <--> rRouter[(i+2)%numRipRouters].ethg++ if numRipRouters>2;
  70. }
  71. rHost.ethg++ <--> C <--> rRouter[numRipRouters/2].ethg++;
  72. }