Skip to content

Commit ecca06a

Browse files
committed
Merge pull request #11 from ARMmbed/configuration_polish
Updated item names in yotta config.
2 parents bc1d219 + 4394911 commit ecca06a

File tree

3 files changed

+77
-70
lines changed

3 files changed

+77
-70
lines changed

config.json.example

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,41 @@
33
# defines all the border router parameters (as shown below).
44
{
55
"border-router": {
6-
"debug-traces": 1, # Turn on/off debug prints
7-
"name": "mbed OS Border Router", # Name of the BR application
8-
"model": "K64F-BR", # Model name of the BR application
9-
"manufacturer": "ARM", # Name of manufacturer
10-
"network-mode": "ND_WITH_MLE", # 6LoWPAN default
11-
"security-mode": "PSK", # Mode of security, allowed values: (NONE, PSK, PANA)
12-
"psk-key-id": 1, # Index of the PSK key (if unsure set to 1)
13-
"psk-key": "{0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf}",
14-
# 16-byte long private shared key (PSK) value
15-
"pana-mode": "", # The PANA mode of operation, allowed values: (PSK, ECC, ECC+PSK)
16-
"tls-psk-key": "{0xcf, 0xce, 0xcd, 0xcc, 0xcb, 0xca, 0xc9, 0xc8, 0xc7, 0xc6, 0xc5, 0xc4, 0xc3, 0xc2, 0xc1, 0xc0}",
17-
# 16-byte long TLS private shared key (PSK) value (used with PANA)
18-
"tls-psk-key-id": 1, # Index of the TLS PSK key (used with PANA; if unsure set to 1)
19-
"br-pan-id": "0x0700", # Identifies the 6LoWPAN mesh network
20-
"networkid": "network000000000", # Human-readable indentifier for the 6LoWPAN network (used in beacons)
21-
"br-beacon-protocol-id": 4, # The protocol number in beacons (6LoWPAN shoud always use 4)
22-
"prefix": "fd00:db8::", # The global prefix to be assigned to all the nodes in the 6LoWPAN mesh network
23-
"rf-channel": 24, # The radio channel the BR application listens on, allowed values 11-26
24-
"br-short-address": "0xface", # The short (16-bit) MAC address used on the short global address
25-
"backhaul-bootstrap-mode": "NET_IPV6_BOOTSTRAP_STATIC", # Defines how the backhaul interface should be configured,
6+
"debug-traces": 1, # Turn on/off debug prints
7+
"name": "mbed OS Border Router", # Name of the border router application
8+
"model": "MY-BR-APP", # Model name of the border router application
9+
"manufacturer": "ARM", # Name of manufacturer
10+
"network-mode": "ND_WITH_MLE", # 6LoWPAN mode, allowed values: (ND_WITH_MLE)
11+
"security-mode": "PSK", # Mode of security, allowed values: (NONE, PSK, PANA)
12+
"psk-key-id": 1, # Index of the PSK key (if unsure set to 1)
13+
"psk-key": "{0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf}",
14+
# 16-byte long private shared key (PSK) value
15+
"pana-mode": "", # The PANA mode of operation (used if "security-mode": "PANA"), allowed values: (PSK, ECC, ECC+PSK)
16+
"tls-psk-key": "{0xcf, 0xce, 0xcd, 0xcc, 0xcb, 0xca, 0xc9, 0xc8, 0xc7, 0xc6, 0xc5, 0xc4, 0xc3, 0xc2, 0xc1, 0xc0}",
17+
# 16-byte long TLS private shared key (PSK) value (used with PANA)
18+
"tls-psk-key-id": 1, # Index of the TLS PSK key (used with PANA; if unsure set to 1)
19+
"pan-id": "0x0700", # Identifies the 6LoWPAN mesh network
20+
"network-id": "network000000000", # 16 bytes long human-readable indentifier for the 6LoWPAN network (used in beacons)
21+
"beacon-protocol-id": 4, # The protocol number in beacons (6LoWPAN shoud always use 4)
22+
"prefix": "fd00:db8::", # The global prefix to be assigned to all the nodes in the 6LoWPAN mesh network
23+
"rf-channel": 24, # The radio channel the application listens on, allowed values 11-26
24+
"short-mac-address": "0xface", # The short (16-bit) MAC address used on the short global address
25+
"backhaul-bootstrap-mode": "NET_IPV6_BOOTSTRAP_STATIC", # Defines how the backhaul interface should be configured,
2626
# allowed values: (NET_IPV6_BOOTSTRAP_STATIC, NET_IPV6_BOOTSTRAP_AUTONOMOUS)
27-
"backhaul-prefix": "fd00:db8:ff1::", The global prefix to be used on the address attached to the backhaul interface
28-
"backhaul-default-route": "::/0", # The deault route (prefix & prefix length) on the backhaul interface
29-
"backhaul-next-hop": "", # The next hop value of the default route (should be a link-local address of a neighboring router)
30-
"br-rpl-flags": "RPL_GROUNDED | BR_DODAG_MOP_NON_STORING | RPL_DODAG_PREF(0)", # RPL: the operation mode of RPL routing (do NOT change)
31-
"br-rpl-instance-id": 1, # RPL: The RPL instance ID value (identifies the RPL instance)
32-
"br-nd-route-lifetime": 1024, # ND: The router lifetime value used in transmitted Router Advertisements
33-
"br-dag-dio-int-doub": 12, # RPL Trickle: DIOIntervalDoublings value
34-
"br-dag-dio-int-min": 9, # RPL Trickle: DIOIntervalMin value
35-
"br-dag-dio-redu": 10, # RPL Trickle: the redundacy constant k
36-
"br-dag-max-rank-inc": 2048, # RPL: maximum rank increase
37-
"br-dag-min-hop-rank-inc": 128, # RPL: minumum rank increase
38-
"br-life-in-seconds": 64, # RPL: valid lifetime for the RPL messages
39-
"br-lifetime-unit": 60, # RPL: value of the unit the lifetime is described in
40-
"br-dag-sec-pcs": 1, # RPL: the number of bits that may be allocated to the path control field
41-
"br-dag-ocp": 1, # RPL: the objective function to use, allowed_values (1: OF0, 2: MRHOF)
42-
"multicast-addr": "ff05::7" # The MPL multicast address the BR application listens to and forwards multicast packets for
27+
"backhaul-prefix": "fd00:db8:ff1::", The global prefix of the address attached to the backhaul interface
28+
"backhaul-default-route": "::/0", # The deault route (prefix & prefix length) on the backhaul interface
29+
"backhaul-next-hop": "fe80::1", # The next hop value of the default route (should be a link-local address of a neighboring router)
30+
"ra-router-lifetime": 1024, # ND: The router lifetime value used in transmitted Router Advertisements
31+
"rpl-instance-id": 1, # RPL: The RPL instance ID value (identifies the RPL instance)
32+
"rpl-idoublings": 12, # RPL Trickle: DIOIntervalDoublings value
33+
"rpl-imin": 9, # RPL Trickle: DIOIntervalMin value
34+
"rpl-k": 10, # RPL Trickle: the redundacy constant k
35+
"rpl-max-rank-inc": 2048, # RPL: maximum rank increase
36+
"rpl-min-hop-rank-inc": 128, # RPL: minumum rank increase
37+
"rpl-default-lifetime": 64, # RPL: default lifetime for the RPL routes
38+
"rpl-lifetime-unit": 60, # RPL: value of the unit the lifetime is described in
39+
"rpl-pcs": 1, # RPL: the number of bits that may be allocated to the path control field
40+
"rpl-ocp": 1, # RPL: the objective function to use, allowed values (1: OF0, 2: MRHOF)
41+
"multicast-addr": "ff05::7" # The MPL multicast address the application listens to and forwards multicast packets for
4342
}
4443
}

nanostack-border-router/yotta_config.h

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
#define STR_HELPER(x) #x
2525
#define STR(x) STR_HELPER(x)
2626

27-
static const char psk_key[] = YOTTA_CFG_BORDER_ROUTER_PSK_KEY;
28-
static const char tls_psk_key[] = YOTTA_CFG_BORDER_ROUTER_TLS_PSK_KEY;
27+
static const char psk_key[16] = YOTTA_CFG_BORDER_ROUTER_PSK_KEY;
28+
static const char tls_psk_key[16] = YOTTA_CFG_BORDER_ROUTER_TLS_PSK_KEY;
2929

3030
static conf_t yotta_config[] = {
3131
/* NAME, STRING_VALUE, INT_VALUE */
@@ -37,30 +37,29 @@ static conf_t yotta_config[] = {
3737
{"PANA_MODE", STR(YOTTA_CFG_BORDER_ROUTER_PANA_MODE), 0},
3838
{"PSK_KEY", psk_key, 0},
3939
{"PSK_KEY_ID", NULL, YOTTA_CFG_BORDER_ROUTER_PSK_KEY_ID},
40-
{"BR_PAN_ID", NULL, YOTTA_CFG_BORDER_ROUTER_BR_PAN_ID},
41-
{"NETWORKID", STR(YOTTA_CFG_BORDER_ROUTER_NETWORKID), 0},
40+
{"PAN_ID", NULL, YOTTA_CFG_BORDER_ROUTER_PAN_ID},
41+
{"NETWORK_ID", STR(YOTTA_CFG_BORDER_ROUTER_NETWORK_ID), 0},
4242
{"PREFIX", STR(YOTTA_CFG_BORDER_ROUTER_PREFIX), 0},
4343
{"BACKHAUL_PREFIX", STR(YOTTA_CFG_BORDER_ROUTER_BACKHAUL_PREFIX), 0},
4444
{"BACKHAUL_DEFAULT_ROUTE", STR(YOTTA_CFG_BORDER_ROUTER_BACKHAUL_DEFAULT_ROUTE), 0},
4545
{"BACKHAUL_NEXT_HOP", STR(YOTTA_CFG_BORDER_ROUTER_BACKHAUL_NEXT_HOP), 0},
4646
{"RF_CHANNEL", NULL, YOTTA_CFG_BORDER_ROUTER_RF_CHANNEL},
47-
{"BR_RPL_FLAGS", NULL, YOTTA_CFG_BORDER_ROUTER_BR_RPL_FLAGS},
48-
{"BR_RPL_INSTANCE_ID", NULL, YOTTA_CFG_BORDER_ROUTER_BR_RPL_INSTANCE_ID},
49-
{"BR_ND_ROUTE_LIFETIME", NULL, YOTTA_CFG_BORDER_ROUTER_BR_ND_ROUTE_LIFETIME},
50-
{"BR_BEACON_PROTOCOL_ID", NULL, YOTTA_CFG_BORDER_ROUTER_BR_BEACON_PROTOCOL_ID},
51-
{"BR_DAG_DIO_INT_DOUB", NULL, YOTTA_CFG_BORDER_ROUTER_BR_DAG_DIO_INT_DOUB},
52-
{"BR_DAG_DIO_INT_MIN", NULL, YOTTA_CFG_BORDER_ROUTER_BR_DAG_DIO_INT_MIN},
53-
{"BR_DAG_DIO_REDU", NULL, YOTTA_CFG_BORDER_ROUTER_BR_DAG_DIO_REDU},
54-
{"BR_DAG_MAX_RANK_INC", NULL, YOTTA_CFG_BORDER_ROUTER_BR_DAG_MAX_RANK_INC},
55-
{"BR_DAG_MIN_HOP_RANK_INC", NULL, YOTTA_CFG_BORDER_ROUTER_BR_DAG_MIN_HOP_RANK_INC},
56-
{"BR_LIFE_IN_SECONDS", NULL, YOTTA_CFG_BORDER_ROUTER_BR_LIFE_IN_SECONDS},
57-
{"BR_LIFETIME_UNIT", NULL, YOTTA_CFG_BORDER_ROUTER_BR_LIFETIME_UNIT},
58-
{"BR_DAG_SEC_PCS", NULL, YOTTA_CFG_BORDER_ROUTER_BR_DAG_SEC_PCS},
59-
{"BR_DAG_OCP", NULL, YOTTA_CFG_BORDER_ROUTER_BR_DAG_OCP},
47+
{"RPL_INSTANCE_ID", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_INSTANCE_ID},
48+
{"RPL_IDOUBLINGS", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_IDOUBLINGS},
49+
{"RPL_K", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_K},
50+
{"RPL_MAX_RANK_INC", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_MAX_RANK_INC},
51+
{"RPL_MIN_HOP_RANK_INC", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_MIN_HOP_RANK_INC},
52+
{"RPL_IMIN", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_IMIN},
53+
{"RPL_DEFAULT_LIFETIME", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_DEFAULT_LIFETIME},
54+
{"RPL_LIFETIME_UNIT", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_LIFETIME_UNIT},
55+
{"RPL_PCS", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_PCS},
56+
{"RPL_OCP", NULL, YOTTA_CFG_BORDER_ROUTER_RPL_OCP},
57+
{"RA_ROUTER_LIFETIME", NULL, YOTTA_CFG_BORDER_ROUTER_RA_ROUTER_LIFETIME},
58+
{"BEACON_PROTOCOL_ID", NULL, YOTTA_CFG_BORDER_ROUTER_BEACON_PROTOCOL_ID},
6059
{"TLS_PSK_KEY", tls_psk_key, 0},
6160
{"TLS_PSK_KEY_ID", NULL, YOTTA_CFG_BORDER_ROUTER_TLS_PSK_KEY_ID},
6261
{"BACKHAUL_BOOTSTRAP_MODE", NULL, YOTTA_CFG_BORDER_ROUTER_BACKHAUL_BOOTSTRAP_MODE},
63-
{"BR_SHORT_ADDRESS", NULL, YOTTA_CFG_BORDER_ROUTER_BR_SHORT_ADDRESS},
62+
{"SHORT_MAC_ADDRESS", NULL, YOTTA_CFG_BORDER_ROUTER_SHORT_MAC_ADDRESS},
6463
{"MULTICAST_ADDR", STR(YOTTA_CFG_BORDER_ROUTER_MULTICAST_ADDR), 0},
6564
/* Array must end on {NULL, NULL, 0} field */
6665
{NULL, NULL, 0}

source/borderrouter_tasklet.c

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@
3434

3535
#ifdef YOTTA_CFG_BORDER_ROUTER
3636
#include "nanostack-border-router/yotta_config.h"
37+
#else
38+
#warning No yotta configuration: using empty config
39+
static conf_t static_config[] = {
40+
{NULL, NULL, 0}
41+
};
42+
static conf_t *global_config = static_config;
3743
#endif
3844

3945
#ifdef YOTTA_CFG_BORDER_ROUTER_DEBUG_TRACES
@@ -50,6 +56,9 @@
5056
#define NR_BACKHAUL_INTERFACE_PHY_DRIVER_READY 2
5157
#define NR_BACKHAUL_INTERFACE_PHY_DOWN 3
5258

59+
/* The border router tasklet runs in grounded/non-storing mode */
60+
#define RPL_FLAGS RPL_GROUNDED | BR_DODAG_MOP_NON_STORING | RPL_DODAG_PREF(0)
61+
5362
typedef enum interface_bootstrap_state {
5463
INTERFACE_IDLE_PHY_NOT_READY,
5564
INTERFACE_IDLE_STATE,
@@ -215,20 +224,20 @@ static void load_config(void)
215224

216225
stoip6(prefix, strlen(prefix), multicast_addr);
217226

218-
prefix = cfg_string(global_config, "NETWORKID", "NETWORK000000000");
227+
prefix = cfg_string(global_config, "NETWORK_ID", "NETWORK000000000");
219228
memcpy(br.network_id, prefix, 16);
220229

221-
br.mac_panid = cfg_int(global_config, "BR_PAN_ID", 0x0691);
222-
br.mac_short_adr = cfg_int(global_config, "BR_SHORT_ADDRESS", 0xffff);
223-
br.ra_life_time = cfg_int(global_config, "BR_ND_ROUTE_LIFETIME", 1024);
224-
br.beacon_protocol_id = cfg_int(global_config, "BR_BEACON_PROTOCOL_ID", 4);
230+
br.mac_panid = cfg_int(global_config, "PAN_ID", 0x0691);
231+
br.mac_short_adr = cfg_int(global_config, "SHORT_MAC_ADDRESS", 0xffff);
232+
br.ra_life_time = cfg_int(global_config, "RA_ROUTER_LIFETIME", 1024);
233+
br.beacon_protocol_id = cfg_int(global_config, "BEACON_PROTOCOL_ID", 4);
225234

226235
memcpy(br.lowpan_nd_prefix, nd_prefix, 8);
227236
br.abro_version_num = 0;
228237

229238
/* RPL routing setup */
230-
rpl_setup_info.rpl_instance_id = cfg_int(global_config, "BR_RPL_INSTANCE_ID", 1);
231-
rpl_setup_info.rpl_setups = cfg_int(global_config, "BR_RPL_FLAGS", 0);
239+
rpl_setup_info.rpl_instance_id = cfg_int(global_config, "RPL_INSTANCE_ID", 1);
240+
rpl_setup_info.rpl_setups = RPL_FLAGS;
232241

233242
/* generate DODAG ID */
234243
memcpy(rpl_setup_info.DODAG_ID, nd_prefix, 8);
@@ -237,15 +246,15 @@ static void load_config(void)
237246
rpl_setup_info.DODAG_ID[15] = br.mac_short_adr;
238247

239248
/* DODAG configuration */
240-
dodag_config.DAG_DIO_INT_DOUB = cfg_int(global_config, "BR_DAG_DIO_INT_DOUB", 12);
241-
dodag_config.DAG_DIO_INT_MIN = cfg_int(global_config, "BR_DAG_DIO_INT_MIN", 9);
242-
dodag_config.DAG_DIO_REDU = cfg_int(global_config, "BR_DAG_DIO_REDU", 10);
243-
dodag_config.DAG_MAX_RANK_INC = cfg_int(global_config, "BR_DAG_MAX_RANK_INC", 2048);
244-
dodag_config.DAG_MIN_HOP_RANK_INC = cfg_int(global_config, "BR_DAG_MIN_RANK_INC", 128);
245-
dodag_config.LIFE_IN_SECONDS = cfg_int(global_config, "BR_LIFE_IN_SECONDS", 64);
246-
dodag_config.LIFETIME_UNIT = cfg_int(global_config, "BR_LIFETIME_UNIT", 60);
247-
dodag_config.DAG_SEC_PCS = cfg_int(global_config, "BR_DAG_SEC_PCS", 1);
248-
dodag_config.DAG_OCP = cfg_int(global_config, "BR_DAG_OCP", 1);
249+
dodag_config.DAG_DIO_INT_DOUB = cfg_int(global_config, "RPL_IDOUBLINGS", 12);
250+
dodag_config.DAG_DIO_INT_MIN = cfg_int(global_config, "RPL_IMIN", 9);
251+
dodag_config.DAG_DIO_REDU = cfg_int(global_config, "RPL_K", 10);
252+
dodag_config.DAG_MAX_RANK_INC = cfg_int(global_config, "RPL_MAX_RANK_INC", 2048);
253+
dodag_config.DAG_MIN_HOP_RANK_INC = cfg_int(global_config, "RPL_MIN_HOP_RANK_INC", 128);
254+
dodag_config.LIFE_IN_SECONDS = cfg_int(global_config, "RPL_LIFETIME_UNIT", 64);
255+
dodag_config.LIFETIME_UNIT = cfg_int(global_config, "RPL_DEFAULT_LIFETIME", 60);
256+
dodag_config.DAG_SEC_PCS = cfg_int(global_config, "RPL_PCS", 1);
257+
dodag_config.DAG_OCP = cfg_int(global_config, "RPL_OCP", 1);
249258

250259
/* Bootstrap mode for the backhaul interface */
251260
backhaul_bootstrap_mode = (net_ipv6_mode_e)cfg_int(global_config,

0 commit comments

Comments
 (0)