%description: Testing TCP communication speed TCP TCP_NSC %#-------------------------------------------------------------------------------------------------------------- %testprog: opp_run %#-------------------------------------------------------------------------------------------------------------- %file: test.ned import ned.DatarateChannel; import inet.node.inet.StandardHost; import inet.node.inet.Router; import inet.networklayer.configurator.ipv4.IPv4NetworkConfigurator; channel C extends DatarateChannel { delay = 0.01us; // ~ 2m datarate = 10Mbps; } module SubTest { parameters: string cliTcpType = default("n/a"); string srvTcpType = default("n/a"); int k = default(3); submodules: server: StandardHost { parameters: numTcpApps = 1; tcpType = srvTcpType; } switch: Router { parameters: } client[k]: StandardHost { parameters: numTcpApps = 1; tcpType = cliTcpType; tcpApp[0].connectAddress = substringBeforeLast(fullPath(),".client[")+".server"; } connections: server.pppg++ <--> C <--> switch.pppg++; for i=0..k-1 { client[i].pppg++ <--> C <--> switch.pppg++; } } module STest { parameters: string srvTcpType = default("n/a"); submodules: clients_INET: SubTest { parameters: srvTcpType = srvTcpType; cliTcpType = "TCP"; } clients_NSC: SubTest { parameters: srvTcpType = srvTcpType; cliTcpType = "TCP_NSC"; } clients_LWIP: SubTest { parameters: srvTcpType = srvTcpType; cliTcpType = "TCP_lwIP"; } } network TcpSpeedTest { submodules: server_INET: STest { parameters: srvTcpType = "TCP"; } server_NSC: STest { parameters: srvTcpType = "TCP_NSC"; } server_LWIP: STest { parameters: srvTcpType = "TCP_lwIP"; } configurator: IPv4NetworkConfigurator { @display("p=70,40"); } } %#-------------------------------------------------------------------------------------------------------------- %inifile: omnetpp.ini [General] network = TcpSpeedTest total-stack = 7MiB tkenv-plugin-path = ../../../etc/plugins #debug-on-errors = true #record-eventlog = true **.vector-recording = false sim-time-limit = 2s+60s #sim-time-limit = 2s+60s+12s **.server*.tcpApp[0].typename = "TCPEchoApp" **.client*.tcpApp[0].typename = "TCPSessionApp" #client app: **.client*.tcpApp[0].active = true **.client*.tcpApp[0].localPort = -1 **.client*.tcpApp[0].connectPort = 1000 **.client*.tcpApp[0].tOpen = 1s **.client*.tcpApp[0].tSend = 2s **.client*.tcpApp[0].sendBytes = 10000000B **.client*.tcpApp[0].sendScript = "" **.client*.tcpApp[0].tClose = 100s #server app: **.server*.tcpApp[0].localPort = 1000 **.server*.tcpApp[0].echoFactor = 2.0 **.server*.tcpApp[0].echoDelay = 0 ## tcp apps # NIC configuration **.ppp[*].queueType = "DropTailQueue" # in routers **.ppp[*].queue.frameCapacity = 10 #**.ppp[*].queue.frameCapacity = 100 # good:(13,15,16,18,19,21-25, 7) bad:(17,20) %#-------------------------------------------------------------------------------------------------------------- %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' cliPerSrv <- 3 srvCount <- 3 * 3 cliCount <- srvCount * cliPerSrv echoFactor <- 2 cliSentBytes <- 10000000 cliRcvdBytes <- cliSentBytes * echoFactor srvRcvdBytes <- cliPerSrv * cliSentBytes srvSentBytes <- srvRcvdBytes * echoFactor # begin TEST: dataset <- loadDataset(scafile) cat("\nOMNETPP TEST RESULT:\n") cli <- dataset$scalars[grep("\\.client\\[\\d\\]\\.tcpApp\\[\\d\\]$",dataset$scalars$module),] cliSent <- cli[cli$name == "bytesSent",] cliRcvd <- cli[cli$name == "bytesRcvd",] srv <- dataset$scalars[grep("\\.server\\.tcpApp\\[\\d\\]$",dataset$scalars$module),] srvSent <- srv[srv$name == "bytesSent",] srvRcvd <- srv[srv$name == "bytesRcvd",] cat("\nTCP SPEED TEST RESULT:\n") if(length(cliSent$value) == cliCount & min(cliSent$value) == cliSentBytes) { cat("CLIENT SENT OK\n") } else { cat("CLIENT SENT BAD:\n") cliSent$rate = cliSent$value*100/cliSentBytes print(cliSent[cliSent$value != cliSentBytes,]) } if(length(srvRcvd$value) == srvCount & min(srvRcvd$value) == srvRcvdBytes) { cat("SERVER RCVD OK\n") } else { cat("SERVER RCVD BAD:\n") srvRcvd$rate = srvRcvd$value*100/srvRcvdBytes print(srvRcvd[srvRcvd$value != srvRcvdBytes,]) } if(length(srvSent$value) == srvCount & min(srvSent$value) == srvSentBytes) { cat("SERVER SENT OK\n") } else { cat("SERVER SENT BAD:\n") srvSent$rate = srvSent$value*100/srvSentBytes print(srvSent[srvSent$value != srvSentBytes,]) } if(length(cliRcvd$value) == cliCount & min(cliRcvd$value) == cliRcvdBytes) { cat("CLIENT RCVD OK\n") } else { cat("CLIENT RCVD BAD:\n") cliRcvd$rate = cliRcvd$value*100/cliRcvdBytes print(cliRcvd[cliRcvd$value != cliRcvdBytes,]) } cat("\n") %#-------------------------------------------------------------------------------------------------------------- %contains: postrun-command(1).out OMNETPP TEST RESULT: TCP SPEED TEST RESULT: CLIENT SENT OK SERVER RCVD OK SERVER SENT OK CLIENT RCVD OK %#--------------------------------------------------------------------------------------------------------------