tests: bluetooth: mesh: Removed native_posix and renamed sim_ids
Removed deprecated native_posix as test platform. Added unique sim_ids for tests with the psa as a overlay. Fixed clang-format issues. Signed-off-by: Ingar Kulbrandstad <ingar.kulbrandstad@nordicsemi.no>
This commit is contained in:
parent
e0f5f3acf4
commit
d41e834bbe
23 changed files with 467 additions and 525 deletions
|
@ -57,9 +57,9 @@ struct bt_mesh_bridging_table_status {
|
|||
|
||||
/** Used to filter set of pairs of NetKey Indexes from the Bridging Table */
|
||||
struct bt_mesh_filter_netkey {
|
||||
uint16_t filter:2, /* Filter applied to the set of pairs of NetKey Indexes */
|
||||
prohibited:2, /* Prohibited */
|
||||
net_idx:12; /* NetKey Index used for filtering or ignored */
|
||||
uint16_t filter: 2, /* Filter applied to the set of pairs of NetKey Indexes */
|
||||
prohibited: 2, /* Prohibited */
|
||||
net_idx: 12; /* NetKey Index used for filtering or ignored */
|
||||
};
|
||||
|
||||
/** Bridged Subnets List response */
|
||||
|
|
|
@ -27,9 +27,9 @@ extern "C" {
|
|||
*
|
||||
* @brief Bridge Configuration Server model Composition Data entry.
|
||||
*/
|
||||
#define BT_MESH_MODEL_BRG_CFG_SRV \
|
||||
BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_BRG_CFG_SRV, _bt_mesh_brg_cfg_srv_op, \
|
||||
NULL, NULL, &_bt_mesh_brg_cfg_srv_cb)
|
||||
#define BT_MESH_MODEL_BRG_CFG_SRV \
|
||||
BT_MESH_MODEL_CB(BT_MESH_MODEL_ID_BRG_CFG_SRV, _bt_mesh_brg_cfg_srv_op, NULL, NULL, \
|
||||
&_bt_mesh_brg_cfg_srv_cb)
|
||||
|
||||
/** @cond INTERNAL_HIDDEN */
|
||||
extern const struct bt_mesh_model_op _bt_mesh_brg_cfg_srv_op[];
|
||||
|
|
|
@ -172,9 +172,8 @@ static void brg_tbl_netkey_removed_evt(struct bt_mesh_subnet *sub, enum bt_mesh_
|
|||
}
|
||||
|
||||
for (int i = 0; i < CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX; i++) {
|
||||
if (brg_tbl[i].direction && (
|
||||
brg_tbl[i].net_idx1 == sub->net_idx ||
|
||||
brg_tbl[i].net_idx2 == sub->net_idx)) {
|
||||
if (brg_tbl[i].direction &&
|
||||
(brg_tbl[i].net_idx1 == sub->net_idx || brg_tbl[i].net_idx2 == sub->net_idx)) {
|
||||
memset(&brg_tbl[i], 0, sizeof(brg_tbl[i]));
|
||||
brg_tbl_compact();
|
||||
}
|
||||
|
@ -229,21 +228,18 @@ int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx
|
|||
uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status)
|
||||
{
|
||||
/* Sanity checks */
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(addr1) || net_idx1 == net_idx2 ||
|
||||
addr1 == addr2 || net_idx1 > BT_MESH_BRG_CFG_KEY_INDEX_MAX ||
|
||||
net_idx2 > BT_MESH_BRG_CFG_KEY_INDEX_MAX) {
|
||||
if (!BT_MESH_ADDR_IS_UNICAST(addr1) || net_idx1 == net_idx2 || addr1 == addr2 ||
|
||||
net_idx1 > BT_MESH_BRG_CFG_KEY_INDEX_MAX || net_idx2 > BT_MESH_BRG_CFG_KEY_INDEX_MAX) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (direction != BT_MESH_BRG_CFG_DIR_ONEWAY &&
|
||||
direction != BT_MESH_BRG_CFG_DIR_TWOWAY) {
|
||||
if (direction != BT_MESH_BRG_CFG_DIR_ONEWAY && direction != BT_MESH_BRG_CFG_DIR_TWOWAY) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((direction == BT_MESH_BRG_CFG_DIR_ONEWAY &&
|
||||
(addr2 == BT_MESH_ADDR_UNASSIGNED || addr2 == BT_MESH_ADDR_ALL_NODES)) ||
|
||||
(direction == BT_MESH_BRG_CFG_DIR_TWOWAY &&
|
||||
!BT_MESH_ADDR_IS_UNICAST(addr2))) {
|
||||
(direction == BT_MESH_BRG_CFG_DIR_TWOWAY && !BT_MESH_ADDR_IS_UNICAST(addr2))) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -259,9 +255,8 @@ int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx
|
|||
* in the received message."
|
||||
*/
|
||||
for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) {
|
||||
if (brg_tbl[i].net_idx1 == net_idx1 &&
|
||||
brg_tbl[i].net_idx2 == net_idx2 && brg_tbl[i].addr1 == addr1 &&
|
||||
brg_tbl[i].addr2 == addr2) {
|
||||
if (brg_tbl[i].net_idx1 == net_idx1 && brg_tbl[i].net_idx2 == net_idx2 &&
|
||||
brg_tbl[i].addr1 == addr1 && brg_tbl[i].addr2 == addr2) {
|
||||
brg_tbl[i].direction = direction;
|
||||
goto store;
|
||||
}
|
||||
|
@ -295,28 +290,27 @@ void bt_mesh_brg_cfg_tbl_foreach_subnet(uint16_t src, uint16_t dst, uint16_t net
|
|||
bt_mesh_brg_cfg_cb_t cb, void *user_data)
|
||||
{
|
||||
for (int i = 0; i < bt_mesh_brg_cfg_row_cnt; i++) {
|
||||
if ((brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_ONEWAY ||
|
||||
if ((brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_ONEWAY ||
|
||||
brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_TWOWAY) &&
|
||||
brg_tbl[i].net_idx1 == net_idx && brg_tbl[i].addr1 == src &&
|
||||
brg_tbl[i].addr2 == dst) {
|
||||
brg_tbl[i].net_idx1 == net_idx && brg_tbl[i].addr1 == src &&
|
||||
brg_tbl[i].addr2 == dst) {
|
||||
cb(brg_tbl[i].net_idx2, user_data);
|
||||
} else if ((brg_tbl[i].direction == BT_MESH_BRG_CFG_DIR_TWOWAY &&
|
||||
brg_tbl[i].net_idx2 == net_idx && brg_tbl[i].addr2 == src &&
|
||||
brg_tbl[i].addr1 == dst)) {
|
||||
brg_tbl[i].net_idx2 == net_idx && brg_tbl[i].addr2 == src &&
|
||||
brg_tbl[i].addr1 == dst)) {
|
||||
cb(brg_tbl[i].net_idx1, user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1,
|
||||
uint16_t addr2, uint8_t *status)
|
||||
int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2,
|
||||
uint8_t *status)
|
||||
{
|
||||
bool store = false;
|
||||
|
||||
/* Sanity checks */
|
||||
if ((!BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 != BT_MESH_ADDR_UNASSIGNED) ||
|
||||
(BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 == addr2) ||
|
||||
addr2 == BT_MESH_ADDR_ALL_NODES) {
|
||||
(BT_MESH_ADDR_IS_UNICAST(addr1) && addr1 == addr2) || addr2 == BT_MESH_ADDR_ALL_NODES) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ struct bt_mesh_brg_cfg_row {
|
|||
* 1 - bridge messages with src as addr1 and dst as addr2
|
||||
* 2 - bridge messages with src as addr1 and dst as addr2 and vice-versa
|
||||
*/
|
||||
uint32_t direction:8;
|
||||
uint32_t net_idx1:12;
|
||||
uint32_t net_idx2:12;
|
||||
uint32_t direction: 8;
|
||||
uint32_t net_idx1: 12;
|
||||
uint32_t net_idx2: 12;
|
||||
uint16_t addr1;
|
||||
uint16_t addr2;
|
||||
};
|
||||
|
@ -53,8 +53,8 @@ int bt_mesh_brg_cfg_tbl_get(const struct bt_mesh_brg_cfg_row **rows);
|
|||
int bt_mesh_brg_cfg_tbl_add(enum bt_mesh_brg_cfg_dir direction, uint16_t net_idx1,
|
||||
uint16_t net_idx2, uint16_t addr1, uint16_t addr2, uint8_t *status);
|
||||
|
||||
int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1,
|
||||
uint16_t addr2, uint8_t *status);
|
||||
int bt_mesh_brg_cfg_tbl_remove(uint16_t net_idx1, uint16_t net_idx2, uint16_t addr1, uint16_t addr2,
|
||||
uint8_t *status);
|
||||
|
||||
typedef void (*bt_mesh_brg_cfg_cb_t)(uint16_t new_netidx, void *user_data);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static int subnet_bridge_status(const struct bt_mesh_model *model, struct bt_mes
|
|||
}
|
||||
|
||||
static int bridging_table_status(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_mesh_bridging_table_status table_status;
|
||||
struct bt_mesh_bridging_table_status *rsp;
|
||||
|
@ -49,7 +49,7 @@ static int bridging_table_status(const struct bt_mesh_model *model, struct bt_me
|
|||
table_status.entry.addr2 = net_buf_simple_pull_le16(buf);
|
||||
|
||||
if (!(table_status.entry.addr1 == BT_MESH_ADDR_UNASSIGNED ||
|
||||
BT_MESH_ADDR_IS_UNICAST(table_status.entry.addr1))) {
|
||||
BT_MESH_ADDR_IS_UNICAST(table_status.entry.addr1))) {
|
||||
LOG_ERR("addr1 shall be a unicast address or unassigned.");
|
||||
return -EINVAL;
|
||||
} else if (table_status.entry.addr2 == BT_MESH_ADDR_ALL_NODES) {
|
||||
|
@ -109,7 +109,7 @@ static int bridged_subnets_list(const struct bt_mesh_model *model, struct bt_mes
|
|||
}
|
||||
|
||||
static int bridging_table_list(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
struct bt_mesh_bridging_table_list table_list;
|
||||
struct bt_mesh_bridging_table_list *rsp;
|
||||
|
@ -166,11 +166,11 @@ static int bridging_table_size_status(const struct bt_mesh_model *model,
|
|||
}
|
||||
|
||||
const struct bt_mesh_model_op _bt_mesh_brg_cfg_cli_op[] = {
|
||||
{ OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), subnet_bridge_status },
|
||||
{ OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), bridging_table_status },
|
||||
{ OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), bridged_subnets_list },
|
||||
{ OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), bridging_table_list },
|
||||
{ OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), bridging_table_size_status },
|
||||
{OP_SUBNET_BRIDGE_STATUS, BT_MESH_LEN_EXACT(1), subnet_bridge_status},
|
||||
{OP_BRIDGING_TABLE_STATUS, BT_MESH_LEN_EXACT(9), bridging_table_status},
|
||||
{OP_BRIDGED_SUBNETS_LIST, BT_MESH_LEN_MIN(3), bridged_subnets_list},
|
||||
{OP_BRIDGING_TABLE_LIST, BT_MESH_LEN_MIN(6), bridging_table_list},
|
||||
{OP_BRIDGING_TABLE_SIZE_STATUS, BT_MESH_LEN_EXACT(2), bridging_table_size_status},
|
||||
BT_MESH_MODEL_OP_END,
|
||||
};
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ static int subnet_bridge_set(const struct bt_mesh_model *model, struct bt_mesh_m
|
|||
}
|
||||
|
||||
static void bridging_table_status_send(const struct bt_mesh_model *model,
|
||||
struct bt_mesh_msg_ctx *ctx, uint8_t status,
|
||||
struct bt_mesh_bridging_table_entry *entry)
|
||||
struct bt_mesh_msg_ctx *ctx, uint8_t status,
|
||||
struct bt_mesh_bridging_table_entry *entry)
|
||||
{
|
||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_STATUS, 9);
|
||||
|
||||
|
@ -123,7 +123,8 @@ static int bridged_subnets_get(const struct bt_mesh_model *model, struct bt_mesh
|
|||
struct net_buf_simple *buf)
|
||||
{
|
||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGED_SUBNETS_LIST,
|
||||
BT_MESH_TX_SDU_MAX - BT_MESH_MODEL_OP_LEN(OP_BRIDGED_SUBNETS_LIST));
|
||||
BT_MESH_TX_SDU_MAX -
|
||||
BT_MESH_MODEL_OP_LEN(OP_BRIDGED_SUBNETS_LIST));
|
||||
bt_mesh_model_msg_init(&msg, OP_BRIDGED_SUBNETS_LIST);
|
||||
|
||||
const struct bt_mesh_brg_cfg_row *brg_tbl;
|
||||
|
@ -209,10 +210,10 @@ static int bridged_subnets_get(const struct bt_mesh_model *model, struct bt_mesh
|
|||
}
|
||||
|
||||
static int bridging_table_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_LIST,
|
||||
BT_MESH_TX_SDU_MAX - BT_MESH_MODEL_OP_LEN(OP_BRIDGING_TABLE_LIST));
|
||||
BT_MESH_TX_SDU_MAX - BT_MESH_MODEL_OP_LEN(OP_BRIDGING_TABLE_LIST));
|
||||
uint8_t status = STATUS_SUCCESS;
|
||||
uint16_t net_idx1, net_idx2;
|
||||
|
||||
|
@ -252,7 +253,6 @@ static int bridging_table_get(const struct bt_mesh_model *model, struct bt_mesh_
|
|||
}
|
||||
cnt++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
tbl_get_respond:
|
||||
|
@ -264,7 +264,7 @@ tbl_get_respond:
|
|||
}
|
||||
|
||||
static int bridging_table_size_get(const struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx,
|
||||
struct net_buf_simple *buf)
|
||||
struct net_buf_simple *buf)
|
||||
{
|
||||
BT_MESH_MODEL_BUF_DEFINE(msg, OP_BRIDGING_TABLE_SIZE_STATUS, 2);
|
||||
bt_mesh_model_msg_init(&msg, OP_BRIDGING_TABLE_SIZE_STATUS);
|
||||
|
@ -278,15 +278,14 @@ static int bridging_table_size_get(const struct bt_mesh_model *model, struct bt_
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
const struct bt_mesh_model_op _bt_mesh_brg_cfg_srv_op[] = {
|
||||
{ OP_SUBNET_BRIDGE_GET, BT_MESH_LEN_EXACT(0), subnet_bridge_get },
|
||||
{ OP_SUBNET_BRIDGE_SET, BT_MESH_LEN_EXACT(1), subnet_bridge_set },
|
||||
{ OP_BRIDGING_TABLE_ADD, BT_MESH_LEN_EXACT(8), bridging_table_add },
|
||||
{ OP_BRIDGING_TABLE_REMOVE, BT_MESH_LEN_EXACT(7), bridging_table_remove },
|
||||
{ OP_BRIDGED_SUBNETS_GET, BT_MESH_LEN_EXACT(3), bridged_subnets_get },
|
||||
{ OP_BRIDGING_TABLE_GET, BT_MESH_LEN_EXACT(5), bridging_table_get },
|
||||
{ OP_BRIDGING_TABLE_SIZE_GET, BT_MESH_LEN_EXACT(0), bridging_table_size_get },
|
||||
{OP_SUBNET_BRIDGE_GET, BT_MESH_LEN_EXACT(0), subnet_bridge_get},
|
||||
{OP_SUBNET_BRIDGE_SET, BT_MESH_LEN_EXACT(1), subnet_bridge_set},
|
||||
{OP_BRIDGING_TABLE_ADD, BT_MESH_LEN_EXACT(8), bridging_table_add},
|
||||
{OP_BRIDGING_TABLE_REMOVE, BT_MESH_LEN_EXACT(7), bridging_table_remove},
|
||||
{OP_BRIDGED_SUBNETS_GET, BT_MESH_LEN_EXACT(3), bridged_subnets_get},
|
||||
{OP_BRIDGING_TABLE_GET, BT_MESH_LEN_EXACT(5), bridging_table_get},
|
||||
{OP_BRIDGING_TABLE_SIZE_GET, BT_MESH_LEN_EXACT(0), bridging_table_size_get},
|
||||
BT_MESH_MODEL_OP_END,
|
||||
};
|
||||
|
||||
|
|
|
@ -122,18 +122,18 @@
|
|||
#define OP_SOL_PDU_RPL_ITEM_CLEAR_UNACKED BT_MESH_MODEL_OP_2(0x80, 0x79)
|
||||
#define OP_SOL_PDU_RPL_ITEM_STATUS BT_MESH_MODEL_OP_2(0x80, 0x7a)
|
||||
|
||||
#define OP_SUBNET_BRIDGE_GET BT_MESH_MODEL_OP_2(0x80, 0xb1)
|
||||
#define OP_SUBNET_BRIDGE_SET BT_MESH_MODEL_OP_2(0x80, 0xb2)
|
||||
#define OP_SUBNET_BRIDGE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb3)
|
||||
#define OP_BRIDGING_TABLE_ADD BT_MESH_MODEL_OP_2(0x80, 0xb4)
|
||||
#define OP_BRIDGING_TABLE_REMOVE BT_MESH_MODEL_OP_2(0x80, 0xb5)
|
||||
#define OP_BRIDGING_TABLE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb6)
|
||||
#define OP_BRIDGED_SUBNETS_GET BT_MESH_MODEL_OP_2(0x80, 0xb7)
|
||||
#define OP_BRIDGED_SUBNETS_LIST BT_MESH_MODEL_OP_2(0x80, 0xb8)
|
||||
#define OP_BRIDGING_TABLE_GET BT_MESH_MODEL_OP_2(0x80, 0xb9)
|
||||
#define OP_BRIDGING_TABLE_LIST BT_MESH_MODEL_OP_2(0x80, 0xba)
|
||||
#define OP_BRIDGING_TABLE_SIZE_GET BT_MESH_MODEL_OP_2(0x80, 0xbb)
|
||||
#define OP_BRIDGING_TABLE_SIZE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xbc)
|
||||
#define OP_SUBNET_BRIDGE_GET BT_MESH_MODEL_OP_2(0x80, 0xb1)
|
||||
#define OP_SUBNET_BRIDGE_SET BT_MESH_MODEL_OP_2(0x80, 0xb2)
|
||||
#define OP_SUBNET_BRIDGE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb3)
|
||||
#define OP_BRIDGING_TABLE_ADD BT_MESH_MODEL_OP_2(0x80, 0xb4)
|
||||
#define OP_BRIDGING_TABLE_REMOVE BT_MESH_MODEL_OP_2(0x80, 0xb5)
|
||||
#define OP_BRIDGING_TABLE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xb6)
|
||||
#define OP_BRIDGED_SUBNETS_GET BT_MESH_MODEL_OP_2(0x80, 0xb7)
|
||||
#define OP_BRIDGED_SUBNETS_LIST BT_MESH_MODEL_OP_2(0x80, 0xb8)
|
||||
#define OP_BRIDGING_TABLE_GET BT_MESH_MODEL_OP_2(0x80, 0xb9)
|
||||
#define OP_BRIDGING_TABLE_LIST BT_MESH_MODEL_OP_2(0x80, 0xba)
|
||||
#define OP_BRIDGING_TABLE_SIZE_GET BT_MESH_MODEL_OP_2(0x80, 0xbb)
|
||||
#define OP_BRIDGING_TABLE_SIZE_STATUS BT_MESH_MODEL_OP_2(0x80, 0xbc)
|
||||
|
||||
#define STATUS_SUCCESS 0x00
|
||||
#define STATUS_INVALID_ADDRESS 0x01
|
||||
|
|
|
@ -682,8 +682,7 @@ static bool relay_to_adv(enum bt_mesh_net_if net_if)
|
|||
}
|
||||
}
|
||||
|
||||
static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
||||
struct bt_mesh_net_rx *rx, bool bridge)
|
||||
static void bt_mesh_net_relay(struct net_buf_simple *sbuf, struct bt_mesh_net_rx *rx, bool bridge)
|
||||
{
|
||||
const struct bt_mesh_net_cred *cred;
|
||||
struct bt_mesh_adv *adv;
|
||||
|
@ -693,9 +692,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
|
|||
return;
|
||||
}
|
||||
|
||||
if (rx->net_if == BT_MESH_NET_IF_ADV &&
|
||||
!rx->friend_cred &&
|
||||
!bridge &&
|
||||
if (rx->net_if == BT_MESH_NET_IF_ADV && !rx->friend_cred && !bridge &&
|
||||
bt_mesh_relay_get() != BT_MESH_RELAY_ENABLED &&
|
||||
bt_mesh_gatt_proxy_get() != BT_MESH_GATT_PROXY_ENABLED &&
|
||||
bt_mesh_priv_gatt_proxy_get() != BT_MESH_PRIV_GATT_PROXY_ENABLED) {
|
||||
|
@ -949,7 +946,7 @@ void bt_mesh_net_recv(struct net_buf_simple *data, int8_t rssi,
|
|||
}
|
||||
|
||||
bt_mesh_brg_cfg_tbl_foreach_subnet(rx.ctx.addr, rx.ctx.recv_dst, rx.ctx.net_idx,
|
||||
bt_mesh_sbr_check_cb, &tx_ctx);
|
||||
bt_mesh_sbr_check_cb, &tx_ctx);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -127,16 +127,12 @@ SETTINGS_STATIC_HANDLER_DEFINE(bt_mesh, "bt/mesh", NULL, NULL, mesh_commit,
|
|||
BIT(BT_MESH_SETTINGS_CDB_PENDING))
|
||||
|
||||
/* Pending flags that use CONFIG_BT_MESH_STORE_TIMEOUT */
|
||||
#define GENERIC_PENDING_BITS (BIT(BT_MESH_SETTINGS_NET_KEYS_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_APP_KEYS_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_HB_PUB_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_CFG_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_MOD_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_VA_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_SSEQ_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_COMP_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_DEV_KEY_CAND_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_BRG_PENDING))
|
||||
#define GENERIC_PENDING_BITS \
|
||||
(BIT(BT_MESH_SETTINGS_NET_KEYS_PENDING) | BIT(BT_MESH_SETTINGS_APP_KEYS_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_HB_PUB_PENDING) | BIT(BT_MESH_SETTINGS_CFG_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_MOD_PENDING) | BIT(BT_MESH_SETTINGS_VA_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_SSEQ_PENDING) | BIT(BT_MESH_SETTINGS_COMP_PENDING) | \
|
||||
BIT(BT_MESH_SETTINGS_DEV_KEY_CAND_PENDING) | BIT(BT_MESH_SETTINGS_BRG_PENDING))
|
||||
|
||||
void bt_mesh_settings_store_schedule(enum bt_mesh_settings_flag flag)
|
||||
{
|
||||
|
@ -266,8 +262,7 @@ static void store_pending(struct k_work *work)
|
|||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_BT_MESH_BRG_CFG_SRV) &&
|
||||
atomic_test_and_clear_bit(pending_flags,
|
||||
BT_MESH_SETTINGS_BRG_PENDING)) {
|
||||
atomic_test_and_clear_bit(pending_flags, BT_MESH_SETTINGS_BRG_PENDING)) {
|
||||
bt_mesh_brg_cfg_pending_store();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ static int cmd_subnet_bridge_set(const struct shell *sh, size_t argc, char *argv
|
|||
enum bt_mesh_subnet_bridge_state set, rsp;
|
||||
int err = 0;
|
||||
|
||||
set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_SUBNET_BRIDGE_ENABLED :
|
||||
BT_MESH_SUBNET_BRIDGE_DISABLED;
|
||||
set = shell_strtobool(argv[1], 0, &err) ? BT_MESH_SUBNET_BRIDGE_ENABLED
|
||||
: BT_MESH_SUBNET_BRIDGE_DISABLED;
|
||||
|
||||
if (err) {
|
||||
shell_warn(sh, "Unable to parse input string argument");
|
||||
|
@ -231,17 +231,16 @@ static int cmd_bridging_table_get(const struct shell *sh, size_t argc, char *arg
|
|||
}
|
||||
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(
|
||||
brg_cfg_cmds,
|
||||
SHELL_CMD_ARG(bridge-get, NULL, NULL, cmd_subnet_bridge_get, 1, 0),
|
||||
SHELL_CMD_ARG(bridge-set, NULL, "<State(disable, enable)>", cmd_subnet_bridge_set, 2, 0),
|
||||
SHELL_CMD_ARG(table-size-get, NULL, NULL, cmd_bridging_table_size_get, 1, 0),
|
||||
SHELL_CMD_ARG(table-add, NULL, "<Directions> <NetIdx1> <NetIdx2> <Addr1> <Addr2>",
|
||||
brg_cfg_cmds, SHELL_CMD_ARG(bridge - get, NULL, NULL, cmd_subnet_bridge_get, 1, 0),
|
||||
SHELL_CMD_ARG(bridge - set, NULL, "<State(disable, enable)>", cmd_subnet_bridge_set, 2, 0),
|
||||
SHELL_CMD_ARG(table - size - get, NULL, NULL, cmd_bridging_table_size_get, 1, 0),
|
||||
SHELL_CMD_ARG(table - add, NULL, "<Directions> <NetIdx1> <NetIdx2> <Addr1> <Addr2>",
|
||||
cmd_bridging_table_add, 6, 0),
|
||||
SHELL_CMD_ARG(table-remove, NULL, "<NetIdx1> <NetIdx2> <Addr1> <Addr2>",
|
||||
SHELL_CMD_ARG(table - remove, NULL, "<NetIdx1> <NetIdx2> <Addr1> <Addr2>",
|
||||
cmd_bridging_table_remove, 5, 0),
|
||||
SHELL_CMD_ARG(subnets-get, NULL, "<Filter> <NetIdx> <StartIdx>", cmd_bridged_subnets_get,
|
||||
SHELL_CMD_ARG(subnets - get, NULL, "<Filter> <NetIdx> <StartIdx>", cmd_bridged_subnets_get,
|
||||
4, 0),
|
||||
SHELL_CMD_ARG(table-get, NULL, "<NetIdx1> <NetIdx2> <StartIdx>", cmd_bridging_table_get,
|
||||
SHELL_CMD_ARG(table - get, NULL, "<NetIdx1> <NetIdx2> <StartIdx>", cmd_bridging_table_get,
|
||||
4, 0),
|
||||
SHELL_SUBCMD_SET_END);
|
||||
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
CONFIG_ZTEST=y
|
||||
CONFIG_ZTEST_MOCKING=y
|
||||
CONFIG_BT_MESH_BRG_CFG_SRV=y
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <zephyr/ztest.h>
|
||||
#include <zephyr/net/buf.h>
|
||||
#include <zephyr/net_buf.h>
|
||||
#include <zephyr/bluetooth/mesh.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -32,9 +32,9 @@ static void setup(void *f)
|
|||
/* create test vector */
|
||||
for (int i = 0; i < TEST_VECT_SZ; i++) {
|
||||
test_vector[i].direction = i < (TEST_VECT_SZ / 2) ? 1 : 2;
|
||||
test_vector[i].net_idx1 = (i/8);
|
||||
test_vector[i].net_idx1 = (i / 8);
|
||||
test_vector[i].addr1 = ADDR1_BASE + i;
|
||||
test_vector[i].net_idx2 = (i/8) + 16;
|
||||
test_vector[i].net_idx2 = (i / 8) + 16;
|
||||
test_vector[i].addr2 = ADDR2_BASE + i;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ int settings_delete(const char *name)
|
|||
struct bt_mesh_subnet *bt_mesh_subnet_get(uint16_t net_idx)
|
||||
{
|
||||
/* Return anything non-zero. */
|
||||
return (struct bt_mesh_subnet *) 1;
|
||||
return (struct bt_mesh_subnet *)1;
|
||||
}
|
||||
|
||||
/**** Mocked functions - end ****/
|
||||
|
@ -77,12 +77,12 @@ static void check_fill_all_bt_entries(void)
|
|||
|
||||
if (i < CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX) {
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag,
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
}
|
||||
|
||||
err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, test_vector[i].net_idx1,
|
||||
test_vector[i].net_idx2, test_vector[i].addr1, test_vector[i].addr2,
|
||||
&status);
|
||||
test_vector[i].net_idx2, test_vector[i].addr1,
|
||||
test_vector[i].addr2, &status);
|
||||
|
||||
zassert_equal(err, 0);
|
||||
|
||||
|
@ -102,19 +102,18 @@ static void check_delete_all_bt_entries(void)
|
|||
|
||||
if (i < CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX) {
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag,
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
}
|
||||
|
||||
int err = bt_mesh_brg_cfg_tbl_remove(test_vector[i].net_idx1,
|
||||
test_vector[i].net_idx2, test_vector[i].addr1,
|
||||
test_vector[i].addr2, &status);
|
||||
test_vector[i].net_idx2, test_vector[i].addr1,
|
||||
test_vector[i].addr2, &status);
|
||||
|
||||
zassert_equal(err, 0);
|
||||
zassert_equal(status, STATUS_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void check_bt_mesh_brg_cfg_tbl_reset(void)
|
||||
{
|
||||
int err;
|
||||
|
@ -230,13 +229,12 @@ static void pending_store_enable_create_expectations(bool *enable_val)
|
|||
}
|
||||
}
|
||||
|
||||
static void pending_store_tbl_create_expectations(int n,
|
||||
const struct bt_mesh_brg_cfg_row *tbl_val)
|
||||
static void pending_store_tbl_create_expectations(int n, const struct bt_mesh_brg_cfg_row *tbl_val)
|
||||
{
|
||||
if (n > 0) {
|
||||
ztest_expect_data(settings_save_one, name, "bt/mesh/brg_tbl");
|
||||
ztest_expect_value(settings_save_one, val_len,
|
||||
n * sizeof(struct bt_mesh_brg_cfg_row));
|
||||
n * sizeof(struct bt_mesh_brg_cfg_row));
|
||||
ztest_expect_data(settings_save_one, value, tbl_val);
|
||||
} else {
|
||||
ztest_expect_data(settings_delete, name, "bt/mesh/brg_tbl");
|
||||
|
@ -254,9 +252,7 @@ ZTEST(bt_mesh_brg_cfg, test_brg_cfg_en)
|
|||
zassert_equal(val, false, NULL);
|
||||
/* No changed to the states, nothing to check. */
|
||||
|
||||
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag,
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag, BT_MESH_SETTINGS_BRG_PENDING);
|
||||
err = bt_mesh_brg_cfg_enable_set(true);
|
||||
zassert_equal(err, 0, NULL);
|
||||
val = bt_mesh_brg_cfg_enable_get();
|
||||
|
@ -280,10 +276,9 @@ ZTEST(bt_mesh_brg_cfg, test_brg_tbl_pending_store)
|
|||
};
|
||||
|
||||
check_bt_mesh_brg_cfg_tbl_reset();
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag,
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
err = bt_mesh_brg_cfg_tbl_add(test_vec.direction, test_vec.net_idx1,
|
||||
test_vec.net_idx2, test_vec.addr1, test_vec.addr2, &status);
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag, BT_MESH_SETTINGS_BRG_PENDING);
|
||||
err = bt_mesh_brg_cfg_tbl_add(test_vec.direction, test_vec.net_idx1, test_vec.net_idx2,
|
||||
test_vec.addr1, test_vec.addr2, &status);
|
||||
zassert_equal(err, 0);
|
||||
zassert_equal(status, STATUS_SUCCESS);
|
||||
|
||||
|
@ -307,60 +302,110 @@ ZTEST(bt_mesh_brg_cfg, test_tbl_add_invalid_ip)
|
|||
* Each vector has only one invalid field value, rest all are valid values.
|
||||
*/
|
||||
const struct test_brg_cfg_row inv_test_vector[] = {
|
||||
/* Direction has invalid values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_PROHIBITED,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 2},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_MAX,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 2},
|
||||
/* Out of range netidx values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 4096, .net_idx2 = 1, .addr1 = 1, .addr2 = 2},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 4096, .addr1 = 1, .addr2 = 2},
|
||||
/* Same netidx values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 0, .addr1 = 1, .addr2 = 2},
|
||||
/* Same addr values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 1},
|
||||
/* Invalid address1 value */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 0, .addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 0x8000, .addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 0xC000, .addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 0xFFFE, .addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 0xFFFF, .addr2 = 1},
|
||||
/* Invalid address2 values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 0},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 0xFFFF},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 0x8000},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 0xC000},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 0xFFFE},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0, .net_idx2 = 1, .addr1 = 1, .addr2 = 0xFFFF},
|
||||
/* Direction has invalid values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_PROHIBITED,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 2},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_MAX,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 2},
|
||||
/* Out of range netidx values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 4096,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 2},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 4096,
|
||||
.addr1 = 1,
|
||||
.addr2 = 2},
|
||||
/* Same netidx values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 0,
|
||||
.addr1 = 1,
|
||||
.addr2 = 2},
|
||||
/* Same addr values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 1},
|
||||
/* Invalid address1 value */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 0,
|
||||
.addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 0x8000,
|
||||
.addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 0xC000,
|
||||
.addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 0xFFFE,
|
||||
.addr2 = 1},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 0xFFFF,
|
||||
.addr2 = 1},
|
||||
/* Invalid address2 values */
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 0},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_ONEWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 0xFFFF},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 0x8000},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 0xC000},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 0xFFFE},
|
||||
{.direction = BT_MESH_BRG_CFG_DIR_TWOWAY,
|
||||
.net_idx1 = 0,
|
||||
.net_idx2 = 1,
|
||||
.addr1 = 1,
|
||||
.addr2 = 0xFFFF},
|
||||
};
|
||||
|
||||
check_bt_mesh_brg_cfg_tbl_reset();
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(inv_test_vector); i++) {
|
||||
err = bt_mesh_brg_cfg_tbl_add(inv_test_vector[i].direction,
|
||||
inv_test_vector[i].net_idx1, inv_test_vector[i].net_idx2,
|
||||
inv_test_vector[i].addr1, inv_test_vector[i].addr2,
|
||||
&status);
|
||||
inv_test_vector[i].net_idx1,
|
||||
inv_test_vector[i].net_idx2, inv_test_vector[i].addr1,
|
||||
inv_test_vector[i].addr2, &status);
|
||||
zassert_equal(err, -EINVAL, "Test vector index: %zu", i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Following are helper functions for the test that checks the iteration logic */
|
||||
#define NUM_MSGS (10000)
|
||||
|
||||
|
@ -372,9 +417,10 @@ static void print_brg_tbl(void)
|
|||
zassert_true(n <= CONFIG_BT_MESH_BRG_TABLE_ITEMS_MAX);
|
||||
|
||||
for (int i = 0; i < n; i++) {
|
||||
printk("entry: %3d # dir: %d, net_idx1: %3d, addr1: %3d, net_idx2: %3d, addr2: %3d\n",
|
||||
i, tbl[i].direction, tbl[i].net_idx1, tbl[i].addr1, tbl[i].net_idx2,
|
||||
tbl[i].addr2);
|
||||
printk("entry: %3d # dir: %d, net_idx1: %3d, addr1: %3d, net_idx2: %3d, addr2: "
|
||||
"%3d\n",
|
||||
i, tbl[i].direction, tbl[i].net_idx1, tbl[i].addr1, tbl[i].net_idx2,
|
||||
tbl[i].addr2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,12 +429,12 @@ static void check_fill_all_bt_entries_reversed(void)
|
|||
uint8_t status;
|
||||
int err;
|
||||
|
||||
for (int i = TEST_VECT_SZ - 2; i >= 0 ; i--) {
|
||||
for (int i = TEST_VECT_SZ - 2; i >= 0; i--) {
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag,
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
err = bt_mesh_brg_cfg_tbl_add(test_vector[i].direction, test_vector[i].net_idx1,
|
||||
test_vector[i].net_idx2, test_vector[i].addr1, test_vector[i].addr2,
|
||||
&status);
|
||||
test_vector[i].net_idx2, test_vector[i].addr1,
|
||||
test_vector[i].addr2, &status);
|
||||
zassert_equal(err, 0);
|
||||
}
|
||||
|
||||
|
@ -421,10 +467,11 @@ static void check_fill_all_bt_entries_randomly(void)
|
|||
|
||||
for (int i = 0; i < copy_cnt; i++) {
|
||||
ztest_expect_value(bt_mesh_settings_store_schedule, flag,
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
err = bt_mesh_brg_cfg_tbl_add(test_vector_copy[i].direction,
|
||||
test_vector_copy[i].net_idx1, test_vector_copy[i].net_idx2,
|
||||
test_vector_copy[i].addr1, test_vector_copy[i].addr2, &status);
|
||||
BT_MESH_SETTINGS_BRG_PENDING);
|
||||
err = bt_mesh_brg_cfg_tbl_add(
|
||||
test_vector_copy[i].direction, test_vector_copy[i].net_idx1,
|
||||
test_vector_copy[i].net_idx2, test_vector_copy[i].addr1,
|
||||
test_vector_copy[i].addr2, &status);
|
||||
zassert_equal(err, 0);
|
||||
zassert_equal(status, STATUS_SUCCESS);
|
||||
}
|
||||
|
@ -432,8 +479,8 @@ static void check_fill_all_bt_entries_randomly(void)
|
|||
int last = TEST_VECT_SZ - 1;
|
||||
|
||||
err = bt_mesh_brg_cfg_tbl_add(test_vector[last].direction, test_vector[last].net_idx1,
|
||||
test_vector[last].net_idx2, test_vector[last].addr1, test_vector[last].addr2,
|
||||
&status);
|
||||
test_vector[last].net_idx2, test_vector[last].addr1,
|
||||
test_vector[last].addr2, &status);
|
||||
zassert_equal(err, 0);
|
||||
zassert_equal(status, STATUS_INSUFF_RESOURCES);
|
||||
}
|
||||
|
@ -472,7 +519,8 @@ static void test_bridging_performance(bool test_one_way)
|
|||
|
||||
tick1 = k_uptime_ticks();
|
||||
bt_mesh_brg_cfg_tbl_foreach_subnet(test_vector[idx].addr1, test_vector[idx].addr2,
|
||||
test_vector[idx].net_idx1, subnet_relay_cb_check, &idx);
|
||||
test_vector[idx].net_idx1, subnet_relay_cb_check,
|
||||
&idx);
|
||||
ticks += k_uptime_ticks() - tick1;
|
||||
|
||||
if (test_one_way) {
|
||||
|
@ -485,7 +533,8 @@ static void test_bridging_performance(bool test_one_way)
|
|||
tbl_row = NULL;
|
||||
tick1 = k_uptime_ticks();
|
||||
bt_mesh_brg_cfg_tbl_foreach_subnet(test_vector[idx].addr2, test_vector[idx].addr1,
|
||||
test_vector[idx].net_idx2, subnet_relay_cb_check_rev, &idx);
|
||||
test_vector[idx].net_idx2,
|
||||
subnet_relay_cb_check_rev, &idx);
|
||||
ticks += k_uptime_ticks() - tick1;
|
||||
}
|
||||
printk("ticks: %8u us: %u\n", ticks, k_ticks_to_us_floor32(ticks));
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
tests:
|
||||
bluetooth.mesh.brg:
|
||||
platform_allow:
|
||||
- native_posix
|
||||
- native_sim
|
||||
tags:
|
||||
- bluetooth
|
||||
|
|
|
@ -50,8 +50,7 @@ BT_MESH_SHELL_HEALTH_PUB_DEFINE(health_pub);
|
|||
static const struct bt_mesh_model root_models[] = {
|
||||
BT_MESH_MODEL_CFG_SRV,
|
||||
BT_MESH_MODEL_CFG_CLI(&cfg_cli),
|
||||
BT_MESH_MODEL_HEALTH_SRV(&bt_mesh_shell_health_srv, &health_pub,
|
||||
health_srv_meta),
|
||||
BT_MESH_MODEL_HEALTH_SRV(&bt_mesh_shell_health_srv, &health_pub, health_srv_meta),
|
||||
BT_MESH_MODEL_HEALTH_CLI(&bt_mesh_shell_health_cli),
|
||||
#if defined(CONFIG_BT_MESH_DFD_SRV)
|
||||
BT_MESH_MODEL_DFD_SRV(&dfd_srv),
|
||||
|
|
|
@ -904,18 +904,18 @@ struct btp_rpr_reprov_remote_cmd {
|
|||
bool comp_change;
|
||||
} __packed;
|
||||
|
||||
#define BTP_MESH_SUBNET_BRIDGE_GET 0x62
|
||||
#define BTP_MESH_SUBNET_BRIDGE_GET 0x62
|
||||
struct btp_mesh_subnet_bridge_get_cmd {
|
||||
uint16_t addr;
|
||||
} __packed;
|
||||
|
||||
#define BTP_MESH_SUBNET_BRIDGE_SET 0x63
|
||||
#define BTP_MESH_SUBNET_BRIDGE_SET 0x63
|
||||
struct btp_mesh_subnet_bridge_set_cmd {
|
||||
uint16_t addr;
|
||||
uint8_t val;
|
||||
} __packed;
|
||||
|
||||
#define BTP_MESH_BRIDGING_TABLE_ADD 0x64
|
||||
#define BTP_MESH_BRIDGING_TABLE_ADD 0x64
|
||||
struct btp_mesh_bridging_table_add_cmd {
|
||||
uint16_t addr;
|
||||
uint8_t directions;
|
||||
|
@ -925,7 +925,7 @@ struct btp_mesh_bridging_table_add_cmd {
|
|||
uint16_t addr2;
|
||||
} __packed;
|
||||
|
||||
#define BTP_MESH_BRIDGING_TABLE_REMOVE 0x65
|
||||
#define BTP_MESH_BRIDGING_TABLE_REMOVE 0x65
|
||||
struct btp_mesh_bridging_table_remove_cmd {
|
||||
uint16_t addr;
|
||||
uint16_t net_idx1;
|
||||
|
@ -934,7 +934,7 @@ struct btp_mesh_bridging_table_remove_cmd {
|
|||
uint16_t addr2;
|
||||
} __packed;
|
||||
|
||||
#define BTP_MESH_BRIDGED_SUBNETS_GET 0x66
|
||||
#define BTP_MESH_BRIDGED_SUBNETS_GET 0x66
|
||||
struct btp_mesh_bridged_subnets_get_cmd {
|
||||
uint16_t addr;
|
||||
uint8_t filter;
|
||||
|
@ -942,7 +942,7 @@ struct btp_mesh_bridged_subnets_get_cmd {
|
|||
uint8_t start_idx;
|
||||
} __packed;
|
||||
|
||||
#define BTP_MESH_BRIDGING_TABLE_GET 0x67
|
||||
#define BTP_MESH_BRIDGING_TABLE_GET 0x67
|
||||
struct btp_mesh_bridging_table_get_cmd {
|
||||
uint16_t addr;
|
||||
uint16_t net_idx1;
|
||||
|
@ -950,7 +950,7 @@ struct btp_mesh_bridging_table_get_cmd {
|
|||
uint16_t start_idx;
|
||||
} __packed;
|
||||
|
||||
#define BTP_MESH_BRIDGING_TABLE_SIZE_GET 0x68
|
||||
#define BTP_MESH_BRIDGING_TABLE_SIZE_GET 0x68
|
||||
struct btp_mesh_bridging_table_size_get_cmd {
|
||||
uint16_t addr;
|
||||
} __packed;
|
||||
|
|
|
@ -2083,14 +2083,32 @@ static uint8_t models_metadata_get(const void *cmd, uint16_t cmd_len,
|
|||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_MESH_BRG_CFG_CLI)
|
||||
static uint8_t subnet_bridge_get(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
static uint8_t subnet_bridge_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_subnet_bridge_get_cmd *cp = cmd;
|
||||
enum bt_mesh_subnet_bridge_state state;
|
||||
int err;
|
||||
|
||||
err = bt_mesh_brg_cfg_cli_subnet_bridge_get(net.net_idx, sys_le16_to_cpu(cp->addr),
|
||||
err = bt_mesh_brg_cfg_cli_subnet_bridge_get(net.net_idx, sys_le16_to_cpu(cp->addr), &state);
|
||||
if (err) {
|
||||
LOG_ERR("err=%d", err);
|
||||
return BTP_STATUS_FAILED;
|
||||
}
|
||||
|
||||
LOG_DBG("Subnet Bridge state: %u", state);
|
||||
|
||||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t subnet_bridge_set(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_subnet_bridge_set_cmd *cp = cmd;
|
||||
enum bt_mesh_subnet_bridge_state state;
|
||||
int err;
|
||||
|
||||
state = cp->val;
|
||||
|
||||
err = bt_mesh_brg_cfg_cli_subnet_bridge_set(net.net_idx, sys_le16_to_cpu(cp->addr), state,
|
||||
&state);
|
||||
if (err) {
|
||||
LOG_ERR("err=%d", err);
|
||||
|
@ -2102,29 +2120,7 @@ static uint8_t subnet_bridge_get(const void *cmd, uint16_t cmd_len,
|
|||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t subnet_bridge_set(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_subnet_bridge_set_cmd *cp = cmd;
|
||||
enum bt_mesh_subnet_bridge_state state;
|
||||
int err;
|
||||
|
||||
state = cp->val;
|
||||
|
||||
err = bt_mesh_brg_cfg_cli_subnet_bridge_set(net.net_idx, sys_le16_to_cpu(cp->addr),
|
||||
state, &state);
|
||||
if (err) {
|
||||
LOG_ERR("err=%d", err);
|
||||
return BTP_STATUS_FAILED;
|
||||
}
|
||||
|
||||
LOG_DBG("Subnet Bridge state: %u", state);
|
||||
|
||||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_bridging_table_add_cmd *cp = cmd;
|
||||
struct bt_mesh_bridging_table_entry entry;
|
||||
|
@ -2139,8 +2135,8 @@ static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len,
|
|||
entry.addr1 = sys_le16_to_cpu(cp->addr1);
|
||||
entry.addr2 = sys_le16_to_cpu(cp->addr2);
|
||||
|
||||
err = bt_mesh_brg_cfg_cli_bridging_table_add(net_key_idx, sys_le16_to_cpu(cp->addr),
|
||||
&entry, &rp);
|
||||
err = bt_mesh_brg_cfg_cli_bridging_table_add(net_key_idx, sys_le16_to_cpu(cp->addr), &entry,
|
||||
&rp);
|
||||
if (err) {
|
||||
LOG_ERR("err=%d", err);
|
||||
return BTP_STATUS_FAILED;
|
||||
|
@ -2149,8 +2145,8 @@ static uint8_t bridging_table_add(const void *cmd, uint16_t cmd_len,
|
|||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len, void *rsp,
|
||||
uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_bridging_table_remove_cmd *cp = cmd;
|
||||
struct bt_mesh_bridging_table_status rp;
|
||||
|
@ -2158,11 +2154,10 @@ static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len,
|
|||
|
||||
LOG_DBG("");
|
||||
|
||||
err = bt_mesh_brg_cfg_cli_bridging_table_remove(net_key_idx, sys_le16_to_cpu(cp->addr),
|
||||
sys_le16_to_cpu(cp->net_idx1),
|
||||
sys_le16_to_cpu(cp->net_idx2),
|
||||
sys_le16_to_cpu(cp->addr1),
|
||||
sys_le16_to_cpu(cp->addr2), &rp);
|
||||
err = bt_mesh_brg_cfg_cli_bridging_table_remove(
|
||||
net_key_idx, sys_le16_to_cpu(cp->addr), sys_le16_to_cpu(cp->net_idx1),
|
||||
sys_le16_to_cpu(cp->net_idx2), sys_le16_to_cpu(cp->addr1),
|
||||
sys_le16_to_cpu(cp->addr2), &rp);
|
||||
|
||||
if (err) {
|
||||
LOG_ERR("err=%d", err);
|
||||
|
@ -2172,8 +2167,7 @@ static uint8_t bridging_table_remove(const void *cmd, uint16_t cmd_len,
|
|||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_bridged_subnets_get_cmd *cp = cmd;
|
||||
struct bt_mesh_filter_netkey filter_net_idx;
|
||||
|
@ -2200,8 +2194,7 @@ static uint8_t bridged_subnets_get(const void *cmd, uint16_t cmd_len,
|
|||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_bridging_table_get_cmd *cp = cmd;
|
||||
struct bt_mesh_bridging_table_list rp;
|
||||
|
@ -2214,10 +2207,9 @@ static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len,
|
|||
*/
|
||||
rp.list = NULL;
|
||||
|
||||
err = bt_mesh_brg_cfg_cli_bridging_table_get(net_key_idx, sys_le16_to_cpu(cp->addr),
|
||||
sys_le16_to_cpu(cp->net_idx1),
|
||||
sys_le16_to_cpu(cp->net_idx2),
|
||||
sys_le16_to_cpu(cp->start_idx), &rp);
|
||||
err = bt_mesh_brg_cfg_cli_bridging_table_get(
|
||||
net_key_idx, sys_le16_to_cpu(cp->addr), sys_le16_to_cpu(cp->net_idx1),
|
||||
sys_le16_to_cpu(cp->net_idx2), sys_le16_to_cpu(cp->start_idx), &rp);
|
||||
if (err) {
|
||||
LOG_ERR("err=%d", err);
|
||||
return BTP_STATUS_FAILED;
|
||||
|
@ -2226,8 +2218,8 @@ static uint8_t bridging_table_get(const void *cmd, uint16_t cmd_len,
|
|||
return BTP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static uint8_t bridging_table_size_get(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
static uint8_t bridging_table_size_get(const void *cmd, uint16_t cmd_len, void *rsp,
|
||||
uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_bridging_table_size_get_cmd *cp = cmd;
|
||||
uint16_t size;
|
||||
|
@ -2247,8 +2239,7 @@ static uint8_t bridging_table_size_get(const void *cmd, uint16_t cmd_len,
|
|||
|
||||
#endif
|
||||
|
||||
static uint8_t composition_data_get(const void *cmd, uint16_t cmd_len,
|
||||
void *rsp, uint16_t *rsp_len)
|
||||
static uint8_t composition_data_get(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len)
|
||||
{
|
||||
const struct btp_mesh_comp_data_get_cmd *cp = cmd;
|
||||
struct btp_mesh_comp_data_get_rp *rp = rsp;
|
||||
|
@ -5163,218 +5154,137 @@ static const struct btp_handler handlers[] = {
|
|||
.func = proxy_identity_enable,
|
||||
},
|
||||
#if defined(CONFIG_BT_MESH_PROXY_CLIENT)
|
||||
{
|
||||
.opcode = BTP_MESH_PROXY_CONNECT,
|
||||
.expect_len = sizeof(struct btp_proxy_connect_cmd),
|
||||
.func = proxy_connect
|
||||
},
|
||||
{.opcode = BTP_MESH_PROXY_CONNECT,
|
||||
.expect_len = sizeof(struct btp_proxy_connect_cmd),
|
||||
.func = proxy_connect},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_SAR_CFG_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_SAR_TRANSMITTER_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_transmitter_get_cmd),
|
||||
.func = sar_transmitter_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_SAR_TRANSMITTER_SET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_transmitter_set_cmd),
|
||||
.func = sar_transmitter_set
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_SAR_RECEIVER_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_receiver_get_cmd),
|
||||
.func = sar_receiver_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_SAR_RECEIVER_SET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_receiver_set_cmd),
|
||||
.func = sar_receiver_set
|
||||
},
|
||||
{.opcode = BTP_MESH_SAR_TRANSMITTER_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_transmitter_get_cmd),
|
||||
.func = sar_transmitter_get},
|
||||
{.opcode = BTP_MESH_SAR_TRANSMITTER_SET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_transmitter_set_cmd),
|
||||
.func = sar_transmitter_set},
|
||||
{.opcode = BTP_MESH_SAR_RECEIVER_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_receiver_get_cmd),
|
||||
.func = sar_receiver_get},
|
||||
{.opcode = BTP_MESH_SAR_RECEIVER_SET,
|
||||
.expect_len = sizeof(struct btp_mesh_sar_receiver_set_cmd),
|
||||
.func = sar_receiver_set},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_LARGE_COMP_DATA_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_LARGE_COMP_DATA_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_large_comp_data_get_cmd),
|
||||
.func = large_comp_data_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_MODELS_METADATA_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_models_metadata_get_cmd),
|
||||
.func = models_metadata_get
|
||||
},
|
||||
{.opcode = BTP_MESH_LARGE_COMP_DATA_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_large_comp_data_get_cmd),
|
||||
.func = large_comp_data_get},
|
||||
{.opcode = BTP_MESH_MODELS_METADATA_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_models_metadata_get_cmd),
|
||||
.func = models_metadata_get},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_OP_AGG_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_OPCODES_AGGREGATOR_INIT,
|
||||
.expect_len = sizeof(struct btp_mesh_opcodes_aggregator_init_cmd),
|
||||
.func = opcodes_aggregator_init
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_OPCODES_AGGREGATOR_SEND,
|
||||
.expect_len = 0,
|
||||
.func = opcodes_aggregator_send
|
||||
},
|
||||
{.opcode = BTP_MESH_OPCODES_AGGREGATOR_INIT,
|
||||
.expect_len = sizeof(struct btp_mesh_opcodes_aggregator_init_cmd),
|
||||
.func = opcodes_aggregator_init},
|
||||
{.opcode = BTP_MESH_OPCODES_AGGREGATOR_SEND,
|
||||
.expect_len = 0,
|
||||
.func = opcodes_aggregator_send},
|
||||
#endif
|
||||
{
|
||||
.opcode = BTP_MESH_COMP_CHANGE_PREPARE,
|
||||
.expect_len = 0,
|
||||
.func = change_prepare
|
||||
},
|
||||
{.opcode = BTP_MESH_COMP_CHANGE_PREPARE, .expect_len = 0, .func = change_prepare},
|
||||
#if defined(CONFIG_BT_MESH_RPR_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_SCAN_START,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_start_cmd),
|
||||
.func = rpr_scan_start
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_EXT_SCAN_START,
|
||||
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
|
||||
.func = rpr_ext_scan_start
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_SCAN_CAPS_GET,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_caps_get_cmd),
|
||||
.func = rpr_scan_caps_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_SCAN_GET,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_get_cmd),
|
||||
.func = rpr_scan_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_SCAN_STOP,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_stop_cmd),
|
||||
.func = rpr_scan_stop
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_LINK_GET,
|
||||
.expect_len = sizeof(struct btp_rpr_link_get_cmd),
|
||||
.func = rpr_link_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_LINK_CLOSE,
|
||||
.expect_len = sizeof(struct btp_rpr_link_close_cmd),
|
||||
.func = rpr_link_close
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_PROV_REMOTE,
|
||||
.expect_len = sizeof(struct btp_rpr_prov_remote_cmd),
|
||||
.func = rpr_prov_remote
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_RPR_REPROV_REMOTE,
|
||||
.expect_len = sizeof(struct btp_rpr_reprov_remote_cmd),
|
||||
.func = rpr_reprov_remote
|
||||
},
|
||||
{.opcode = BTP_MESH_RPR_SCAN_START,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_start_cmd),
|
||||
.func = rpr_scan_start},
|
||||
{.opcode = BTP_MESH_RPR_EXT_SCAN_START,
|
||||
.expect_len = BTP_HANDLER_LENGTH_VARIABLE,
|
||||
.func = rpr_ext_scan_start},
|
||||
{.opcode = BTP_MESH_RPR_SCAN_CAPS_GET,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_caps_get_cmd),
|
||||
.func = rpr_scan_caps_get},
|
||||
{.opcode = BTP_MESH_RPR_SCAN_GET,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_get_cmd),
|
||||
.func = rpr_scan_get},
|
||||
{.opcode = BTP_MESH_RPR_SCAN_STOP,
|
||||
.expect_len = sizeof(struct btp_rpr_scan_stop_cmd),
|
||||
.func = rpr_scan_stop},
|
||||
{.opcode = BTP_MESH_RPR_LINK_GET,
|
||||
.expect_len = sizeof(struct btp_rpr_link_get_cmd),
|
||||
.func = rpr_link_get},
|
||||
{.opcode = BTP_MESH_RPR_LINK_CLOSE,
|
||||
.expect_len = sizeof(struct btp_rpr_link_close_cmd),
|
||||
.func = rpr_link_close},
|
||||
{.opcode = BTP_MESH_RPR_PROV_REMOTE,
|
||||
.expect_len = sizeof(struct btp_rpr_prov_remote_cmd),
|
||||
.func = rpr_prov_remote},
|
||||
{.opcode = BTP_MESH_RPR_REPROV_REMOTE,
|
||||
.expect_len = sizeof(struct btp_rpr_reprov_remote_cmd),
|
||||
.func = rpr_reprov_remote},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_PRIV_BEACON_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_PRIV_BEACON_GET,
|
||||
.expect_len = sizeof(struct btp_priv_beacon_get_cmd),
|
||||
.func = priv_beacon_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_PRIV_BEACON_SET,
|
||||
.expect_len = sizeof(struct btp_priv_beacon_set_cmd),
|
||||
.func = priv_beacon_set
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_PRIV_GATT_PROXY_GET,
|
||||
.expect_len = sizeof(struct btp_priv_gatt_proxy_get_cmd),
|
||||
.func = priv_gatt_proxy_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_PRIV_GATT_PROXY_SET,
|
||||
.expect_len = sizeof(struct btp_priv_gatt_proxy_set_cmd),
|
||||
.func = priv_gatt_proxy_set
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_PRIV_NODE_ID_GET,
|
||||
.expect_len = sizeof(struct btp_priv_node_id_get_cmd),
|
||||
.func = priv_node_id_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_PRIV_NODE_ID_SET,
|
||||
.expect_len = sizeof(struct btp_priv_node_id_set_cmd),
|
||||
.func = priv_node_id_set
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_PROXY_PRIVATE_IDENTITY,
|
||||
.expect_len = 0,
|
||||
.func = proxy_private_identity_enable
|
||||
},
|
||||
{.opcode = BTP_MESH_PRIV_BEACON_GET,
|
||||
.expect_len = sizeof(struct btp_priv_beacon_get_cmd),
|
||||
.func = priv_beacon_get},
|
||||
{.opcode = BTP_MESH_PRIV_BEACON_SET,
|
||||
.expect_len = sizeof(struct btp_priv_beacon_set_cmd),
|
||||
.func = priv_beacon_set},
|
||||
{.opcode = BTP_MESH_PRIV_GATT_PROXY_GET,
|
||||
.expect_len = sizeof(struct btp_priv_gatt_proxy_get_cmd),
|
||||
.func = priv_gatt_proxy_get},
|
||||
{.opcode = BTP_MESH_PRIV_GATT_PROXY_SET,
|
||||
.expect_len = sizeof(struct btp_priv_gatt_proxy_set_cmd),
|
||||
.func = priv_gatt_proxy_set},
|
||||
{.opcode = BTP_MESH_PRIV_NODE_ID_GET,
|
||||
.expect_len = sizeof(struct btp_priv_node_id_get_cmd),
|
||||
.func = priv_node_id_get},
|
||||
{.opcode = BTP_MESH_PRIV_NODE_ID_SET,
|
||||
.expect_len = sizeof(struct btp_priv_node_id_set_cmd),
|
||||
.func = priv_node_id_set},
|
||||
{.opcode = BTP_MESH_PROXY_PRIVATE_IDENTITY,
|
||||
.expect_len = 0,
|
||||
.func = proxy_private_identity_enable},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_OD_PRIV_PROXY_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_OD_PRIV_PROXY_GET,
|
||||
.expect_len = sizeof(struct btp_od_priv_proxy_get_cmd),
|
||||
.func = od_priv_proxy_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_OD_PRIV_PROXY_SET,
|
||||
.expect_len = sizeof(struct btp_od_priv_proxy_set_cmd),
|
||||
.func = od_priv_proxy_set
|
||||
},
|
||||
{.opcode = BTP_MESH_OD_PRIV_PROXY_GET,
|
||||
.expect_len = sizeof(struct btp_od_priv_proxy_get_cmd),
|
||||
.func = od_priv_proxy_get},
|
||||
{.opcode = BTP_MESH_OD_PRIV_PROXY_SET,
|
||||
.expect_len = sizeof(struct btp_od_priv_proxy_set_cmd),
|
||||
.func = od_priv_proxy_set},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_SOL_PDU_RPL_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_SRPL_CLEAR,
|
||||
.expect_len = sizeof(struct btp_srpl_clear_cmd),
|
||||
.func = srpl_clear
|
||||
},
|
||||
{.opcode = BTP_MESH_SRPL_CLEAR,
|
||||
.expect_len = sizeof(struct btp_srpl_clear_cmd),
|
||||
.func = srpl_clear},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_BRG_CFG_CLI)
|
||||
{
|
||||
.opcode = BTP_MESH_SUBNET_BRIDGE_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_subnet_bridge_get_cmd),
|
||||
.func = subnet_bridge_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_SUBNET_BRIDGE_SET,
|
||||
.expect_len = sizeof(struct btp_mesh_subnet_bridge_set_cmd),
|
||||
.func = subnet_bridge_set
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_BRIDGING_TABLE_ADD,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_add_cmd),
|
||||
.func = bridging_table_add
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_BRIDGING_TABLE_REMOVE,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_remove_cmd),
|
||||
.func = bridging_table_remove
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_BRIDGED_SUBNETS_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_bridged_subnets_get_cmd),
|
||||
.func = bridged_subnets_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_BRIDGING_TABLE_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_get_cmd),
|
||||
.func = bridging_table_get
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MESH_BRIDGING_TABLE_SIZE_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_size_get_cmd),
|
||||
.func = bridging_table_size_get
|
||||
},
|
||||
{.opcode = BTP_MESH_SUBNET_BRIDGE_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_subnet_bridge_get_cmd),
|
||||
.func = subnet_bridge_get},
|
||||
{.opcode = BTP_MESH_SUBNET_BRIDGE_SET,
|
||||
.expect_len = sizeof(struct btp_mesh_subnet_bridge_set_cmd),
|
||||
.func = subnet_bridge_set},
|
||||
{.opcode = BTP_MESH_BRIDGING_TABLE_ADD,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_add_cmd),
|
||||
.func = bridging_table_add},
|
||||
{.opcode = BTP_MESH_BRIDGING_TABLE_REMOVE,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_remove_cmd),
|
||||
.func = bridging_table_remove},
|
||||
{.opcode = BTP_MESH_BRIDGED_SUBNETS_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_bridged_subnets_get_cmd),
|
||||
.func = bridged_subnets_get},
|
||||
{.opcode = BTP_MESH_BRIDGING_TABLE_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_get_cmd),
|
||||
.func = bridging_table_get},
|
||||
{.opcode = BTP_MESH_BRIDGING_TABLE_SIZE_GET,
|
||||
.expect_len = sizeof(struct btp_mesh_bridging_table_size_get_cmd),
|
||||
.func = bridging_table_size_get},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_PROXY_SOLICITATION)
|
||||
{
|
||||
.opcode = BTP_MESH_PROXY_SOLICIT,
|
||||
.expect_len = sizeof(struct btp_proxy_solicit_cmd),
|
||||
.func = proxy_solicit
|
||||
},
|
||||
{.opcode = BTP_MESH_PROXY_SOLICIT,
|
||||
.expect_len = sizeof(struct btp_proxy_solicit_cmd),
|
||||
.func = proxy_solicit},
|
||||
#endif
|
||||
{
|
||||
.opcode = BTP_MESH_START,
|
||||
.expect_len = 0,
|
||||
.func = start
|
||||
},
|
||||
{.opcode = BTP_MESH_START, .expect_len = 0, .func = start},
|
||||
};
|
||||
|
||||
|
||||
static const struct btp_handler mdl_handlers[] = {
|
||||
#if defined(CONFIG_BT_MESH_DFD_SRV)
|
||||
{
|
||||
|
@ -5431,23 +5341,13 @@ static const struct btp_handler mdl_handlers[] = {
|
|||
},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_BLOB_SRV)
|
||||
{
|
||||
.opcode = BTP_MMDL_BLOB_SRV_RECV,
|
||||
.expect_len = sizeof(struct btp_mmdl_blob_srv_recv_cmd),
|
||||
.func = blob_srv_recv
|
||||
},
|
||||
{
|
||||
.opcode = BTP_MMDL_BLOB_SRV_CANCEL,
|
||||
.expect_len = 0,
|
||||
.func = blob_srv_cancel
|
||||
},
|
||||
{.opcode = BTP_MMDL_BLOB_SRV_RECV,
|
||||
.expect_len = sizeof(struct btp_mmdl_blob_srv_recv_cmd),
|
||||
.func = blob_srv_recv},
|
||||
{.opcode = BTP_MMDL_BLOB_SRV_CANCEL, .expect_len = 0, .func = blob_srv_cancel},
|
||||
#endif
|
||||
#if defined(CONFIG_BT_MESH_DFU_SRV)
|
||||
{
|
||||
.opcode = BTP_MMDL_DFU_SRV_APPLY,
|
||||
.expect_len = 0,
|
||||
.func = dfu_srv_apply
|
||||
},
|
||||
{.opcode = BTP_MMDL_DFU_SRV_APPLY, .expect_len = 0, .func = dfu_srv_apply},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -60,14 +60,9 @@ bst_test_install_t test_installers[] = {
|
|||
test_proxy_sol_install,
|
||||
#endif
|
||||
#elif defined(CONFIG_BT_MESH_GATT_PROXY)
|
||||
test_adv_install,
|
||||
test_suspend_install,
|
||||
test_beacon_install,
|
||||
test_adv_install, test_suspend_install, test_beacon_install,
|
||||
#elif defined(CONFIG_BT_CTLR_LOW_LAT)
|
||||
test_transport_install,
|
||||
test_friendship_install,
|
||||
test_suspend_install,
|
||||
test_adv_install,
|
||||
test_transport_install, test_friendship_install, test_suspend_install, test_adv_install,
|
||||
#else
|
||||
test_transport_install,
|
||||
test_friendship_install,
|
||||
|
@ -85,8 +80,7 @@ bst_test_install_t test_installers[] = {
|
|||
test_cdp1_install,
|
||||
test_brg_install,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
NULL};
|
||||
|
||||
static struct k_thread bsim_mesh_thread;
|
||||
static K_KERNEL_STACK_DEFINE(bsim_mesh_thread_stack, 4096);
|
||||
|
|
|
@ -16,30 +16,29 @@
|
|||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(test_brg, LOG_LEVEL_INF);
|
||||
|
||||
#define WAIT_TIME 32 /*seconds*/
|
||||
#define WAIT_TIME 32 /*seconds*/
|
||||
#define WAIT_TIME_IVU_TEST 240 /* seconds */
|
||||
#define BEACON_INTERVAL 10 /*seconds */
|
||||
#define BEACON_INTERVAL 10 /*seconds */
|
||||
|
||||
#define PROV_ADDR 0x0001
|
||||
#define PROV_ADDR 0x0001
|
||||
/* Bridge address must be less than DEVICE_ADDR_START */
|
||||
#define BRIDGE_ADDR 0x0002
|
||||
#define BRIDGE_ADDR 0x0002
|
||||
#define DEVICE_ADDR_START 0x0003
|
||||
|
||||
#define REMOTE_NODES 2
|
||||
|
||||
static const uint8_t prov_dev_key[16] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab,
|
||||
0xcd, 0xef, 0x01, 0x23, 0x45, 0x67,
|
||||
0x89, 0xab, 0xcd, 0xef };
|
||||
static const uint8_t prov_dev_key[16] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
|
||||
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef};
|
||||
|
||||
static const uint8_t subnet_keys[][16] = {
|
||||
{ 0xaa, 0xbb, 0xcc },
|
||||
{ 0xdd, 0xee, 0xff },
|
||||
{ 0x11, 0x22, 0x33 },
|
||||
{0xaa, 0xbb, 0xcc},
|
||||
{0xdd, 0xee, 0xff},
|
||||
{0x11, 0x22, 0x33},
|
||||
};
|
||||
|
||||
static uint8_t prov_uuid[16] = { 0x6c, 0x69, 0x6e, 0x67, 0x61, 0xaa };
|
||||
static uint8_t bridge_uuid[16] = { 0x6c, 0x69, 0x6e, 0x67, 0x61, 0xbb };
|
||||
static uint8_t dev_uuid[16] = { 0x6c, 0x69, 0x6e, 0x67, 0x61, 0xcc };
|
||||
static uint8_t prov_uuid[16] = {0x6c, 0x69, 0x6e, 0x67, 0x61, 0xaa};
|
||||
static uint8_t bridge_uuid[16] = {0x6c, 0x69, 0x6e, 0x67, 0x61, 0xbb};
|
||||
static uint8_t dev_uuid[16] = {0x6c, 0x69, 0x6e, 0x67, 0x61, 0xcc};
|
||||
|
||||
static int test_ividx = 0x123456;
|
||||
|
||||
|
@ -79,7 +78,7 @@ static void test_bridge_init(void)
|
|||
static void test_device_init(void)
|
||||
{
|
||||
ASSERT_TRUE_MSG(get_device_nbr() >= 2, "Regular devices must be initialized after "
|
||||
"tester and Bridge devices.");
|
||||
"tester and Bridge devices.");
|
||||
|
||||
/* Regular devices addresses starts from address 0x0003.*/
|
||||
dev_uuid[6] = get_device_nbr() + 1;
|
||||
|
@ -129,11 +128,9 @@ static void prov_node_added(uint16_t net_idx, uint8_t uuid[16], uint16_t addr, u
|
|||
k_sem_give(&prov_sem);
|
||||
}
|
||||
|
||||
static struct bt_mesh_prov tester_prov = {
|
||||
.uuid = prov_uuid,
|
||||
.unprovisioned_beacon = unprovisioned_beacon,
|
||||
.node_added = prov_node_added
|
||||
};
|
||||
static struct bt_mesh_prov tester_prov = {.uuid = prov_uuid,
|
||||
.unprovisioned_beacon = unprovisioned_beacon,
|
||||
.node_added = prov_node_added};
|
||||
|
||||
static void prov_complete(uint16_t net_idx, uint16_t addr)
|
||||
{
|
||||
|
@ -174,8 +171,8 @@ static void tester_setup(void)
|
|||
for (int i = 0; i < REMOTE_NODES; i++) {
|
||||
LOG_INF("Creating subnet idx %d", i);
|
||||
|
||||
ASSERT_OK(bt_mesh_cfg_cli_net_key_add(0, PROV_ADDR, i + 1, subnet_keys[i],
|
||||
&status));
|
||||
ASSERT_OK(
|
||||
bt_mesh_cfg_cli_net_key_add(0, PROV_ADDR, i + 1, subnet_keys[i], &status));
|
||||
if (status) {
|
||||
FAIL("NetKey add failed (status %u)", status);
|
||||
return;
|
||||
|
@ -216,10 +213,8 @@ static void bridge_entry_add(uint16_t src, uint16_t dst, uint16_t net_idx1, uint
|
|||
entry.addr2 = dst;
|
||||
|
||||
err = bt_mesh_brg_cfg_cli_bridging_table_add(0, BRIDGE_ADDR, &entry, &rsp);
|
||||
if (err || rsp.status ||
|
||||
rsp.entry.directions != dir ||
|
||||
rsp.entry.net_idx1 != net_idx1 || rsp.entry.net_idx2 != net_idx2 ||
|
||||
rsp.entry.addr1 != src || rsp.entry.addr2 != dst) {
|
||||
if (err || rsp.status || rsp.entry.directions != dir || rsp.entry.net_idx1 != net_idx1 ||
|
||||
rsp.entry.net_idx2 != net_idx2 || rsp.entry.addr1 != src || rsp.entry.addr2 != dst) {
|
||||
FAIL("Bridging table add failed (err %d) (status %u)", err, rsp.status);
|
||||
return;
|
||||
}
|
||||
|
@ -229,8 +224,8 @@ static void bridge_entry_remove(uint16_t src, uint16_t dst, uint16_t net_idx1, u
|
|||
{
|
||||
struct bt_mesh_bridging_table_status rsp;
|
||||
|
||||
ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_remove(0, BRIDGE_ADDR, net_idx1, net_idx2,
|
||||
src, dst, &rsp));
|
||||
ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_remove(0, BRIDGE_ADDR, net_idx1, net_idx2, src,
|
||||
dst, &rsp));
|
||||
if (rsp.status) {
|
||||
FAIL("Bridging table remove failed (status %u)", rsp.status);
|
||||
return;
|
||||
|
@ -344,9 +339,8 @@ static void bridge_table_verify(uint16_t net_idx1, uint16_t net_idx2, uint16_t s
|
|||
|
||||
net_buf_simple_init(rsp.list, 0);
|
||||
|
||||
ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_get(0, BRIDGE_ADDR, net_idx1,
|
||||
net_idx2, start_idx,
|
||||
&rsp));
|
||||
ASSERT_OK(bt_mesh_brg_cfg_cli_bridging_table_get(0, BRIDGE_ADDR, net_idx1, net_idx2,
|
||||
start_idx, &rsp));
|
||||
ASSERT_EQUAL(rsp.status, 0);
|
||||
ASSERT_EQUAL(rsp.net_idx1, net_idx1);
|
||||
ASSERT_EQUAL(rsp.net_idx2, net_idx2);
|
||||
|
@ -388,9 +382,7 @@ static void device_ra_cb(uint8_t *data, size_t length)
|
|||
|
||||
case MSG_TYPE_GET: {
|
||||
uint8_t test_data[1 /*type */ + 1 /* msgs cnt */ + sizeof(recvd_msgs)] = {
|
||||
MSG_TYPE_STATUS,
|
||||
recvd_msgs_cnt
|
||||
};
|
||||
MSG_TYPE_STATUS, recvd_msgs_cnt};
|
||||
|
||||
memcpy(&test_data[2], recvd_msgs, recvd_msgs_cnt * sizeof(recvd_msgs[0]));
|
||||
|
||||
|
@ -578,12 +570,18 @@ static void test_tester_table_state_change(void)
|
|||
* the addresses and net keys indexs are provided in the opposite order.
|
||||
*/
|
||||
bridge_entry_add(DEVICE_ADDR_START, PROV_ADDR, 1, 0, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY);
|
||||
bridge_table_verify(0, 1, 0, (struct bridged_addresses_entry[]) {
|
||||
{ PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(1, 0, 0, (struct bridged_addresses_entry[]) {
|
||||
{ DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(
|
||||
0, 1, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY},
|
||||
},
|
||||
1);
|
||||
bridge_table_verify(
|
||||
1, 0, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY},
|
||||
},
|
||||
1);
|
||||
|
||||
k_sleep(K_SECONDS(1));
|
||||
|
||||
|
@ -599,9 +597,12 @@ static void test_tester_table_state_change(void)
|
|||
*/
|
||||
bridge_entry_remove(DEVICE_ADDR_START, PROV_ADDR, 1, 0);
|
||||
bridge_entry_add(PROV_ADDR, DEVICE_ADDR_START, 0, 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY);
|
||||
bridge_table_verify(0, 1, 0, (struct bridged_addresses_entry[]) {
|
||||
{ PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(
|
||||
0, 1, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY},
|
||||
},
|
||||
1);
|
||||
bridge_table_verify(1, 0, 0, NULL, 0);
|
||||
|
||||
ASSERT_OK(send_get(DEVICE_ADDR_START));
|
||||
|
@ -666,9 +667,12 @@ static void test_tester_net_key_remove(void)
|
|||
err = k_sem_take(&status_msg_recvd_sem, K_SECONDS(5));
|
||||
ASSERT_EQUAL(err, -EAGAIN);
|
||||
|
||||
bridge_table_verify(0, 2, 0, (struct bridged_addresses_entry[]) {
|
||||
{ PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(
|
||||
0, 2, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY},
|
||||
},
|
||||
1);
|
||||
|
||||
/* Bridging Table Get message will return Invalid NetKey Index error because Subnet 1 is
|
||||
* removed.
|
||||
|
@ -701,21 +705,33 @@ static void test_tester_persistence(void)
|
|||
return;
|
||||
}
|
||||
|
||||
bridge_table_verify(0, 1, 0, (struct bridged_addresses_entry[]) {
|
||||
{ PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(
|
||||
0, 1, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{PROV_ADDR, DEVICE_ADDR_START, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY},
|
||||
},
|
||||
1);
|
||||
|
||||
bridge_table_verify(0, 2, 0, (struct bridged_addresses_entry[]) {
|
||||
{ PROV_ADDR, DEVICE_ADDR_START + 1, BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(0, 2, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{PROV_ADDR, DEVICE_ADDR_START + 1,
|
||||
BT_MESH_SUBNET_BRIDGE_DIR_TWOWAY},
|
||||
},
|
||||
1);
|
||||
|
||||
bridge_table_verify(1, 0, 0, (struct bridged_addresses_entry[]) {
|
||||
{ DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(
|
||||
1, 0, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{DEVICE_ADDR_START, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY},
|
||||
},
|
||||
1);
|
||||
|
||||
bridge_table_verify(2, 0, 0, (struct bridged_addresses_entry[]) {
|
||||
{ DEVICE_ADDR_START + 1, PROV_ADDR, BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY },
|
||||
}, 1);
|
||||
bridge_table_verify(2, 0, 0,
|
||||
(struct bridged_addresses_entry[]){
|
||||
{DEVICE_ADDR_START + 1, PROV_ADDR,
|
||||
BT_MESH_SUBNET_BRIDGE_DIR_ONEWAY},
|
||||
},
|
||||
1);
|
||||
} else {
|
||||
tester_setup();
|
||||
|
||||
|
@ -758,7 +774,7 @@ static void msg_cache_workaround(void)
|
|||
* of the semaphor is not important as we just need to bump sequence number
|
||||
* enough to bypass message cache.
|
||||
*/
|
||||
(void) k_sem_take(&status_msg_recvd_sem, K_SECONDS(1));
|
||||
(void)k_sem_take(&status_msg_recvd_sem, K_SECONDS(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -942,21 +958,24 @@ static void test_device_simple_iv_test_mode(void)
|
|||
PASS();
|
||||
}
|
||||
|
||||
#define TEST_CASE(role, name, description) \
|
||||
{ \
|
||||
.test_id = "brg_" #role "_" #name, \
|
||||
.test_post_init_f = test_##role##_init, \
|
||||
.test_descr = description, \
|
||||
.test_tick_f = bt_mesh_test_timeout, \
|
||||
.test_main_f = test_##role##_##name, \
|
||||
#define TEST_CASE(role, name, description) \
|
||||
{ \
|
||||
.test_id = "brg_" #role "_" #name, \
|
||||
.test_post_init_f = test_##role##_init, \
|
||||
.test_descr = description, \
|
||||
.test_tick_f = bt_mesh_test_timeout, \
|
||||
.test_main_f = test_##role##_##name, \
|
||||
}
|
||||
|
||||
static const struct bst_test_instance test_brg[] = {
|
||||
TEST_CASE(tester, simple, "Tester node: provisions network, exchanges messages with "
|
||||
TEST_CASE(tester, simple,
|
||||
"Tester node: provisions network, exchanges messages with "
|
||||
"mesh nodes"),
|
||||
TEST_CASE(tester, table_state_change, "Tester node: tests changing bridging table "
|
||||
TEST_CASE(tester, table_state_change,
|
||||
"Tester node: tests changing bridging table "
|
||||
"state"),
|
||||
TEST_CASE(tester, net_key_remove, "Tester node: tests removing net key from Subnet "
|
||||
TEST_CASE(tester, net_key_remove,
|
||||
"Tester node: tests removing net key from Subnet "
|
||||
"Bridge"),
|
||||
#if CONFIG_BT_SETTINGS
|
||||
TEST_CASE(tester, persistence, "Tester node: test persistence of subnet bridge states"),
|
||||
|
@ -968,8 +987,7 @@ static const struct bst_test_instance test_brg[] = {
|
|||
TEST_CASE(bridge, simple_iv_test_mode, "Subnet Bridge node with IV test mode enabled"),
|
||||
TEST_CASE(device, simple_iv_test_mode, "A mesh node with IV test mode enabled"),
|
||||
|
||||
BSTEST_END_MARKER
|
||||
};
|
||||
BSTEST_END_MARKER};
|
||||
|
||||
struct bst_test_list *test_brg_install(struct bst_test_list *tests)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,6 @@ RunTest mesh_brg_ivu \
|
|||
brg_device_simple_iv_test_mode
|
||||
|
||||
overlay=overlay_psa_conf
|
||||
RunTest mesh_brg_ivu \
|
||||
RunTest mesh_brg_ivu_psa \
|
||||
brg_tester_ivu brg_bridge_simple_iv_test_mode brg_device_simple_iv_test_mode \
|
||||
brg_device_simple_iv_test_mode
|
||||
|
|
|
@ -21,5 +21,5 @@ RunTest mesh_brg_net_key_remove \
|
|||
brg_tester_net_key_remove brg_bridge_simple brg_device_simple brg_device_simple
|
||||
|
||||
overlay=overlay_psa_conf
|
||||
RunTest mesh_brg_net_key_remove \
|
||||
RunTest mesh_brg_net_key_remove_psa \
|
||||
brg_tester_net_key_remove brg_bridge_simple brg_device_simple brg_device_simple
|
||||
|
|
|
@ -22,9 +22,9 @@ RunTestFlash mesh_brg_persistence \
|
|||
|
||||
# The same test but with PSA crypto
|
||||
overlay="overlay_pst_conf_overlay_psa_conf"
|
||||
RunTestFlash mesh_brg_persistence \
|
||||
RunTestFlash mesh_brg_persistence_psa \
|
||||
brg_tester_persistence -flash_erase brg_bridge_simple -flash_erase
|
||||
|
||||
overlay="overlay_pst_conf_overlay_psa_conf"
|
||||
RunTestFlash mesh_brg_persistence \
|
||||
RunTestFlash mesh_brg_persistence_psa \
|
||||
brg_tester_persistence brg_bridge_simple
|
||||
|
|
|
@ -41,5 +41,5 @@ RunTest mesh_brg_simple \
|
|||
brg_tester_simple brg_bridge_simple brg_device_simple brg_device_simple
|
||||
|
||||
overlay=overlay_psa_conf
|
||||
RunTest mesh_brg_simple \
|
||||
RunTest mesh_brg_simple_psa \
|
||||
brg_tester_simple brg_bridge_simple brg_device_simple brg_device_simple
|
||||
|
|
|
@ -28,5 +28,5 @@ RunTest mesh_brg_table_state_change \
|
|||
brg_tester_table_state_change brg_bridge_simple brg_device_simple brg_device_simple
|
||||
|
||||
overlay=overlay_psa_conf
|
||||
RunTest mesh_brg_table_state_change \
|
||||
RunTest mesh_brg_table_state_change_psa \
|
||||
brg_tester_table_state_change brg_bridge_simple brg_device_simple brg_device_simple
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue