<?xml version='1.0' encoding='UTF-8'?>
<simconf version="2022112801">
  <simulation>
    <title>IPv6 neighbor state: cold start, repeat ping, target reboot</title>
    <randomseed>1</randomseed>
    <motedelay_us>1000000</motedelay_us>
    <radiomedium>
      org.contikios.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>
      org.contikios.cooja.contikimote.ContikiMoteType
      <description>Collection sink 1</description>
      <source>[CONFIG_DIR]/firmware/udp-server.c</source>
      <commands>make TARGET=cooja clean
make -j4 udp-server.cooja TARGET=cooja</commands>
      <moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="0" y="0" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>1</id>
        </interface_config>
      </mote>
    </motetype>
    <motetype>
      org.contikios.cooja.contikimote.ContikiMoteType
      <description>Sampling clients 2-6</description>
      <source>[CONFIG_DIR]/firmware/udp-client.c</source>
      <commands>make TARGET=cooja clean
make -j4 udp-client.cooja TARGET=cooja</commands>
      <moteinterface>org.contikios.cooja.interfaces.Position</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Battery</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiVib</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiMoteID</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRS232</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiBeeper</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.RimeAddress</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.IPAddress</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiRadio</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiButton</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiPIR</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiClock</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiLED</moteinterface>
      <moteinterface>org.contikios.cooja.contikimote.interfaces.ContikiCFS</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.Mote2MoteRelations</moteinterface>
      <moteinterface>org.contikios.cooja.interfaces.MoteAttributes</moteinterface>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="110" y="0" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>2</id>
        </interface_config>
      </mote>
      <mote>
        <interface_config>org.contikios.cooja.interfaces.Position<pos x="70" y="0" />
        </interface_config>
        <interface_config>org.contikios.cooja.contikimote.interfaces.ContikiMoteID<id>3</id>
        </interface_config>
      </mote>
    </motetype>
  </simulation>
  <plugin>org.contikios.cooja.plugins.Visualizer<plugin_config>
      <skin>org.contikios.cooja.plugins.skins.IDVisualizerSkin</skin>
      <skin>org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin</skin>
      <skin>org.contikios.cooja.plugins.skins.UDGMVisualizerSkin</skin>
      <skin>org.contikios.cooja.plugins.skins.GridVisualizerSkin</skin>
      <viewport>4.0 0.0 0.0 4.0 490.0 80.0</viewport>
      <moterelations />
    </plugin_config>
    <bounds x="0" y="0" width="1000" height="475" z="1" />
  </plugin>
  <plugin>org.contikios.cooja.plugins.LogListener<plugin_config>
      <filter>Starting Contiki|Node IPv6 neighbors|Adding neighbor|Pinging|Received ping reply|Timeout|rebooting|state|^--</filter>
      <formatted_time />
      <coloring />
    </plugin_config>
    <bounds x="0" y="480" width="1580" height="430" z="0" />
  </plugin>
  <plugin>org.contikios.cooja.plugins.Notes<plugin_config>
      <notes>Seed 1. Mote 2 starts out of range, then moves into range at 20 s. Inspect ip-nbr before/after root ping, repeat while warm, reboot mote 2, and inspect recovery. UDGM radio is simulated, not field data.</notes>
      <decorations>true</decorations>
    </plugin_config>
    <bounds x="1005" y="0" width="575" height="215" z="3" />
  </plugin>
  <plugin>org.contikios.cooja.plugins.ScriptRunner<plugin_config>
      <script>moved=false; rebooted=false; beforeReplies=0; afterReplies=0;
TIMEOUT(130000, log.log("NEIGHBOR_SUMMARY moved="+moved+" rebooted="+rebooted+" before_replies="+beforeReplies+" after_replies="+afterReplies+"\n"); if(moved &amp;&amp; rebooted &amp;&amp; beforeReplies&gt;=1 &amp;&amp; afterReplies&gt;=1) log.testOK(); else log.testFailed());
GENERATE_MSG(5000,"EVENT cold-nbr"); GENERATE_MSG(15000,"PAUSE 1");
GENERATE_MSG(20000,"EVENT move-relay"); GENERATE_MSG(40000,"EVENT first-ping"); GENERATE_MSG(45000,"PAUSE 2");
GENERATE_MSG(50000,"EVENT warm-ping"); GENERATE_MSG(55000,"EVENT warm-nbr"); GENERATE_MSG(60000,"PAUSE 3");
GENERATE_MSG(65000,"EVENT reboot-target"); GENERATE_MSG(66000,"EVENT target-cold-nbr"); GENERATE_MSG(75000,"PAUSE 4"); GENERATE_MSG(80000,"EVENT target-warm-nbr");
GENERATE_MSG(85000,"EVENT after-nbr"); GENERATE_MSG(90000,"EVENT after-ping"); GENERATE_MSG(100000,"PAUSE 5");
GENERATE_MSG(110000,"EVENT final-nbr"); GENERATE_MSG(120000,"PAUSE 6");
while(true) {
 YIELD(); msg=String(msg); log.log(time+" ID:"+id+" "+msg+"\n");
 if(msg=="EVENT cold-nbr" || msg=="EVENT warm-nbr" || msg=="EVENT after-nbr" || msg=="EVENT final-nbr") write(sim.getMoteWithID(1),"ip-nbr");
 if(msg=="EVENT target-cold-nbr" || msg=="EVENT target-warm-nbr") write(sim.getMoteWithID(2),"ip-nbr");
 if(msg=="EVENT move-relay") { sim.getMoteWithID(2).getInterfaces().getPosition().setCoordinates(35,0,0); moved=true; log.log("MOVE relay=2 x=35 y=0 at_us="+time+"\n"); }
 if(msg=="EVENT first-ping" || msg=="EVENT warm-ping" || msg=="EVENT after-ping") write(sim.getMoteWithID(1),"ping fe80::202:2:2:2");
 if(msg=="EVENT reboot-target") { var stale=sim.getMoteWithID(2); var saved=stale.getConfigXML(); var moteType=stale.getType(); sim.removeMote(stale); var fresh=moteType.generateMote(sim); fresh.setConfigXML(sim,saved,false); sim.addMote(fresh); rebooted=true; log.log("REBOOT target=2 replaced_instance=true at_us="+time+"\n"); }
 if(id==1 &amp;&amp; msg.indexOf("Received ping reply from fe80::202")&gt;=0) { if(rebooted) afterReplies++; else beforeReplies++; }
 if(msg.indexOf("PAUSE ")==0 &amp;&amp; Java.type("org.contikios.cooja.Cooja").isVisualized()) sim.stopSimulation();
}
</script>
      <active>true</active>
    </plugin_config>
    <bounds x="1005" y="220" width="575" height="255" z="4" />
  </plugin>
  <plugin>org.contikios.cooja.plugins.RadioLogger<plugin_config>
      <split>150</split>
      <analyzers>6lowpan</analyzers>
    </plugin_config>
    <bounds x="1005" y="0" width="575" height="475" z="5" />
  </plugin>
</simconf>