diff --git a/tools/cooja/contiki_tests/rime_collect.csc b/tools/cooja/contiki_tests/rime_collect.csc new file mode 100644 index 000000000..effa723fd --- /dev/null +++ b/tools/cooja/contiki_tests/rime_collect.csc @@ -0,0 +1,535 @@ + + + + Rime collect test + 0 + 1 + 123456 + 1000 + + se.sics.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + se.sics.cooja.contikimote.ContikiMoteType + mtype7 + Contiki Mote #1 + ../../.. + ../../../platform/cooja + ../../../examples/rime + ../apps/mrm + ../apps/mspsim + ../../../examples/rime + ../../../examples/rime + ../../../examples/rime/example-collect.c + example_collect_process + pir_sensor + vib_sensor + button_sensor + radio_sensor + se.sics.cooja.interfaces.Position + se.sics.cooja.interfaces.Battery + se.sics.cooja.contikimote.interfaces.ContikiVib + se.sics.cooja.contikimote.interfaces.ContikiMoteID + se.sics.cooja.contikimote.interfaces.ContikiRS232 + se.sics.cooja.contikimote.interfaces.ContikiBeeper + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + se.sics.cooja.contikimote.interfaces.ContikiRadio + se.sics.cooja.contikimote.interfaces.ContikiButton + se.sics.cooja.contikimote.interfaces.ContikiPIR + se.sics.cooja.contikimote.interfaces.ContikiClock + se.sics.cooja.contikimote.interfaces.ContikiLED + se.sics.cooja.contikimote.interfaces.ContikiLog + se.sics.cooja.contikimote.interfaces.ContikiCFS + cfs_interface + pir_interface + radio_interface + vib_interface + rs232_interface + button_interface + beep_interface + leds_interface + moteid_interface + ip_interface + clock_interface + simlog_interface + false + Rime + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 50.829139451170256 + 62.671405251575884 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.9.16 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 66.70779372167401 + 87.6357288540325 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.10.16 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 41.129223698257974 + 11.860747327849797 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.16.4 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 3.896453344832884 + 57.94647173289612 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.17.2 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 66.34456950462831 + 23.965576279871247 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.8.8 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 70.88189625059834 + 87.6624950776213 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.16.12 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 19.09803704982651 + 38.15109163392978 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.8.4 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 89.63745297998314 + 5.041038966356015 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.3.6 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 13.348832186584092 + 21.93390094486253 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 9 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.15.15 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 1.674784139064478 + 14.130140721379835 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 10 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.4.19 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 47.87142051729898 + 7.506518941902218 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 11 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.5.7 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 26.88271893793631 + 45.005087461409865 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 12 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.17.17 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 56.02971812708909 + 26.88551057316878 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 13 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.13.11 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 95.69470045280002 + 71.59310205157577 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 14 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.14.17 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 31.731698652367335 + 39.71639147226488 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 15 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.16.19 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 2.8792353689463424 + 51.72896355140204 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 16 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.2.4 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 51.07177717821779 + 90.91445330727116 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 17 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.8.9 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 43.42318694224158 + 91.44323457482095 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 18 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.16.4 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 87.22205782780289 + 48.33830904569607 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 19 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.6.15 + + + + se.sics.cooja.contikimote.ContikiMote + mtype7 + + se.sics.cooja.interfaces.Position + 1.6332448872152683 + 32.64258506789177 + 0.0 + + + se.sics.cooja.interfaces.Battery + false + + + se.sics.cooja.contikimote.interfaces.ContikiMoteID + 20 + + + se.sics.cooja.contikimote.interfaces.ContikiIPAddress + 10.10.18.5 + + + + + se.sics.cooja.plugins.SimControl + 223 + 4 + 227 + 0 + 0 + false + + + se.sics.cooja.plugins.VisState + 300 + 3 + 300 + 723 + 0 + false + + + se.sics.cooja.plugins.LogListener + + + 256 + + 1023 + 2 + 207 + 0 + 461 + false + + + diff --git a/tools/cooja/contiki_tests/rime_collect.info b/tools/cooja/contiki_tests/rime_collect.info new file mode 100644 index 000000000..45a25ee7d --- /dev/null +++ b/tools/cooja/contiki_tests/rime_collect.info @@ -0,0 +1 @@ +Tests the Rime collect primitive, uses the code in examples/rime/example-collect.c diff --git a/tools/cooja/contiki_tests/rime_collect.js b/tools/cooja/contiki_tests/rime_collect.js new file mode 100644 index 000000000..18ba7fc3e --- /dev/null +++ b/tools/cooja/contiki_tests/rime_collect.js @@ -0,0 +1,128 @@ +TIMEOUT(300000, log.log("Timeout\n")); + +function +print_stats() +{ + log.log("Received " + total_received + " messages, " + + (total_received / nrNodes) + " messages/node, " + + total_lost + " lost, " + + (total_lost / nrNodes) + " lost/node, " + + total_dups + " dups, " + + (total_dups / nrNodes) + " dups/node, " + + (total_hops / total_received) + " hops/message\n"); + log.log("Received: "); + for(i = 1; i <= nrNodes; i++) { + log.log(count[i] + " "); + } + log.log("\n"); + log.log("Hops: "); + for(i = 1; i <= nrNodes; i++) { + log.log(hops[i] + " "); + } + log.log("\n"); + log.log("Seqnos: "); + for(i = 1; i <= nrNodes; i++) { + log.log(seqnos[i] + " "); + } + log.log("\n"); + log.log("Lost: "); + for(i = 1; i <= nrNodes; i++) { + log.log(lost[i] + " "); + } + log.log("\n"); + log.log("Dups: "); + for(i = 1; i <= nrNodes; i++) { + log.log(dups[i] + " "); + } + log.log("\n"); +} + +/* Conf. */ +booted = new Array(); +count = new Array(); +hops = new Array(); +seqnos = new Array(); +lost = new Array(); +dups = new Array(); +nrNodes = 20; +total_received = 0; +total_lost = 0; +total_hops = 0; +total_dups = 0; +nodes_starting = true; +for(i = 1; i <= nrNodes; i++) { + booted[i] = false; + count[i] = 0; + hops[i] = 0; + seqnos[i] = -1; + lost[i] = 0; + dups[i] = 0; +} + +/* Wait until all nodes have started */ +while(nodes_starting) { + YIELD_THEN_WAIT_UNTIL(msg.startsWith('Starting')); + + log.log("Node " + id + " booted\n"); + booted[id] = true; + + for(i = 1; i <= nrNodes; i++) { + if(!booted[i]) { + break; + } + if(i == nrNodes) { + nodes_starting = false; + } + } +} + +/* Create sink */ +log.log("All nodes booted, creating sink at node " + id + "\n"); +mote.getInterfaces().getButton().clickButton() + +while(true) { + YIELD(); + + /* Count sensor data packets */ + node_text = msg.split(" ")[4]; + seqno_text = msg.split(" ")[6]; + hops_text = msg.split(" ")[8]; + if(node_text) { + source = parseInt(node_text); + seqno = parseInt(seqno_text); + hop = parseInt(hops_text); + count[source]++; + hops[source] = hop; + seqno_gap = seqno - seqnos[source]; + seqnos[source] = seqno; + + total_received++; + total_hops += hop; + + if(seqno_gap == 2) { + total_lost += seqno_gap - 1; + lost[source] += seqno_gap - 1; + } else if(seqno_gap == 0) { + total_dups += 1; + dups[source] += 1; + } + } + /* Fail if the sink has received more than 10 messages from any node. */ + for(i = 1; i <= nrNodes; i++) { + if(count[i] > 10) { + print_stats(); + log.testFailed(); /* We are done! */ + } + } + + /* Wait until the sink have received at least two messages from every node */ + for(i = 1; i <= nrNodes; i++) { + if(count[i] < 2) { + break; + } + if(i == nrNodes) { + print_stats(); + log.testOK(); + } + } +}