A RPL regression test that tests that the network survives a random rearrangement

This commit is contained in:
Adam Dunkels 2013-08-11 22:48:01 +02:00 committed by Simon Duquennoy
parent 241a4e0100
commit 4cfefe80e4

View File

@ -0,0 +1,647 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project EXPORT="discard">[APPS_DIR]/mrm</project>
<project EXPORT="discard">[APPS_DIR]/mspsim</project>
<project EXPORT="discard">[APPS_DIR]/avrora</project>
<project EXPORT="discard">[APPS_DIR]/serial_socket</project>
<project EXPORT="discard">[APPS_DIR]/collect-view</project>
<project EXPORT="discard">[APPS_DIR]/powertracker</project>
<simulation>
<title>My simulation</title>
<randomseed>123456</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
se.sics.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>50.0</interference_range>
<success_ratio_tx>1.0</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx>
</radiomedium>
<events>
<logoutput>40000</logoutput>
</events>
<motetype>
se.sics.cooja.contikimote.ContikiMoteType
<identifier>mtype419</identifier>
<description>Sender</description>
<source>[CONFIG_DIR]/code/sender-node.c</source>
<commands>make clean TARGET=cooja
make sender-node.cooja TARGET=cooja</commands>
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Battery</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiVib</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiButton</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiClock</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiLED</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
<symbols>false</symbols>
</motetype>
<motetype>
se.sics.cooja.contikimote.ContikiMoteType
<identifier>mtype484</identifier>
<description>RPL root</description>
<source>[CONFIG_DIR]/code/root-node.c</source>
<commands>make clean TARGET=cooja
make root-node.cooja TARGET=cooja</commands>
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Battery</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiVib</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiButton</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiClock</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiLED</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
<symbols>false</symbols>
</motetype>
<motetype>
se.sics.cooja.contikimote.ContikiMoteType
<identifier>mtype718</identifier>
<description>Receiver</description>
<source>[CONFIG_DIR]/code/receiver-node.c</source>
<commands>make clean TARGET=cooja
make receiver-node.cooja TARGET=cooja</commands>
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Battery</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiVib</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiIPAddress</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiButton</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiClock</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiLED</moteinterface>
<moteinterface>se.sics.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>se.sics.cooja.interfaces.MoteAttributes</moteinterface>
<symbols>false</symbols>
</motetype>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>-0.4799968467515439</x>
<y>98.79087181374759</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>1</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>99.56423154395364</x>
<y>50.06466731257512</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>2</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype419</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>-0.4799968467515439</x>
<y>0.30173505605854883</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>3</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype484</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>12.779318616702257</x>
<y>8.464865358169643</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>4</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>9.391922400291703</x>
<y>49.22878206790311</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>5</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>48.16367625505583</x>
<y>33.27520746599595</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>6</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>16.582742473429345</x>
<y>24.932911331640646</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>7</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>8.445564421140666</x>
<y>6.770205395698742</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>8</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>87.04968129458189</x>
<y>34.46536562612724</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>9</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>94.47123252519145</x>
<y>18.275940194868184</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>10</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>95.28044254364556</x>
<y>17.683438211793558</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>11</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>56.124622439456076</x>
<y>33.88966252832571</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>12</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>98.33149749474546</x>
<y>37.448034626592744</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>13</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>58.75337436025891</x>
<y>68.64082018992522</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>14</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>66.83816496627988</x>
<y>68.38008376830592</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>15</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>90.88648665466316</x>
<y>50.942053906416575</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>16</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>68.80089833632896</x>
<y>84.17294684073734</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>17</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>73.6760846183129</x>
<y>81.76699743886633</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>18</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>0.2960103456537466</x>
<y>98.5587829617092</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>19</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>8.130479493904208</x>
<y>57.642099520821645</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>20</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>30.550120982984865</x>
<y>85.58346736403402</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>21</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>29.65300377698182</x>
<y>63.50257213104861</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>22</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
<mote>
<interface_config>
se.sics.cooja.interfaces.Position
<x>34.92110687576687</x>
<y>70.71381297232249</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiMoteID
<id>23</id>
</interface_config>
<interface_config>
se.sics.cooja.contikimote.interfaces.ContikiRadio
<bitrate>250.0</bitrate>
</interface_config>
<motetype_identifier>mtype718</motetype_identifier>
</mote>
</simulation>
<plugin>
se.sics.cooja.plugins.SimControl
<width>280</width>
<z>1</z>
<height>160</height>
<location_x>400</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.Visualizer
<plugin_config>
<skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.GridVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.MoteTypeVisualizerSkin</skin>
<viewport>1.92914676942954 0.0 0.0 1.92914676942954 75.9259843662471 55.41790879138101</viewport>
</plugin_config>
<width>400</width>
<z>2</z>
<height>400</height>
<location_x>1</location_x>
<location_y>1</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.LogListener
<plugin_config>
<filter />
<formatted_time />
<coloring />
</plugin_config>
<width>1184</width>
<z>3</z>
<height>500</height>
<location_x>402</location_x>
<location_y>162</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.Notes
<plugin_config>
<notes>Enter notes here</notes>
<decorations>true</decorations>
</plugin_config>
<width>904</width>
<z>4</z>
<height>160</height>
<location_x>680</location_x>
<location_y>0</location_y>
</plugin>
<plugin>
se.sics.cooja.plugins.ScriptRunner
<plugin_config>
<script>function place(id, x, y) {&#xD;
var node = sim.getMoteWithID(id);&#xD;
node.getInterfaces().getPosition().setCoordinates(x, y, 0);&#xD;
}&#xD;
&#xD;
function getRandom(min, max) {&#xD;
return Math.random() * (max - min) + min;&#xD;
}&#xD;
&#xD;
// From: http://bost.ocks.org/mike/shuffle/&#xD;
function shuffle(array) {&#xD;
var m = array.length, t, i;&#xD;
&#xD;
// While there remain elements to shuffle…&#xD;
while (m) {&#xD;
&#xD;
// Pick a remaining element…&#xD;
i = Math.floor(Math.random() * m--);&#xD;
&#xD;
// And swap it with the current element.&#xD;
t = array[m];&#xD;
array[m] = array[i];&#xD;
array[i] = t;&#xD;
}&#xD;
&#xD;
return array;&#xD;
}&#xD;
&#xD;
GENERATE_MSG(000000, 'randomize-nodes');&#xD;
GENERATE_MSG(1200000, 'randomize-nodes');&#xD;
GENERATE_MSG(2400000, 'randomize-nodes');&#xD;
GENERATE_MSG(3600000, 'randomize-nodes');&#xD;
&#xD;
var numForwarders = 20;&#xD;
var forwardIDStart = 4;&#xD;
packetsReceived = [];&#xD;
var hops;&#xD;
&#xD;
TIMEOUT(6000000, if(packetsReceived.length &gt; 50) { log.testOK(); } );&#xD;
&#xD;
while(true) {&#xD;
YIELD();&#xD;
if(msg.equals("randomize-nodes")) {&#xD;
log.log('Rearranging network\n');&#xD;
var allnodes = [];&#xD;
for(var i = 0; i &lt; numForwarders; i++) {&#xD;
allnodes.push(i);&#xD;
}&#xD;
shuffle(allnodes);&#xD;
/* Place 1/4 of the nodes in the first quadrant. */&#xD;
var i = 0;&#xD;
for(; i &lt; numForwarders / 4; i++) {&#xD;
place(i + forwardIDStart, &#xD;
getRandom(0, 50),&#xD;
getRandom(0, 50));&#xD;
}&#xD;
/* Place 1/4 of the nodes in the second quadrant. */&#xD;
for(; i &lt; 2 * numForwarders / 4; i++) {&#xD;
place(i + forwardIDStart, &#xD;
getRandom(50, 100),&#xD;
getRandom(0, 50));&#xD;
}&#xD;
/* Place 1/4 of the nodes in the third quadrant. */&#xD;
for(; i &lt; 3 * numForwarders / 4; i++) {&#xD;
place(i + forwardIDStart, &#xD;
getRandom(50, 100),&#xD;
getRandom(50, 100));&#xD;
} &#xD;
/* Place 1/4 of the nodes in the fourth quadrant. */&#xD;
for(; i &lt; 4 * numForwarders / 4; i++) {&#xD;
place(i + forwardIDStart, &#xD;
getRandom(0, 50),&#xD;
getRandom(50, 100));&#xD;
} &#xD;
} else if(msg.startsWith("Sending")) {&#xD;
hops = 0;&#xD;
} else if(msg.startsWith("#L")) {&#xD;
hops++;&#xD;
} else if(msg.startsWith("Data")) {&#xD;
var data = msg.split(" ");&#xD;
var num = parseInt(data[14]);&#xD;
packetsReceived.push(num);&#xD;
&#xD;
/* Copy packetsReceived array to the packets array. */&#xD;
var packets = packetsReceived.slice();&#xD;
var recvstr = '';&#xD;
for(var i = 0; i &lt; num; i++) {&#xD;
if(packets[0] == i) {&#xD;
recvstr += '*';&#xD;
packets.shift();&#xD;
} else {&#xD;
recvstr += '_'; &#xD;
} &#xD;
}&#xD;
log.log(packetsReceived.length + ' packets received: ' + recvstr + '\n');&#xD;
}&#xD;
}</script>
<active>true</active>
</plugin_config>
<width>612</width>
<z>0</z>
<height>726</height>
<location_x>953</location_x>
<location_y>43</location_y>
</plugin>
</simconf>