From 52006aec0f4b05bc12b94041d43a1b2d689ae06b Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Wed, 26 Aug 2015 15:26:32 +0200 Subject: [PATCH] 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 --- .../21-large-rpl/01-cooja-http-socket-50.csc | 1006 +++++++++++++++++ regression-tests/21-large-rpl/Makefile | 1 + .../21-large-rpl/code/node/Makefile | 7 + .../21-large-rpl/code/node/client.c | 103 ++ .../21-large-rpl/code/node/project-conf.h | 6 + .../21-large-rpl/code/router/Makefile | 5 + .../21-large-rpl/code/router/project-conf.h | 9 + .../21-large-rpl/code/router/router.c | 27 + regression-tests/21-large-rpl/testscript.js | 78 ++ 9 files changed, 1242 insertions(+) create mode 100644 regression-tests/21-large-rpl/01-cooja-http-socket-50.csc create mode 100644 regression-tests/21-large-rpl/Makefile create mode 100644 regression-tests/21-large-rpl/code/node/Makefile create mode 100644 regression-tests/21-large-rpl/code/node/client.c create mode 100644 regression-tests/21-large-rpl/code/node/project-conf.h create mode 100644 regression-tests/21-large-rpl/code/router/Makefile create mode 100644 regression-tests/21-large-rpl/code/router/project-conf.h create mode 100644 regression-tests/21-large-rpl/code/router/router.c create mode 100644 regression-tests/21-large-rpl/testscript.js diff --git a/regression-tests/21-large-rpl/01-cooja-http-socket-50.csc b/regression-tests/21-large-rpl/01-cooja-http-socket-50.csc new file mode 100644 index 000000000..48b6f9718 --- /dev/null +++ b/regression-tests/21-large-rpl/01-cooja-http-socket-50.csc @@ -0,0 +1,1006 @@ + + + [APPS_DIR]/mrm + [APPS_DIR]/mspsim + [APPS_DIR]/avrora + [APPS_DIR]/serial_socket + [APPS_DIR]/collect-view + [APPS_DIR]/powertracker + + My simulation + 2.0 + generated + 1000000 + + org.contikios.cooja.radiomediums.UDGM + 50.0 + 100.0 + 1.0 + 1.0 + + + 40000 + + + org.contikios.cooja.contikimote.ContikiMoteType + mtype812 + router TARGET=cooja-ip64 + [CONTIKI_DIR]/regression-tests/21-large-rpl/code/router/router.c + echo make clean TARGET=cooja-ip64 +make router.cooja-ip64 TARGET=cooja-ip64 + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.Battery + org.contikios.cooja.contikimote.interfaces.ContikiVib + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + org.contikios.cooja.contikimote.interfaces.ContikiBeeper + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.contikimote.interfaces.ContikiIPAddress + org.contikios.cooja.contikimote.interfaces.ContikiRadio + org.contikios.cooja.contikimote.interfaces.ContikiButton + org.contikios.cooja.contikimote.interfaces.ContikiPIR + org.contikios.cooja.contikimote.interfaces.ContikiClock + org.contikios.cooja.contikimote.interfaces.ContikiLED + org.contikios.cooja.contikimote.interfaces.ContikiCFS + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + false + + + org.contikios.cooja.contikimote.ContikiMoteType + mtype833 + client + [CONTIKI_DIR]/regression-tests/21-large-rpl/code/node/client.c + echo make clean TARGET=cooja +make client.cooja TARGET=cooja + org.contikios.cooja.interfaces.Position + org.contikios.cooja.interfaces.Battery + org.contikios.cooja.contikimote.interfaces.ContikiVib + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + org.contikios.cooja.contikimote.interfaces.ContikiRS232 + org.contikios.cooja.contikimote.interfaces.ContikiBeeper + org.contikios.cooja.interfaces.RimeAddress + org.contikios.cooja.contikimote.interfaces.ContikiIPAddress + org.contikios.cooja.contikimote.interfaces.ContikiRadio + org.contikios.cooja.contikimote.interfaces.ContikiButton + org.contikios.cooja.contikimote.interfaces.ContikiPIR + org.contikios.cooja.contikimote.interfaces.ContikiClock + org.contikios.cooja.contikimote.interfaces.ContikiLED + org.contikios.cooja.contikimote.interfaces.ContikiCFS + org.contikios.cooja.interfaces.Mote2MoteRelations + org.contikios.cooja.interfaces.MoteAttributes + false + + + + org.contikios.cooja.interfaces.Position + 55.719691912311305 + 37.8697579181178 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 1 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype812 + + + + org.contikios.cooja.interfaces.Position + 33.16398380436391 + 28.280100446725353 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 2 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 64.7333702437188 + 86.25343669492709 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 3 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 34.382213480997194 + 87.3651616010611 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 4 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 11.332821198243948 + 72.43057435800137 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 5 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 95.94512295362799 + 71.39152480287795 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 6 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 34.51186307444599 + 59.489544081261435 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 7 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 63.02063881741806 + 6.725737893296902 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 8 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 67.16488021441937 + 54.31377260130722 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 9 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 9.784878122518437 + 81.00283052134533 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 10 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 32.10074353933871 + 33.071992737644926 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 11 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 91.82438265710196 + 51.23700415853406 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 12 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 21.195462105769337 + 82.08222111459202 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 13 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 55.73823429127498 + 69.24022125144269 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 14 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 69.71587306768029 + 57.37071024636343 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 15 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 66.69012609363311 + 68.93236248473207 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 16 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 66.84314708507073 + 32.20129384563065 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 17 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 75.11303983172269 + 17.658699966744983 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 18 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 27.078612584793017 + 97.3945649089831 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 19 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 63.37580990146204 + 30.66028070022273 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 20 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 3.866240569639967 + 58.00787820279949 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 21 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 57.433437740562496 + 12.398752526430156 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 22 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 15.784041174017371 + 74.78102139434115 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 23 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 40.67175327199246 + 52.46247320344863 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 24 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 38.43045934512656 + 90.56311604010655 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 25 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 0.6068936092190724 + 21.344443973676874 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 26 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 60.36615377515271 + 86.59995801287768 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 27 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 14.39476252794466 + 9.985669338749425 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 28 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 95.14872168386105 + 45.936172484167905 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 29 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 61.80198040806143 + 14.891226267286084 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 30 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 32.11354654266005 + 38.51630620185639 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 31 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 37.711371799794335 + 18.547318360664853 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 32 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 58.34301426026205 + 95.91480486240545 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 33 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 20.456374070589078 + 13.31295283913667 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 34 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 4.789895861056081 + 41.25598476863351 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 35 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 22.62971444227585 + 28.645182034255324 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 36 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 60.457329857492034 + 24.40308696160821 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 37 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 4.1096555252476685 + 27.46211937285302 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 38 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 87.008751083046 + 87.28519710099914 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 39 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 86.65741005585366 + 99.07543884063683 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 40 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 96.56473544385348 + 56.74413810869915 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 41 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 63.1598358033005 + 41.18799873508732 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 42 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 14.556676924656397 + 98.24257311359364 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 43 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 34.70728168935242 + 31.89373622088234 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 44 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 91.35334037714965 + 83.59007856757782 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 45 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 57.18004847306107 + 1.5650913544456135 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 46 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 97.14688174768989 + 29.613231105554448 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 47 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 12.528733239940715 + 23.28442121821601 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 48 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 97.65915972314534 + 57.204021167070664 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 49 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 94.8211477197945 + 15.57384229665848 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 50 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.interfaces.Position + 69.1730393490499 + 35.900983349410275 + 0.0 + + + org.contikios.cooja.contikimote.interfaces.ContikiMoteID + 51 + + + org.contikios.cooja.contikimote.interfaces.ContikiRadio + 250.0 + + mtype833 + + + + org.contikios.cooja.plugins.SimControl + 280 + 3 + 160 + 606 + 15 + + + org.contikios.cooja.plugins.Visualizer + + true + org.contikios.cooja.plugins.skins.IDVisualizerSkin + org.contikios.cooja.plugins.skins.GridVisualizerSkin + org.contikios.cooja.plugins.skins.MoteTypeVisualizerSkin + org.contikios.cooja.plugins.skins.LEDVisualizerSkin + org.contikios.cooja.plugins.skins.UDGMVisualizerSkin + 2.927428245448204 0.0 0.0 2.927428245448204 50.166589953058406 9.691034635016393 + + 401 + 0 + 368 + 29 + 27 + + + org.contikios.cooja.plugins.LogListener + + close + + + + 685 + 2 + 429 + 34 + 307 + + + org.contikios.cooja.plugins.ScriptRunner + + [CONTIKI_DIR]/regression-tests/21-large-rpl/testscript.js + true + + 960 + 1 + 682 + 528 + 192 + + + org.contikios.cooja.serialsocket.SerialSocketServer + 0 + + 60001 + true + + 362 + 4 + 116 + 234 + 101 + + + diff --git a/regression-tests/21-large-rpl/Makefile b/regression-tests/21-large-rpl/Makefile new file mode 100644 index 000000000..272bc7da1 --- /dev/null +++ b/regression-tests/21-large-rpl/Makefile @@ -0,0 +1 @@ +include ../Makefile.simulation-test diff --git a/regression-tests/21-large-rpl/code/node/Makefile b/regression-tests/21-large-rpl/code/node/Makefile new file mode 100644 index 000000000..cbaa72ef7 --- /dev/null +++ b/regression-tests/21-large-rpl/code/node/Makefile @@ -0,0 +1,7 @@ +CONTIKI=../../../.. + +MODULES += core/net/http-socket + +CFLAGS+=-DPROJECT_CONF_H=\"project-conf.h\" + +include $(CONTIKI)/Makefile.include diff --git a/regression-tests/21-large-rpl/code/node/client.c b/regression-tests/21-large-rpl/code/node/client.c new file mode 100644 index 000000000..386f18529 --- /dev/null +++ b/regression-tests/21-large-rpl/code/node/client.c @@ -0,0 +1,103 @@ +#include "contiki-net.h" +#include "http-socket.h" +#include "ip64-addr.h" +#include "dev/leds.h" +#include "rpl.h" + +#include + +static struct http_socket s; +static int bytes_received = 0; +static int restarts; +static struct ctimer reconnect_timer; + +static void callback(struct http_socket *s, void *ptr, + http_socket_event_t e, + const uint8_t *data, uint16_t datalen); + +/*---------------------------------------------------------------------------*/ +PROCESS(http_example_process, "HTTP Example"); +AUTOSTART_PROCESSES(&http_example_process); +/*---------------------------------------------------------------------------*/ +static void +reconnect(void *dummy) +{ + rpl_set_mode(RPL_MODE_MESH); + http_socket_get(&s, "http://www.contiki-os.org/", 0, 0, + callback, NULL); +} +/*---------------------------------------------------------------------------*/ +static void +restart(void) +{ + int scale; + restarts++; + printf("restart %d\n", restarts); + + scale = restarts; + if(scale > 5) { + scale = 5; + } + ctimer_set(&reconnect_timer, random_rand() % ((CLOCK_SECOND * 10) << scale), + reconnect, NULL); +} +/*---------------------------------------------------------------------------*/ +static void +callback(struct http_socket *s, void *ptr, + http_socket_event_t e, + const uint8_t *data, uint16_t datalen) +{ + if(e == HTTP_SOCKET_ERR) { + printf("HTTP socket error\n"); + } else if(e == HTTP_SOCKET_TIMEDOUT) { + printf("HTTP socket error: timed out\n"); + restart(); + } else if(e == HTTP_SOCKET_ABORTED) { + printf("HTTP socket error: aborted\n"); + restart(); + } else if(e == HTTP_SOCKET_HOSTNAME_NOT_FOUND) { + printf("HTTP socket error: hostname not found\n"); + restart(); + } else if(e == HTTP_SOCKET_CLOSED) { + if(bytes_received > 0) { + printf("HTTP socket closed, %d bytes received\n", bytes_received); + leds_off(LEDS_RED); + rpl_set_mode(RPL_MODE_FEATHER); + } else { + restart(); + } + } else if(e == HTTP_SOCKET_DATA) { + bytes_received += datalen; + printf("HTTP socket received %d bytes of data\n", datalen); + } +} +/*---------------------------------------------------------------------------*/ +PROCESS_THREAD(http_example_process, ev, data) +{ + static struct etimer et; + uip_ip4addr_t ip4addr; + uip_ip6addr_t ip6addr; + + PROCESS_BEGIN(); + + uip_ipaddr(&ip4addr, 8,8,8,8); + ip64_addr_4to6(&ip4addr, &ip6addr); + uip_nameserver_update(&ip6addr, UIP_NAMESERVER_INFINITE_LIFETIME); + + etimer_set(&et, CLOCK_SECOND * 20); + PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); + + http_socket_init(&s); + http_socket_get(&s, "http://www.contiki-os.org/", 0, 0, + callback, NULL); + leds_on(LEDS_RED); + restarts = 0; + etimer_set(&et, CLOCK_SECOND); + while(1) { + PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); + etimer_reset(&et); + } + + PROCESS_END(); +} +/*---------------------------------------------------------------------------*/ diff --git a/regression-tests/21-large-rpl/code/node/project-conf.h b/regression-tests/21-large-rpl/code/node/project-conf.h new file mode 100644 index 000000000..c8cfeb645 --- /dev/null +++ b/regression-tests/21-large-rpl/code/node/project-conf.h @@ -0,0 +1,6 @@ +#define QUEUEBUF_CONF_STATS 1 +#define RESOLV_CONF_SUPPORTS_MDNS 0 +#define COOJA_MTARCH_STACKSIZE 4096 + +#define UIP_CONF_MAX_ROUTES 3 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 3 diff --git a/regression-tests/21-large-rpl/code/router/Makefile b/regression-tests/21-large-rpl/code/router/Makefile new file mode 100644 index 000000000..a482f0a6a --- /dev/null +++ b/regression-tests/21-large-rpl/code/router/Makefile @@ -0,0 +1,5 @@ +CONTIKI=../../../.. + +CFLAGS+=-DPROJECT_CONF_H=\"project-conf.h\" + +include $(CONTIKI)/Makefile.include diff --git a/regression-tests/21-large-rpl/code/router/project-conf.h b/regression-tests/21-large-rpl/code/router/project-conf.h new file mode 100644 index 000000000..2fa5e2977 --- /dev/null +++ b/regression-tests/21-large-rpl/code/router/project-conf.h @@ -0,0 +1,9 @@ +#define QUEUEBUF_CONF_STATS 1 +#define RESOLV_CONF_SUPPORTS_MDNS 0 +#define COOJA_MTARCH_STACKSIZE 4096 + +#define UIP_CONF_MAX_ROUTES 8 +#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 + +/*#define RPL_CONF_DEFAULT_LIFETIME_UNIT 10 + #define RPL_CONF_DEFAULT_LIFETIME 10*/ diff --git a/regression-tests/21-large-rpl/code/router/router.c b/regression-tests/21-large-rpl/code/router/router.c new file mode 100644 index 000000000..391b5038b --- /dev/null +++ b/regression-tests/21-large-rpl/code/router/router.c @@ -0,0 +1,27 @@ +#include "contiki.h" +#include "contiki-net.h" +#include "ip64.h" +#include "net/netstack.h" + +/*---------------------------------------------------------------------------*/ +PROCESS(router_node_process, "Router node"); +AUTOSTART_PROCESSES(&router_node_process); +/*---------------------------------------------------------------------------*/ +PROCESS_THREAD(router_node_process, ev, data) +{ + PROCESS_BEGIN(); + + /* Set us up as a RPL root node. */ + rpl_dag_root_init_dag(); + + /* Initialize the IP64 module so we'll start translating packets */ + ip64_init(); + + /* ... and do nothing more. */ + while(1) { + PROCESS_WAIT_EVENT(); + } + + PROCESS_END(); +} +/*---------------------------------------------------------------------------*/ diff --git a/regression-tests/21-large-rpl/testscript.js b/regression-tests/21-large-rpl/testscript.js new file mode 100644 index 000000000..0c23bceef --- /dev/null +++ b/regression-tests/21-large-rpl/testscript.js @@ -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();