added Rime reliable unicast test.

uses examples/rime/example-runicast.c
This commit is contained in:
fros4943 2008-11-11 15:00:43 +00:00
parent 3033201d24
commit 06a8b5d7d6
3 changed files with 194 additions and 0 deletions

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<simulation>
<title>My simulation</title>
<delaytime>0</delaytime>
<ticktime>1</ticktime>
<randomseed>123456</randomseed>
<motedelay>10000</motedelay>
<radiomedium>
se.sics.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>0.0</interference_range>
<success_ratio_tx>0.9</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx>
</radiomedium>
<motetype>
se.sics.cooja.mspmote.SkyMoteType
<identifier>sky1</identifier>
<description>Sky Mote Type #1</description>
<source>../../../examples/rime/example-runicast.c</source>
<command>make example-runicast.sky TARGET=sky</command>
</motetype>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>3.0783332685337617</x>
<y>38.39795740836801</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>1</id>
</interface_config>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>1.1986251808192212</x>
<y>53.65838347315817</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>2</id>
</interface_config>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>34.432838059195255</x>
<y>38.26541658684913</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>3</id>
</interface_config>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<interface_config>
se.sics.cooja.interfaces.Position
<x>150.85510197745134</x>
<y>141.37553211643905</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>4</id>
</interface_config>
</mote>
</simulation>
<plugin>
se.sics.cooja.plugins.SimControl
<width>265</width>
<z>1</z>
<height>200</height>
<location_x>0</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.LogListener
<plugin_config>
<filter>received</filter>
<history>256</history>
</plugin_config>
<width>692</width>
<z>2</z>
<height>209</height>
<location_x>0</location_x>
<location_y>434</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.radiomediums.UDGM$VisUDGM
<width>263</width>
<z>4</z>
<height>125</height>
<location_x>1</location_x>
<location_y>200</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.RadioLogger
<width>427</width>
<z>3</z>
<height>432</height>
<location_x>264</location_x>
<location_y>1</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.VisTraffic
<width>263</width>
<z>5</z>
<height>110</height>
<location_x>1</location_x>
<location_y>324</location_y>
<minimized>false</minimized>
</plugin>
</simconf>

View file

@ -0,0 +1 @@
4 Sky nodes running examples/rime/example-runicast.c. Tests both timeout and send acknowledgements.

View file

@ -0,0 +1,63 @@
/* Count received packets */
if (msg.contains('received')) {
result = global.get("recv");
if (result == null) {
result = 0;
}
result++;
global.put("recv", result);
log.log("Received packets count now: " + result + "\n");
}
/* Count timed out packets */
if (msg.contains('timed out')) {
result = global.get("timeout");
if (result == null) {
result = 0;
}
result++;
global.put("timeout", result);
log.log("Timed out packets count now: " + result + "\n");
}
/* Count sent packets */
if (msg.contains('sent to')) {
result = global.get("sent");
if (result == null) {
result = 0;
}
result++;
global.put("sent", result);
log.log("Sent packets count now: " + result + "\n");
}
/* Look for test completion */
countSent = global.get("sent");
if (countSent >= 10) {
/* Make sure received counter matches sent counter */
countReceived = global.get("recv");
if (countReceived < countSent) {
log.log("Received < Sent: " + countReceived + " < " + countSent + "\n");
log.log("Received packets less than acked sent packets!\n");
log.testFailed();
}
/* Make sure some packets timed out (all from node 4) */
countTimedOut = global.get("timeout");
if (countTimedOut == null || countTimedOut < 2) {
log.log("Timed out: " + countTimedOut + "\n");
log.log("Too few packets timed out!\n");
log.testFailed();
}
log.log("Received / Sent: " + countReceived + " / " + countSent + "\n");
log.log("Timed out: " + countTimedOut + "\n");
log.testOK();
}