NClients.ned 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // Copyright (C) 2004 Andras Varga
  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.inet.shutdownrestart;
  19. import inet.common.lifecycle.LifecycleController;
  20. import inet.common.misc.ThruputMeteringChannel;
  21. import inet.common.scenario.ScenarioManager;
  22. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  23. import inet.node.ethernet.EtherSwitch;
  24. import inet.node.inet.Router;
  25. import inet.node.inet.StandardHost;
  26. network NClients
  27. {
  28. parameters:
  29. int n;
  30. @display("bgb=593,356");
  31. types:
  32. channel fiberline extends ThruputMeteringChannel
  33. {
  34. delay = 1us;
  35. datarate = 512Mbps;
  36. thruputDisplayFormat = "u";
  37. }
  38. channel ethernetline extends ThruputMeteringChannel
  39. {
  40. delay = 0.1us;
  41. datarate = 10Mbps;
  42. thruputDisplayFormat = "u";
  43. }
  44. submodules:
  45. r1: Router {
  46. @display("p=232,281");
  47. }
  48. r2: Router {
  49. @display("p=324,219");
  50. }
  51. r3: Router {
  52. @display("p=433,250");
  53. }
  54. s: EtherSwitch {
  55. @display("p=153,221");
  56. }
  57. cli[n]: StandardHost {
  58. @display("i=device/laptop;p=51,269,r");
  59. }
  60. srv: StandardHost {
  61. @display("p=544,194;i=device/server_l");
  62. }
  63. configurator: IPv4NetworkConfigurator {
  64. @display("p=75,47");
  65. }
  66. scenarioManager: ScenarioManager {
  67. @display("p=75,101");
  68. script = xml("<script>\n" +
  69. "<at t='3s'><tell module='lifecycleController' operation='NodeShutdownOperation' target='r2'/></at>\n" +
  70. "<at t='6s'><tell module='lifecycleController' operation='NodeStartOperation' target='r2'/></at>\n" +
  71. "<at t='9s'><tell module='lifecycleController' operation='NodeShutdownOperation' target='r2'/></at>\n" +
  72. "<at t='12s'><tell module='lifecycleController' operation='NodeStartOperation' target='r2'/></at>\n" +
  73. "<at t='15s'><tell module='lifecycleController' operation='NodeShutdownOperation' target='cli[0]'/></at>\n" +
  74. "<at t='18s'><tell module='lifecycleController' operation='NodeStartOperation' target='cli[0]'/></at>\n" +
  75. "</script>");
  76. }
  77. lifecycleController: LifecycleController {
  78. @display("p=75,155");
  79. }
  80. connections:
  81. for i=0..n-1 {
  82. cli[i].ethg++ <--> ethernetline <--> s.ethg++;
  83. }
  84. s.ethg++ <--> ethernetline <--> r1.ethg++;
  85. r1.pppg++ <--> ethernetline <--> r2.pppg++;
  86. r2.pppg++ <--> ethernetline <--> r3.pppg++;
  87. r3.pppg++ <--> ethernetline <--> srv.pppg++;
  88. }