rpl-tsch example: use RPL non-storing mode

This commit is contained in:
Simon Duquennoy 2016-06-29 17:06:12 +02:00
parent 00f2344b4a
commit 7a1576815e
5 changed files with 61 additions and 22 deletions

View file

@ -41,6 +41,7 @@
#include "net/rpl/rpl.h" #include "net/rpl/rpl.h"
#include "net/ipv6/uip-ds6-route.h" #include "net/ipv6/uip-ds6-route.h"
#include "net/mac/tsch/tsch.h" #include "net/mac/tsch/tsch.h"
#include "net/rpl/rpl-private.h"
#if WITH_ORCHESTRA #if WITH_ORCHESTRA
#include "orchestra.h" #include "orchestra.h"
#endif /* WITH_ORCHESTRA */ #endif /* WITH_ORCHESTRA */
@ -68,46 +69,73 @@ print_network_status(void)
int i; int i;
uint8_t state; uint8_t state;
uip_ds6_defrt_t *default_route; uip_ds6_defrt_t *default_route;
#if RPL_WITH_STORING
uip_ds6_route_t *route; uip_ds6_route_t *route;
#endif /* RPL_WITH_STORING */
#if RPL_WITH_NON_STORING
rpl_ns_node_t *link;
#endif /* RPL_WITH_NON_STORING */
PRINTA("--- Network status ---\n"); PRINTF("--- Network status ---\n");
/* Our IPv6 addresses */ /* Our IPv6 addresses */
PRINTA("- Server IPv6 addresses:\n"); PRINTF("- Server IPv6 addresses:\n");
for(i = 0; i < UIP_DS6_ADDR_NB; i++) { for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
state = uip_ds6_if.addr_list[i].state; state = uip_ds6_if.addr_list[i].state;
if(uip_ds6_if.addr_list[i].isused && if(uip_ds6_if.addr_list[i].isused &&
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
PRINTA("-- "); PRINTF("-- ");
uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr); PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
PRINTA("\n"); PRINTF("\n");
} }
} }
/* Our default route */ /* Our default route */
PRINTA("- Default route:\n"); PRINTF("- Default route:\n");
default_route = uip_ds6_defrt_lookup(uip_ds6_defrt_choose()); default_route = uip_ds6_defrt_lookup(uip_ds6_defrt_choose());
if(default_route != NULL) { if(default_route != NULL) {
PRINTA("-- "); PRINTF("-- ");
uip_debug_ipaddr_print(&default_route->ipaddr); PRINT6ADDR(&default_route->ipaddr);
PRINTA(" (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval); PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval);
} else { } else {
PRINTA("-- None\n"); PRINTF("-- None\n");
} }
#if RPL_WITH_STORING
/* Our routing entries */ /* Our routing entries */
PRINTA("- Routing entries (%u in total):\n", uip_ds6_route_num_routes()); PRINTF("- Routing entries (%u in total):\n", uip_ds6_route_num_routes());
route = uip_ds6_route_head(); route = uip_ds6_route_head();
while(route != NULL) { while(route != NULL) {
PRINTA("-- "); PRINTF("-- ");
uip_debug_ipaddr_print(&route->ipaddr); PRINT6ADDR(&route->ipaddr);
PRINTA(" via "); PRINTF(" via ");
uip_debug_ipaddr_print(uip_ds6_route_nexthop(route)); PRINT6ADDR(uip_ds6_route_nexthop(route));
PRINTA(" (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime); PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime);
route = uip_ds6_route_next(route); route = uip_ds6_route_next(route);
} }
#endif
PRINTA("----------------------\n"); #if RPL_WITH_NON_STORING
/* Our routing links */
PRINTF("- Routing links (%u in total):\n", rpl_ns_num_nodes());
link = rpl_ns_node_head();
while(link != NULL) {
if(link->parent != NULL) {
uip_ipaddr_t child_ipaddr;
uip_ipaddr_t parent_ipaddr;
rpl_ns_get_node_global_addr(&child_ipaddr, link);
rpl_ns_get_node_global_addr(&parent_ipaddr, link->parent);
PRINTF("-- ");
PRINT6ADDR(&child_ipaddr);
PRINTF(" to ");
PRINT6ADDR(&parent_ipaddr);
PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)link->lifetime);
}
link = rpl_ns_node_next(link);
}
#endif
PRINTF("----------------------\n");
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static void static void

View file

@ -45,6 +45,17 @@
#define WITH_SECURITY 0 #define WITH_SECURITY 0
#endif /* WITH_SECURITY */ #endif /* WITH_SECURITY */
/*******************************************************/
/********* Enable RPL non-storing mode *****************/
/*******************************************************/
#undef UIP_CONF_MAX_ROUTES
#define UIP_CONF_MAX_ROUTES 0 /* No need for routes */
#undef RPL_CONF_MOP
#define RPL_CONF_MOP RPL_MOP_NON_STORING /* Mode of operation*/
#undef ORCHESTRA_CONF_RULES
#define ORCHESTRA_CONF_RULES { &eb_per_time_source, &unicast_per_neighbor_rpl_ns, &default_common } /* Orchestra in non-storing */
/*******************************************************/ /*******************************************************/
/********************* Enable TSCH *********************/ /********************* Enable TSCH *********************/
/*******************************************************/ /*******************************************************/
@ -140,8 +151,8 @@
#define UIP_CONF_TCP 0 #define UIP_CONF_TCP 0
#undef QUEUEBUF_CONF_NUM #undef QUEUEBUF_CONF_NUM
#define QUEUEBUF_CONF_NUM 3 #define QUEUEBUF_CONF_NUM 3
#undef UIP_CONF_MAX_ROUTES #undef RPL_NS_CONF_LINK_NUM
#define UIP_CONF_MAX_ROUTES 8 #define RPL_NS_CONF_LINK_NUM 8
#undef NBR_TABLE_CONF_MAX_NEIGHBORS #undef NBR_TABLE_CONF_MAX_NEIGHBORS
#define NBR_TABLE_CONF_MAX_NEIGHBORS 8 #define NBR_TABLE_CONF_MAX_NEIGHBORS 8
#undef UIP_CONF_ND6_SEND_NA #undef UIP_CONF_ND6_SEND_NA

View file

@ -272,7 +272,7 @@ make node.z1 TARGET=z1 MAKE_WITH_ORCHESTRA=0 MAKE_WITH_SECURITY=0</commands>
/* Wait until a node (can only be the DAGRoot) has&#xD; /* Wait until a node (can only be the DAGRoot) has&#xD;
* 8 routing entries (i.e. can reach every node) */&#xD; * 8 routing entries (i.e. can reach every node) */&#xD;
log.log("Waiting for routing tables to fill\n");&#xD; log.log("Waiting for routing tables to fill\n");&#xD;
WAIT_UNTIL(msg.endsWith("Routing entries (8 in total):"));&#xD; WAIT_UNTIL(msg.endsWith("Routing links (8 in total):"));&#xD;
log.log("Root routing table ready\n");&#xD; log.log("Root routing table ready\n");&#xD;
&#xD; &#xD;
log.testOK(); /* Report test success and quit */</script> log.testOK(); /* Report test success and quit */</script>

View file

@ -277,7 +277,7 @@ log.log("Orchestra started\n");&#xD;
/* Wait until a node (can only be the DAGRoot) has&#xD; /* Wait until a node (can only be the DAGRoot) has&#xD;
* 8 routing entries (i.e. can reach every node) */&#xD; * 8 routing entries (i.e. can reach every node) */&#xD;
log.log("Waiting for routing tables to fill\n");&#xD; log.log("Waiting for routing tables to fill\n");&#xD;
WAIT_UNTIL(msg.endsWith("Routing entries (8 in total):"));&#xD; WAIT_UNTIL(msg.endsWith("Routing links (8 in total):"));&#xD;
log.log("Root routing table ready\n");&#xD; log.log("Root routing table ready\n");&#xD;
&#xD; &#xD;
log.testOK(); /* Report test success and quit */</script> log.testOK(); /* Report test success and quit */</script>

View file

@ -274,7 +274,7 @@ log.log("Waiting for association with security\n");&#xD;
/* Wait until a node (can only be the DAGRoot) has&#xD; /* Wait until a node (can only be the DAGRoot) has&#xD;
* 8 routing entries (i.e. can reach every node) */&#xD; * 8 routing entries (i.e. can reach every node) */&#xD;
log.log("Waiting for routing tables to fill\n");&#xD; log.log("Waiting for routing tables to fill\n");&#xD;
WAIT_UNTIL(msg.endsWith("Routing entries (8 in total):"));&#xD; WAIT_UNTIL(msg.endsWith("Routing links (8 in total):"));&#xD;
log.log("Root routing table ready\n");&#xD; log.log("Root routing table ready\n");&#xD;
&#xD; &#xD;
log.testOK(); /* Report test success and quit */</script> log.testOK(); /* Report test success and quit */</script>