%description: Testing Ethernet communication on EtherHub with 100MBps, with disconnecting and reconnecting some hosts. Simulation has 5 pairs of hosts that communicate with each other. All hosts use EtherMAC implementation with half duplex mode. All hosts have same ethernet configurations. All hosts send requests and also reply to requests sent to them. checks: - the idle state of rx is less than or equals to 6.5% in all hosts - the utilization state of rx is more than or equals to 93% in all hosts %#-------------------------------------------------------------------------------------------------------------- %testprog: opp_run %#-------------------------------------------------------------------------------------------------------------- %file: test.ned import inet.linklayer.ethernet.EtherHub; import inet.node.ethernet.EtherHost; import inet.common.scenario.ScenarioManager; import ned.DatarateChannel; module EtherHostQ extends EtherHost { parameters: queueType = "DropTailQueue"; } // // Sample Ethernet LAN: hosts connected via hub // network SpeedTest { types: channel C100 extends DatarateChannel { delay = 0.1us; datarate = 100Mbps; } submodules: host_1_H_A: EtherHostQ { parameters: @display("p=70,70"); } host_1_H_B: EtherHostQ { parameters: @display("p=210,70"); } host_2_H_A: EtherHostQ { parameters: @display("p=70,140"); } host_2_H_B: EtherHostQ { parameters: @display("p=210,140"); } host_3_H_A: EtherHostQ { parameters: @display("p=70,210"); } host_3_H_B: EtherHostQ { parameters: @display("p=210,210"); } host_4_H_A: EtherHostQ { parameters: @display("p=70,280"); } host_4_H_B: EtherHostQ { parameters: @display("p=210,280"); } host_5_H_A: EtherHostQ { parameters: @display("p=70,350"); } host_5_H_B: EtherHostQ { parameters: @display("p=210,350"); } hub: EtherHub { parameters: @display("p=140,210"); gates: ethg[10]; } scenarioManager: ScenarioManager { @display("p=184,180"); } connections: hub.ethg++ <--> C100 <--> host_1_H_A.ethg; hub.ethg++ <--> C100 <--> host_1_H_B.ethg; hub.ethg++ <--> C100 <--> host_2_H_A.ethg; hub.ethg++ <--> C100 <--> host_2_H_B.ethg; hub.ethg++ <--> C100 <--> host_3_H_A.ethg; hub.ethg++ <--> C100 <--> host_3_H_B.ethg; hub.ethg++ <--> C100 <--> host_4_H_A.ethg; hub.ethg++ <--> C100 <--> host_4_H_B.ethg; hub.ethg++ <--> C100 <--> host_5_H_A.ethg; hub.ethg++ <--> C100 <--> host_5_H_B.ethg; } %#-------------------------------------------------------------------------------------------------------------- %file: scenario.xml %#-------------------------------------------------------------------------------------------------------------- %inifile: omnetpp.ini [General] sim-time-limit = 5.2s tkenv-plugin-path = ../../../etc/plugins #record-eventlog = true **.vector-recording = false network = SpeedTest **.scenarioManager.script = xmldoc("scenario.xml") *.host_1_H_A.cli.destAddress = "host_1_H_B" *.host_1_H_B.cli.destAddress = "host_1_H_A" *.host_2_H_A.cli.destAddress = "host_2_H_B" *.host_2_H_B.cli.destAddress = "host_2_H_A" *.host_3_H_A.cli.destAddress = "host_3_H_B" *.host_3_H_B.cli.destAddress = "host_3_H_A" *.host_4_H_A.cli.destAddress = "host_4_H_B" *.host_4_H_B.cli.destAddress = "host_4_H_A" *.host_5_H_A.cli.destAddress = "host_5_H_B" *.host_5_H_B.cli.destAddress = "host_5_H_A" **.cli.reqLength = 1250B # 10.000 bit **.cli.respLength = 1250B # 10.000 bit *.host_*_*.cli.startTime = 0s *.host_*_H_*.mac.duplexMode = false *.host_*_H_*.cli.sendInterval = 0.1ms # 10.000 / speed [ / nodecount, when halfduplex] **.mac.address = "auto" # Check: "rx channel idle (%)" <= 4.0 # Check: "rx channel utilization (%)" >= 96.0 %#-------------------------------------------------------------------------------------------------------------- %postrun-command: Rscript check.r %#-------------------------------------------------------------------------------------------------------------- %file: check.r #!/usr/bin/env Rscript options(echo=FALSE) options(width=160) library("omnetpp", warn.conflicts=FALSE) #TEST parameters scafile <- 'results/General-#0.sca' linecount <- 10 idlelimit <- 6.5 usedlimit <- 93.0 # begin TEST: idle <- loadDataset(scafile, add(type='scalar', select='name("rx channel idle *")')) used <- loadDataset(scafile, add(type='scalar', select='name("rx channel utilization *")')) cat("\nOMNETPP TEST RESULT: ") if(length(idle$scalars$value) == linecount & max(idle$scalars$value) <= idlelimit) { cat("IDLE OK\n") } else { cat("IDLE BAD:\n") print(idle$scalars[idle$scalars$value > idlelimit,]) } cat("\nOMNETPP TEST RESULT: ") if(length(used$scalars$value) == linecount & min(used$scalars$value) >= usedlimit) { cat("USED OK\n") } else { cat("USED BAD:\n") print(used$scalars[used$scalars$value < usedlimit,]) } cat("\n") %#-------------------------------------------------------------------------------------------------------------- %contains: postrun-command(1).out OMNETPP TEST RESULT: IDLE OK OMNETPP TEST RESULT: USED OK %#--------------------------------------------------------------------------------------------------------------