%description:

Test for basic DHCP lifecycle handling.

%inifile: omnetpp.ini

[General]
network = Test
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"

**.hasStatus = true
**.scenarioManager.script = xmldoc("scenario.xml")

**.numUdpApps = 1

**.client.udpApp[0].typename = "DHCPClient"
**.client.udpApp[0].interface = "eth0"

**.server.udpApp[0].typename = "DHCPServer"
**.server.udpApp[0].subnetMask = "255.255.255.0"
**.server.udpApp[0].numReservedAddresses = 100
**.server.udpApp[0].maxNumClients = 100
**.server.udpApp[0].gateway = "192.168.1.1"
**.server.udpApp[0].dns = ""
**.server.udpApp[0].leaseTime = 100s
**.server.udpApp[0].interface = "eth0"

%file: test.ned

import inet.node.ethernet.Eth10M;
import inet.node.inet.StandardHost;
import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator;
import inet.common.lifecycle.LifecycleController;
import inet.common.scenario.ScenarioManager;

network Test
{
    submodules:
        scenarioManager: ScenarioManager;
        lifecycleController: LifecycleController;
        configurator: IPv4NetworkConfigurator {
            parameters:
                config = xml("<config><interface hosts='server' address='192.168.1.1' netmask='255.255.255.0'/></config>");
        }
        client: StandardHost;
        server: StandardHost;
    connections:
        client.ethg++ <--> Eth10M <--> server.ethg++;
}

%file: scenario.xml
 
<scenario>
    <at t="1.0">
        <tell module="lifecycleController" target="client" operation="NodeShutdownOperation"/>
    </at>
    <at t="2.0">
        <tell module="lifecycleController" target="client" operation="NodeStartOperation"/>
    </at>
    <at t="3.0">
        <tell module="lifecycleController" target="server" operation="NodeShutdownOperation"/>
    </at>
    <at t="4.0">
        <tell module="lifecycleController" target="server" operation="NodeStartOperation"/>
    </at> -->
</scenario>

%contains-regex: stdout
.*
The requested IP 192\.168\.1\.100/255\.255\.255\.0 is available. Assigning it to client.
.*
Test.client shutting down
.*
Test.client shut down
.*
Test.client starting up
.*
Test.client started
.*
The requested IP 192\.168\.1\.100/255\.255\.255\.0 is available. Assigning it to client.
.*
Test.server shutting down
.*
Test.server shut down
.*
Test.server starting up
.*
Test.server started
.*
The requested IP 192\.168\.1\.100/255\.255\.255\.0 is available. Assigning it to client.
.*
%#--------------------------------------------------------------------------------------------------------------
%not-contains: stdout
undisposed object:
%not-contains: stdout
-- check module destructor
%#--------------------------------------------------------------------------------------------------------------
