Simulation test with more RPL nodes than the network can handle that attempt to access a remote HTTP server. After completing their connection, they go to feather mode, freeing up route table entries in the network, to let more nodes reach the HTTP server
This commit is contained in:
parent
bfb29d2f11
commit
52006aec0f
9 changed files with 1242 additions and 0 deletions
78
regression-tests/21-large-rpl/testscript.js
Normal file
78
regression-tests/21-large-rpl/testscript.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
|
||||
TIMEOUT(2400000); /* 40 minutes */
|
||||
|
||||
var NR_FEATHERS = mote.getSimulation().getMotesCount() - 1;
|
||||
|
||||
/* conf */
|
||||
var travis = java.lang.System.getenv().get("TRAVIS");
|
||||
if (travis == null) {
|
||||
/* Instant Contiki */
|
||||
CMD_TUNNEL = "echo '-vj' > ~/.slirprc && make Connect.class && java Connect 'nc localhost 60001' 'script -t -f -c slirp'";
|
||||
CMD_PING = "ping -c 5 8.8.8.8";
|
||||
CMD_DIR = "../../wpcapslip";
|
||||
} else {
|
||||
/* Travis */
|
||||
CMD_TUNNEL = "cd $TRAVIS_BUILD_DIR/tools/wpcapslip && sudo apt-get install slirp && echo '-vj' > ~/.slirprc && make Connect.class && java Connect 'nc localhost 60001' 'script -t -f -c slirp'";
|
||||
CMD_PING = "ping -c 5 8.8.8.8";
|
||||
CMD_DIR = ".";
|
||||
}
|
||||
|
||||
/* delay */
|
||||
GENERATE_MSG(1000, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
/* realtime speed */
|
||||
sim.setSpeedLimit(2.0);
|
||||
|
||||
/* tunnel interface */
|
||||
log.log("opening tunnel interface: " + CMD_TUNNEL + "\n");
|
||||
launcher = new java.lang.ProcessBuilder["(java.lang.String[])"](['sh','-c',CMD_TUNNEL]);
|
||||
launcher.directory(new java.io.File(CMD_DIR));
|
||||
launcher.redirectErrorStream(true);
|
||||
tunProcess = launcher.start();
|
||||
tunRunnable = new Object();
|
||||
tunRunnable.run = function() {
|
||||
var stdIn = new java.io.BufferedReader(new java.io.InputStreamReader(tunProcess.getInputStream()));
|
||||
while ((line = stdIn.readLine()) != null) {
|
||||
if (line != null && !line.trim().equals("")) {
|
||||
//log.log("TUN> " + line + "\n");
|
||||
}
|
||||
}
|
||||
tunProcess.destroy();
|
||||
}
|
||||
new java.lang.Thread(new java.lang.Runnable(tunRunnable)).start();
|
||||
|
||||
GENERATE_MSG(1000, "continue");
|
||||
YIELD_THEN_WAIT_UNTIL(msg.equals("continue"));
|
||||
|
||||
/* ping */
|
||||
log.log("pinging: " + CMD_PING + "\n");
|
||||
launcher = new java.lang.ProcessBuilder["(java.lang.String[])"](['sh','-c',CMD_PING]);
|
||||
launcher.directory(new java.io.File(CMD_DIR));
|
||||
launcher.redirectErrorStream(true);
|
||||
tunProcess = launcher.start();
|
||||
tunRunnable = new Object();
|
||||
tunRunnable.run = function() {
|
||||
var stdIn = new java.io.BufferedReader(new java.io.InputStreamReader(tunProcess.getInputStream()));
|
||||
while ((line = stdIn.readLine()) != null) {
|
||||
if (line != null && !line.trim().equals("")) {
|
||||
log.log("PING> " + line + "\n");
|
||||
}
|
||||
}
|
||||
tunProcess.destroy();
|
||||
}
|
||||
new java.lang.Thread(new java.lang.Runnable(tunRunnable)).start();
|
||||
|
||||
var completed = {};
|
||||
while(Object.keys(completed).length < NR_FEATHERS) {
|
||||
if (!msg.startsWith("#L") && !msg.startsWith("E")) {
|
||||
//log.log(mote + ": " + msg + "\n");
|
||||
}
|
||||
if (id != 1 && msg.startsWith("HTTP socket closed")) {
|
||||
completed[id] = id;
|
||||
log.log("Data compelete " + id + ", heard " + Object.keys(completed).length + " in total\n");
|
||||
}
|
||||
YIELD();
|
||||
}
|
||||
|
||||
log.testOK();
|
Loading…
Add table
Add a link
Reference in a new issue