DHCP_1.test 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. %description:
  2. Testing DHCP protocol
  3. %#--------------------------------------------------------------------------------------------------------------
  4. %file: test.ned
  5. import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
  6. import inet.node.ethernet.EtherSwitch;
  7. import inet.node.inet.StandardHost;
  8. import inet.common.misc.ThruputMeteringChannel;
  9. network DhcpExample
  10. {
  11. parameters:
  12. int numHosts;
  13. types:
  14. channel ethernetline extends ThruputMeteringChannel
  15. {
  16. delay = 0.1us;
  17. datarate = 10Mbps;
  18. thruputDisplayFormat = "u";
  19. }
  20. submodules:
  21. srv: StandardHost;
  22. switch: EtherSwitch {
  23. parameters:
  24. @display("p=186,250");
  25. }
  26. cli[numHosts]: StandardHost;
  27. configurator: IPv4NetworkConfigurator {
  28. parameters:
  29. config = xml("<config><interface hosts='srv' address='192.168.1.1' netmask='255.255.255.0' /></config>");
  30. }
  31. connections:
  32. srv.ethg++ <--> ethernetline <--> switch.ethg++;
  33. for i=0..numHosts-1 {
  34. cli[i].ethg++ <--> ethernetline <--> switch.ethg++;
  35. }
  36. }
  37. %#--------------------------------------------------------------------------------------------------------------
  38. %inifile: omnetpp.ini
  39. [General]
  40. tkenv-plugin-path = ../../../etc/plugins
  41. ned-path = .;../../../../src;../../lib
  42. cmdenv-express-mode = false
  43. sim-time-limit = 1000s
  44. record-eventlog = true
  45. #omnetpp 5.0 - 5.1 compatibility:
  46. eventlog-file = "${resultdir}/${configname}-${runnumber}.elog"
  47. output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"
  48. output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
  49. snapshot-file = "${resultdir}/${configname}-${runnumber}.sna"
  50. network = DhcpExample
  51. *.numHosts = 10
  52. **.numUdpApps = 1
  53. **.cli[*].udpApp[0].typename = "DHCPClient"
  54. **.cli[*].udpApp[0].interface="eth0" # interface toward dhcp server
  55. **.srv.udpApp[0].typename = "DHCPServer"
  56. **.srv.udpApp[0].numReservedAddresses = 100 # ip to start to lease
  57. **.srv.udpApp[0].maxNumClients = 100 # number of ip to lease
  58. **.srv.udpApp[0].dns = "" # dns to assign
  59. **.srv.udpApp[0].leaseTime = 1000s # lease time in seconds
  60. **.srv.udpApp[0].interface="eth0" # interface to listen
  61. %#--------------------------------------------------------------------------------------------------------------
  62. %#--------------------------------------------------------------------------------------------------------------
  63. %contains-regex: stdout
  64. .*
  65. The requested IP 192\.168\.1\.100/255\.255\.255\.0 is available. Assigning it to cli\[0\].
  66. .*
  67. The requested IP 192\.168\.1\.101/255\.255\.255\.0 is available. Assigning it to cli\[1\].
  68. .*
  69. The requested IP 192\.168\.1\.102/255\.255\.255\.0 is available. Assigning it to cli\[2\].
  70. .*
  71. The requested IP 192\.168\.1\.103/255\.255\.255\.0 is available. Assigning it to cli\[3\].
  72. .*
  73. The requested IP 192\.168\.1\.104/255\.255\.255\.0 is available. Assigning it to cli\[4\].
  74. .*
  75. The requested IP 192\.168\.1\.105/255\.255\.255\.0 is available. Assigning it to cli\[5\].
  76. .*
  77. The requested IP 192\.168\.1\.106/255\.255\.255\.0 is available. Assigning it to cli\[6\].
  78. .*
  79. The requested IP 192\.168\.1\.107/255\.255\.255\.0 is available. Assigning it to cli\[7\].
  80. .*
  81. The requested IP 192\.168\.1\.108/255\.255\.255\.0 is available. Assigning it to cli\[8\].
  82. .*
  83. The requested IP 192\.168\.1\.109/255\.255\.255\.0 is available. Assigning it to cli\[9\].
  84. .*
  85. %#--------------------------------------------------------------------------------------------------------------
  86. %not-contains: stdout
  87. undisposed object:
  88. %not-contains: stdout
  89. -- check module destructor
  90. %#--------------------------------------------------------------------------------------------------------------