rpl-tsch example: use RPL non-storing mode
This commit is contained in:
parent
00f2344b4a
commit
7a1576815e
@ -41,6 +41,7 @@
|
||||
#include "net/rpl/rpl.h"
|
||||
#include "net/ipv6/uip-ds6-route.h"
|
||||
#include "net/mac/tsch/tsch.h"
|
||||
#include "net/rpl/rpl-private.h"
|
||||
#if WITH_ORCHESTRA
|
||||
#include "orchestra.h"
|
||||
#endif /* WITH_ORCHESTRA */
|
||||
@ -68,46 +69,73 @@ print_network_status(void)
|
||||
int i;
|
||||
uint8_t state;
|
||||
uip_ds6_defrt_t *default_route;
|
||||
#if RPL_WITH_STORING
|
||||
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 */
|
||||
PRINTA("- Server IPv6 addresses:\n");
|
||||
PRINTF("- Server IPv6 addresses:\n");
|
||||
for(i = 0; i < UIP_DS6_ADDR_NB; i++) {
|
||||
state = uip_ds6_if.addr_list[i].state;
|
||||
if(uip_ds6_if.addr_list[i].isused &&
|
||||
(state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) {
|
||||
PRINTA("-- ");
|
||||
uip_debug_ipaddr_print(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
PRINTA("\n");
|
||||
PRINTF("-- ");
|
||||
PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr);
|
||||
PRINTF("\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Our default route */
|
||||
PRINTA("- Default route:\n");
|
||||
PRINTF("- Default route:\n");
|
||||
default_route = uip_ds6_defrt_lookup(uip_ds6_defrt_choose());
|
||||
if(default_route != NULL) {
|
||||
PRINTA("-- ");
|
||||
uip_debug_ipaddr_print(&default_route->ipaddr);
|
||||
PRINTA(" (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval);
|
||||
PRINTF("-- ");
|
||||
PRINT6ADDR(&default_route->ipaddr);
|
||||
PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)default_route->lifetime.interval);
|
||||
} else {
|
||||
PRINTA("-- None\n");
|
||||
PRINTF("-- None\n");
|
||||
}
|
||||
|
||||
#if RPL_WITH_STORING
|
||||
/* 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();
|
||||
while(route != NULL) {
|
||||
PRINTA("-- ");
|
||||
uip_debug_ipaddr_print(&route->ipaddr);
|
||||
PRINTA(" via ");
|
||||
uip_debug_ipaddr_print(uip_ds6_route_nexthop(route));
|
||||
PRINTA(" (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime);
|
||||
PRINTF("-- ");
|
||||
PRINT6ADDR(&route->ipaddr);
|
||||
PRINTF(" via ");
|
||||
PRINT6ADDR(uip_ds6_route_nexthop(route));
|
||||
PRINTF(" (lifetime: %lu seconds)\n", (unsigned long)route->state.lifetime);
|
||||
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
|
||||
|
@ -45,6 +45,17 @@
|
||||
#define WITH_SECURITY 0
|
||||
#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 *********************/
|
||||
/*******************************************************/
|
||||
@ -140,8 +151,8 @@
|
||||
#define UIP_CONF_TCP 0
|
||||
#undef QUEUEBUF_CONF_NUM
|
||||
#define QUEUEBUF_CONF_NUM 3
|
||||
#undef UIP_CONF_MAX_ROUTES
|
||||
#define UIP_CONF_MAX_ROUTES 8
|
||||
#undef RPL_NS_CONF_LINK_NUM
|
||||
#define RPL_NS_CONF_LINK_NUM 8
|
||||
#undef NBR_TABLE_CONF_MAX_NEIGHBORS
|
||||
#define NBR_TABLE_CONF_MAX_NEIGHBORS 8
|
||||
#undef UIP_CONF_ND6_SEND_NA
|
||||
|
@ -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
|
||||
* 8 routing entries (i.e. can reach every node) */
|
||||
log.log("Waiting for routing tables to fill\n");
|
||||
WAIT_UNTIL(msg.endsWith("Routing entries (8 in total):"));
|
||||
WAIT_UNTIL(msg.endsWith("Routing links (8 in total):"));
|
||||
log.log("Root routing table ready\n");
|
||||

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

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

|
||||
log.testOK(); /* Report test success and quit */</script>
|
||||
|
Loading…
Reference in New Issue
Block a user