diff --git a/tools/cooja/contiki_tests/ip_sky_telnet_ping.csc b/tools/cooja/contiki_tests/ip_sky_telnet_ping.csc new file mode 100644 index 000000000..7cc8b8e5c --- /dev/null +++ b/tools/cooja/contiki_tests/ip_sky_telnet_ping.csc @@ -0,0 +1,84 @@ + + + + My simulation + 0 + 1 + 123456 + 1000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + se.sics.cooja.mspmote.SkyMoteType + sky1 + Sky Mote Type #1 + ../../../examples/sky-ip/sky-telnet-server.c + make sky-telnet-server.sky TARGET=sky + + + se.sics.cooja.mspmote.SkyMote + sky1 + + se.sics.cooja.interfaces.Position + 86.60672552430381 + 5.401254433278691 + 0.0 + + + se.sics.cooja.mspmote.interfaces.MspMoteID + 1 + + + + + se.sics.cooja.radiomediums.UDGM$VisUDGM + 127 + 3 + 184 + 265 + 13 + false + + + se.sics.cooja.plugins.SimControl + 248 + 1 + 200 + 1 + 1 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 1024 + 2 + 172 + 0 + 547 + false + + + se.sics.cooja.plugins.NativeIPGateway + 0 + + \Device\NPF_{53CBA059-40AA-4822-BB53-7A5B9AFE77D6} + true + + 388 + 4 + 331 + 3 + 205 + false + + + diff --git a/tools/cooja/contiki_tests/ip_sky_telnet_ping.info b/tools/cooja/contiki_tests/ip_sky_telnet_ping.info new file mode 100644 index 000000000..4c0d7090b --- /dev/null +++ b/tools/cooja/contiki_tests/ip_sky_telnet_ping.info @@ -0,0 +1 @@ +1xSky node: examples/sky-ip/sky-telnet-server.c. Sends 10 pings to 172.16.1.0 via the native IP stack. Test succeeds if more than 5 ping replies are received. diff --git a/tools/cooja/contiki_tests/ip_sky_telnet_ping.js b/tools/cooja/contiki_tests/ip_sky_telnet_ping.js new file mode 100644 index 000000000..ea3306014 --- /dev/null +++ b/tools/cooja/contiki_tests/ip_sky_telnet_ping.js @@ -0,0 +1,45 @@ +if (!msg.contains('Sky telnet process')) { + return; +} + +ipAddress = "172.16.1.0"; +osName = java.lang.System.getProperty("os.name").toLowerCase(); +if (osName.startsWith("win")) { + pingCmd = "ping -n 10 " + ipAddress; +} else { + pingCmd = "ping -c 10 " + ipAddress; +} +replyMsg = "from " + ipAddress; + +ok = global.get('started_ping'); +if (ok == true) { + //log.log("ping already started\n"); + return; +} +global.put('started_ping', true); +global.put('replies', ""); + +var runnableObj = new Object(); +runnableObj.run = function() { + pingProcess = new java.lang.Runtime.getRuntime().exec(pingCmd); + log.log("cmd> " + pingCmd + "\n"); + + stdIn = new java.io.BufferedReader(new java.io.InputStreamReader(pingProcess.getInputStream())); + while ((line = stdIn.readLine()) != null) { + log.log("> " + line + "\n"); + if (line.contains(replyMsg)) { + global.put('replies', global.get('replies') + "1"); + //log.log("reply #" + global.get('replies').length() + "\n"); + } + } + pingProcess.destroy(); + + if (global.get('replies').length() > 5) { + log.testOK(); /* Report test success and quit */ + } else { + log.log("Only " + global.get('replies').length() + "/10 ping replies was received\n"); + log.testFailed(); + } +} +var thread = new java.lang.Thread(new java.lang.Runnable(runnableObj)); +thread.start();