123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- %description:
- Testing DHCP protocol
- %#--------------------------------------------------------------------------------------------------------------
- %file: test.ned
- import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
- import inet.node.ethernet.EtherSwitch;
- import inet.node.inet.StandardHost;
- import inet.common.misc.ThruputMeteringChannel;
- network DhcpExample
- {
- parameters:
- int numHosts;
- types:
- channel ethernetline extends ThruputMeteringChannel
- {
- delay = 0.1us;
- datarate = 10Mbps;
- thruputDisplayFormat = "u";
- }
- submodules:
- srv: StandardHost;
- switch: EtherSwitch {
- parameters:
- @display("p=186,250");
- }
- cli[numHosts]: StandardHost;
- configurator: IPv4NetworkConfigurator {
- parameters:
- config = xml("<config><interface hosts='srv' address='192.168.1.1' netmask='255.255.255.0' /></config>");
- }
- connections:
- srv.ethg++ <--> ethernetline <--> switch.ethg++;
- for i=0..numHosts-1 {
- cli[i].ethg++ <--> ethernetline <--> switch.ethg++;
- }
- }
- %#--------------------------------------------------------------------------------------------------------------
- %inifile: omnetpp.ini
- [General]
- tkenv-plugin-path = ../../../etc/plugins
- ned-path = .;../../../../src;../../lib
- cmdenv-express-mode = false
- sim-time-limit = 1000s
- record-eventlog = true
- #omnetpp 5.0 - 5.1 compatibility:
- eventlog-file = "${resultdir}/${configname}-${runnumber}.elog"
- output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca"
- output-vector-file = "${resultdir}/${configname}-${runnumber}.vec"
- snapshot-file = "${resultdir}/${configname}-${runnumber}.sna"
- network = DhcpExample
- *.numHosts = 10
- **.numUdpApps = 1
- **.cli[*].udpApp[0].typename = "DHCPClient"
- **.cli[*].udpApp[0].interface="eth0" # interface toward dhcp server
- **.srv.udpApp[0].typename = "DHCPServer"
- **.srv.udpApp[0].numReservedAddresses = 100 # ip to start to lease
- **.srv.udpApp[0].maxNumClients = 100 # number of ip to lease
- **.srv.udpApp[0].dns = "" # dns to assign
- **.srv.udpApp[0].leaseTime = 1000s # lease time in seconds
- **.srv.udpApp[0].interface="eth0" # interface to listen
- %#--------------------------------------------------------------------------------------------------------------
- %#--------------------------------------------------------------------------------------------------------------
- %contains-regex: stdout
- .*
- The requested IP 192\.168\.1\.100/255\.255\.255\.0 is available. Assigning it to cli\[0\].
- .*
- The requested IP 192\.168\.1\.101/255\.255\.255\.0 is available. Assigning it to cli\[1\].
- .*
- The requested IP 192\.168\.1\.102/255\.255\.255\.0 is available. Assigning it to cli\[2\].
- .*
- The requested IP 192\.168\.1\.103/255\.255\.255\.0 is available. Assigning it to cli\[3\].
- .*
- The requested IP 192\.168\.1\.104/255\.255\.255\.0 is available. Assigning it to cli\[4\].
- .*
- The requested IP 192\.168\.1\.105/255\.255\.255\.0 is available. Assigning it to cli\[5\].
- .*
- The requested IP 192\.168\.1\.106/255\.255\.255\.0 is available. Assigning it to cli\[6\].
- .*
- The requested IP 192\.168\.1\.107/255\.255\.255\.0 is available. Assigning it to cli\[7\].
- .*
- The requested IP 192\.168\.1\.108/255\.255\.255\.0 is available. Assigning it to cli\[8\].
- .*
- The requested IP 192\.168\.1\.109/255\.255\.255\.0 is available. Assigning it to cli\[9\].
- .*
- %#--------------------------------------------------------------------------------------------------------------
- %not-contains: stdout
- undisposed object:
- %not-contains: stdout
- -- check module destructor
- %#--------------------------------------------------------------------------------------------------------------
|