Add Gtest testcase for CONFIG feature of Mesh framework 76/240776/2
authorAmit Purwar <amit.purwar@samsung.com>
Mon, 10 Aug 2020 07:03:04 +0000 (12:33 +0530)
committerAmit Purwar <amit.purwar@samsung.com>
Thu, 13 Aug 2020 07:08:00 +0000 (12:38 +0530)
Change-Id: I181c27d43a0b07cfc132bb990e4c21164cd64629
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
tests/unittest/mock/bluetooth-mock.c
tests/unittest/tct-bluetooth-core_mobile.h
tests/unittest/utc_bluetooth_mesh_network_negative.c
tests/unittest/utc_bluetooth_mesh_network_positive.c

index e529896..c208c16 100644 (file)
@@ -827,7 +827,7 @@ API int bluetooth_mesh_network_add_appkey(bluetooth_mesh_network_t *network,
 }
 
 API int bluetooth_mesh_netkey_get_all_appkey(bluetooth_mesh_network_t *network,
-               uint16_t netkey_idx,GPtrArray **appkeys)
+               uint16_t netkey_idx, GPtrArray **appkeys)
 {
        return BLUETOOTH_ERROR_NONE;
 }
@@ -892,8 +892,8 @@ API int bluetooth_mesh_network_provision_device(bluetooth_mesh_provisioning_requ
        bluetooth_mesh_provisioning_result_t *prov_result = NULL;
 
        prov_result = g_malloc0(sizeof(bluetooth_mesh_provisioning_result_t));
-       memcpy(prov_result->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH);
-       memcpy(prov_result->dev_uuid, req->dev_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH);
+       g_strlcpy(prov_result->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       g_strlcpy(prov_result->dev_uuid, req->dev_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
 
        bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
        bt_event->event = BLUETOOTH_EVENT_MESH_PROVISIONING_FINISHED;
@@ -921,3 +921,238 @@ API int bluetooth_mesh_network_remove_group(bluetooth_mesh_network_t *network,
 {
        return BLUETOOTH_ERROR_NONE;
 }
+
+API int bluetooth_mesh_browse_remote_node(bluetooth_mesh_node_discover_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_node_discover_t *node_result = NULL;
+
+       node_result = g_malloc0(sizeof(bluetooth_mesh_node_discover_t));
+       g_strlcpy(node_result->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
+       g_strlcpy(node_result->dev_uuid, req->dev_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
+       node_result->unicast = req->unicast;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_NODE_BROWSED;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = node_result;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_node_browse_vendor_features(bluetooth_mesh_node_features_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_node_features_t *node_feature = NULL;
+
+       node_feature = g_malloc0(sizeof(bluetooth_mesh_node_features_t));
+       g_strlcpy(node_feature->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
+       g_strlcpy(node_feature->dev_uuid, req->dev_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
+       node_feature->unicast = req->unicast;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_NODE_VENDOR_FEATURES;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = node_feature;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_node_get_all_netkeys(bluetooth_mesh_node_discover_t *node, GPtrArray **netkeys)
+{
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_node_get_all_appkeys(bluetooth_mesh_node_discover_t *req, GPtrArray **appkeys)
+{
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_node_ttl_execute(bluetooth_mesh_node_ttl_info_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_node_ttl_info_t *node_ttl = NULL;
+
+       node_ttl = g_malloc0(sizeof(bluetooth_mesh_node_ttl_info_t));
+       g_strlcpy(node_ttl->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
+       node_ttl->unicast = req->unicast;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_NODE_TTL_CONFIGURED;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = node_ttl;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_node_configure_key(bluetooth_mesh_key_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_key_configure_t *node_config = NULL;
+
+       node_config = g_malloc0(sizeof(bluetooth_mesh_key_configure_t));
+       g_strlcpy(node_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH + 1);
+       node_config->primary_unicast = req->primary_unicast;
+       node_config->is_netkey = req->is_netkey;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_NODE_KEY_CONFIGURED;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = node_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_model_configure_appkey(bluetooth_mesh_model_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_model_configure_t *model_config = NULL;
+
+       model_config = g_malloc0(sizeof(bluetooth_mesh_model_configure_t));
+       g_strlcpy(model_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       model_config->primary_unicast = req->primary_unicast;
+       model_config->elem_index = req->elem_index;
+       model_config->model = req->model;
+       model_config->appkey_idx = req->appkey_idx;
+       model_config->is_bind = req->is_bind;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_MODEL_APPKEY_BIND;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = model_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_model_get_all_appkeys(bluetooth_mesh_model_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_model_configure_t *model_config = NULL;
+
+       model_config = g_malloc0(sizeof(bluetooth_mesh_model_configure_t));
+       g_strlcpy(model_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       model_config->primary_unicast = req->primary_unicast;
+       model_config->elem_index = req->elem_index;
+       model_config->model = req->model;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_MODEL_APPKEY_LIST;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = model_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_model_configure_group_sub(bluetooth_mesh_model_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_model_configure_t *model_config = NULL;
+
+       model_config = g_malloc0(sizeof(bluetooth_mesh_model_configure_t));
+       g_strlcpy(model_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       model_config->primary_unicast = req->primary_unicast;
+       model_config->elem_index = req->elem_index;
+       model_config->model = req->model;
+       model_config->op = req->op;
+       model_config->sub_addr = req->sub_addr;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_CONFGURED;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = model_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_model_configure_virtual_group_sub(bluetooth_mesh_model_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_model_configure_t *model_config = NULL;
+
+       model_config = g_malloc0(sizeof(bluetooth_mesh_model_configure_t));
+       g_strlcpy(model_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       model_config->primary_unicast = req->primary_unicast;
+       model_config->elem_index = req->elem_index;
+       model_config->model = req->model;
+       model_config->op = req->op;
+       model_config->sub_addr = req->sub_addr;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_MODEL_VIRTUAL_SUBSCRIPTION_CONFGURED;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = model_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_model_get_subscriptopn_list(bluetooth_mesh_model_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_model_configure_t *model_config = NULL;
+
+       model_config = g_malloc0(sizeof(bluetooth_mesh_model_configure_t));
+       g_strlcpy(model_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       model_config->primary_unicast = req->primary_unicast;
+       model_config->elem_index = req->elem_index;
+       model_config->model = req->model;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_MODEL_SUBSCRIPTION_LIST;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = model_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_model_set_publication(bluetooth_mesh_model_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_model_configure_t *model_config = NULL;
+
+       model_config = g_malloc0(sizeof(bluetooth_mesh_model_configure_t));
+       g_strlcpy(model_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       model_config->primary_unicast = req->primary_unicast;
+       model_config->elem_index = req->elem_index;
+       model_config->model = req->model;
+       model_config->appkey_idx = req->appkey_idx;
+       model_config->pub_addr = req->pub_addr;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = model_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
+
+API int bluetooth_mesh_model_get_publication(bluetooth_mesh_model_configure_t *req)
+{
+       bluetooth_event_param_t *bt_event = NULL;
+       bluetooth_mesh_model_configure_t *model_config = NULL;
+
+       model_config = g_malloc0(sizeof(bluetooth_mesh_model_configure_t));
+       g_strlcpy(model_config->net_uuid, req->net_uuid, BLUETOOTH_MESH_NETWORK_UUID_STRING_LENGTH +1);
+       model_config->primary_unicast = req->primary_unicast;
+       model_config->elem_index = req->elem_index;
+       model_config->model = req->model;
+       model_config->appkey_idx = req->appkey_idx;
+       model_config->pub_addr = req->pub_addr;
+
+       bt_event = g_malloc0(sizeof(bluetooth_event_param_t));
+       bt_event->event = BLUETOOTH_EVENT_MESH_MODEL_PUBLICATION_STATUS;
+       bt_event->result = BLUETOOTH_ERROR_NONE;
+       bt_event->param_data = model_config;
+
+       g_timeout_add(500, __mesh_event_cb, bt_event);
+       return BLUETOOTH_ERROR_NONE;
+}
index 02765fb..f8f287b 100644 (file)
@@ -546,6 +546,25 @@ extern int utc_bluetooth_bt_mesh_network_provision_device_p(void);
 extern int utc_bluetooth_bt_mesh_authentication_set_request_cb_p(void);
 extern int utc_bluetooth_bt_mesh_authentication_reply_p(void);
 extern int utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_p(void);
+extern int utc_bluetooth_bt_mesh_network_discover_node_p(void);
+extern int utc_bluetooth_bt_mesh_node_get_features_p(void);
+extern int utc_bluetooth_bt_mesh_node_foreach_netkeys_p(void);
+extern int utc_bluetooth_bt_mesh_node_foreach_appkeys_p(void);
+extern int utc_bluetooth_bt_mesh_node_get_ttl_p(void);
+extern int utc_bluetooth_bt_mesh_node_set_ttl_p(void);
+extern int utc_bluetooth_bt_mesh_node_configure_netkey_p(void);
+extern int utc_bluetooth_bt_mesh_node_configure_appkey_p(void);
+extern int utc_bluetooth_bt_mesh_model_bind_appkey_p(void);
+extern int utc_bluetooth_bt_mesh_model_unbind_appkey_p(void);
+extern int utc_bluetooth_bt_mesh_model_get_appkey_list_p(void);
+extern int utc_bluetooth_bt_mesh_model_configure_group_subscription_p(void);
+extern int utc_bluetooth_bt_mesh_model_configure_virtual_group_subscription_p(void);
+extern int utc_bluetooth_bt_mesh_model_get_subscription_list_p(void);
+extern int utc_bluetooth_bt_mesh_model_set_publication_p(void);
+extern int utc_bluetooth_bt_mesh_model_get_publication_p(void);
+extern int utc_bluetooth_bt_mesh_appkey_get_netkey_p(void);
+
+
 extern void utc_bluetooth_mesh_network_negative_startup(void);
 extern void utc_bluetooth_mesh_network_negative_cleanup(void);
 extern int utc_bluetooth_bt_mesh_deinitialize_n(void);
@@ -586,6 +605,23 @@ extern int utc_bluetooth_bt_mesh_network_provision_device_n(void);
 extern int utc_bluetooth_bt_mesh_authentication_set_request_cb_n(void);
 extern int utc_bluetooth_bt_mesh_authentication_reply_n(void);
 extern int utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n(void);
+extern int utc_bluetooth_bt_mesh_network_discover_node_n(void);
+extern int utc_bluetooth_bt_mesh_node_get_features_n(void);
+extern int utc_bluetooth_bt_mesh_node_foreach_netkeys_n(void);
+extern int utc_bluetooth_bt_mesh_node_foreach_appkeys_n(void);
+extern int utc_bluetooth_bt_mesh_node_get_ttl_n(void);
+extern int utc_bluetooth_bt_mesh_node_set_ttl_n(void);
+extern int utc_bluetooth_bt_mesh_node_configure_netkey_n(void);
+extern int utc_bluetooth_bt_mesh_node_configure_appkey_n(void);
+extern int utc_bluetooth_bt_mesh_model_bind_appkey_n(void);
+extern int utc_bluetooth_bt_mesh_model_unbind_appkey_n(void);
+extern int utc_bluetooth_bt_mesh_model_get_appkey_list_n(void);
+extern int utc_bluetooth_bt_mesh_model_configure_group_subscription_n(void);
+extern int utc_bluetooth_bt_mesh_model_configure_virtual_group_subscription_n(void);
+extern int utc_bluetooth_bt_mesh_model_get_subscription_list_n(void);
+extern int utc_bluetooth_bt_mesh_model_set_publication_n(void);
+extern int utc_bluetooth_bt_mesh_model_get_publication_n(void);
+extern int utc_bluetooth_bt_mesh_appkey_get_netkey_n(void);
 
 
 testcase tc_array[] = {
@@ -1061,6 +1097,23 @@ testcase tc_array[] = {
        {"utc_bluetooth_bt_mesh_authentication_set_request_cb_p",utc_bluetooth_bt_mesh_authentication_set_request_cb_p,utc_bluetooth_mesh_network_positive_startup, utc_bluetooth_mesh_network_positive_cleanup},
        {"utc_bluetooth_bt_mesh_authentication_reply_p",utc_bluetooth_bt_mesh_authentication_reply_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
        {"utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_p",utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_network_discover_node_p",utc_bluetooth_bt_mesh_network_discover_node_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_node_get_features_p",utc_bluetooth_bt_mesh_node_get_features_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_node_foreach_netkeys_p",utc_bluetooth_bt_mesh_node_foreach_netkeys_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_node_foreach_appkeys_p",utc_bluetooth_bt_mesh_node_foreach_appkeys_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_node_get_ttl_p",utc_bluetooth_bt_mesh_node_get_ttl_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_node_set_ttl_p",utc_bluetooth_bt_mesh_node_set_ttl_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_node_configure_netkey_p",utc_bluetooth_bt_mesh_node_configure_netkey_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_node_configure_appkey_p",utc_bluetooth_bt_mesh_node_configure_appkey_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_bind_appkey_p",utc_bluetooth_bt_mesh_model_bind_appkey_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_unbind_appkey_p",utc_bluetooth_bt_mesh_model_unbind_appkey_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_get_appkey_list_p",utc_bluetooth_bt_mesh_model_get_appkey_list_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_configure_group_subscription_p",utc_bluetooth_bt_mesh_model_configure_group_subscription_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_configure_virtual_group_subscription_p",utc_bluetooth_bt_mesh_model_configure_virtual_group_subscription_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_get_subscription_list_p",utc_bluetooth_bt_mesh_model_get_subscription_list_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_set_publication_p",utc_bluetooth_bt_mesh_model_set_publication_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_model_get_publication_p",utc_bluetooth_bt_mesh_model_get_publication_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
+       {"utc_bluetooth_bt_mesh_appkey_get_netkey_p",utc_bluetooth_bt_mesh_appkey_get_netkey_p,utc_bluetooth_mesh_network_positive_startup,utc_bluetooth_mesh_network_positive_cleanup},
        {"utc_bluetooth_bt_mesh_deinitialize_n",utc_bluetooth_bt_mesh_deinitialize_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
        {"utc_bluetooth_bt_mesh_create_node_n",utc_bluetooth_bt_mesh_create_node_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
        {"utc_bluetooth_bt_mesh_node_destroy_n",utc_bluetooth_bt_mesh_node_destroy_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
@@ -1099,6 +1152,22 @@ testcase tc_array[] = {
        {"utc_bluetooth_bt_mesh_authentication_set_request_cb_n",utc_bluetooth_bt_mesh_authentication_set_request_cb_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
        {"utc_bluetooth_bt_mesh_authentication_reply_n",utc_bluetooth_bt_mesh_authentication_reply_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
        {"utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n",utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_network_discover_node_n",utc_bluetooth_bt_mesh_network_discover_node_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_node_get_features_n",utc_bluetooth_bt_mesh_node_get_features_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_node_foreach_netkeys_n",utc_bluetooth_bt_mesh_node_foreach_netkeys_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_node_foreach_appkeys_n",utc_bluetooth_bt_mesh_node_foreach_appkeys_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_node_get_ttl_n",utc_bluetooth_bt_mesh_node_get_ttl_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_node_set_ttl_n",utc_bluetooth_bt_mesh_node_set_ttl_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_node_configure_netkey_n",utc_bluetooth_bt_mesh_node_configure_netkey_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_node_configure_appkey_n",utc_bluetooth_bt_mesh_node_configure_appkey_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_model_bind_appkey_n",utc_bluetooth_bt_mesh_model_bind_appkey_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_model_unbind_appkey_n",utc_bluetooth_bt_mesh_model_unbind_appkey_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_model_get_appkey_list_n",utc_bluetooth_bt_mesh_model_get_appkey_list_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_model_configure_group_subscription_n",utc_bluetooth_bt_mesh_model_configure_group_subscription_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_model_get_subscription_list_n",utc_bluetooth_bt_mesh_model_get_subscription_list_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_model_set_publication_n",utc_bluetooth_bt_mesh_model_set_publication_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_model_get_publication_n",utc_bluetooth_bt_mesh_model_get_publication_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
+       {"utc_bluetooth_bt_mesh_appkey_get_netkey_n",utc_bluetooth_bt_mesh_appkey_get_netkey_n,utc_bluetooth_mesh_network_negative_startup,utc_bluetooth_mesh_network_negative_cleanup},
        {NULL, NULL}
 };
 
index 161d08a..19e80fd 100644 (file)
@@ -32,6 +32,9 @@ static bool mesh_supported = false;
 static  bt_mesh_network_h network = NULL;
 static  char *token;
 static char *network_name = "test-mesh";
+static  bt_mesh_node_h node_h = NULL;
+static  bt_mesh_element_h elem_h = NULL;
+static  bt_mesh_model_h model_h = NULL;
 static  bt_mesh_netkey_h netkey_h = NULL;
 static  bt_mesh_appkey_h appkey_h = NULL;
 
@@ -170,16 +173,16 @@ int utc_bluetooth_bt_mesh_node_destroy_n(void)
 int utc_bluetooth_bt_mesh_node_create_element_n(void)
 {
        int ret = BT_ERROR_NONE;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create_element(node, &elem);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create_element(node, &elem);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -190,23 +193,23 @@ int utc_bluetooth_bt_mesh_node_get_network_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_network_h net_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_network_h net = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
+               ret = bt_mesh_node_create(&features, &node);
 
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               ret = bt_mesh_node_get_network(NULL, &net_h);
+               ret = bt_mesh_node_get_network(NULL, &net);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_node_get_network(node_h, &net_h);
+               ret = bt_mesh_node_get_network(node, &net);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -217,10 +220,10 @@ int utc_bluetooth_bt_mesh_element_create_model_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_element_h elem_h1 = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_element_h elem1 = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -228,17 +231,17 @@ int utc_bluetooth_bt_mesh_element_create_model_n(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h1);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
+               ret = bt_mesh_node_create_element(node, &elem1);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_CFG_SRV;
                mod_id.company_id = 0xFFFF;
 
-               ret = bt_mesh_element_create_model(elem_h1, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem1, &mod_id, &model);
                assert_eq(ret, BT_ERROR_OPERATION_FAILED);
        } else {
-               ret = bt_mesh_element_create_model(elem_h1, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem1, &mod_id, &model);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -249,9 +252,9 @@ int utc_bluetooth_bt_mesh_model_get_id_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -259,20 +262,19 @@ int utc_bluetooth_bt_mesh_model_get_id_n(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
 
                memset(&mod_id, 0x00, sizeof(bt_mesh_model_id_s));
-               model_h = NULL;
 
-               ret = bt_mesh_model_get_id(model_h, &mod_id);
+               ret = bt_mesh_model_get_id(NULL, &mod_id);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_model_get_id(model_h, &mod_id);
+               ret = bt_mesh_model_get_id(model, &mod_id);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -283,9 +285,9 @@ int utc_bluetooth_bt_mesh_model_destroy_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -293,20 +295,19 @@ int utc_bluetooth_bt_mesh_model_destroy_n(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
 
-               memset(&mod_id, 0x00, sizeof(bt_mesh_model_id_s));
-               model_h = NULL;
+               ret = bt_mesh_node_destroy(node);
 
-               ret = bt_mesh_model_destroy(model_h);
+               ret = bt_mesh_model_destroy(model);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_model_destroy(model_h);
+               ret = bt_mesh_model_destroy(model);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -317,23 +318,23 @@ int utc_bluetooth_bt_mesh_model_get_element_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               elem_h = NULL;
-               ret = bt_mesh_model_get_element(model_h, &elem_h);
+               elem = NULL;
+               ret = bt_mesh_model_get_element(model, &elem);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_model_get_element(model_h, &elem_h);
+               ret = bt_mesh_model_get_element(model, &elem);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -344,9 +345,9 @@ int utc_bluetooth_bt_mesh_element_destroy_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -354,19 +355,19 @@ int utc_bluetooth_bt_mesh_element_destroy_n(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
 
                ret = bt_mesh_deinitialize();
-               ret = bt_mesh_element_destroy(elem_h);
+               ret = bt_mesh_element_destroy(elem);
                assert_eq(ret, BT_ERROR_NOT_INITIALIZED);
        } else {
-               ret = bt_mesh_element_destroy(elem_h);
+               ret = bt_mesh_element_destroy(elem);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -377,22 +378,22 @@ int utc_bluetooth_bt_mesh_element_get_node_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               elem_h = NULL;
-               ret = bt_mesh_element_get_node(elem_h, &node_h);
+               elem = NULL;
+               ret = bt_mesh_element_get_node(elem, &node);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_element_get_node(elem_h, &node_h);
+               ret = bt_mesh_element_get_node(elem, &node);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -403,21 +404,21 @@ int utc_bluetooth_bt_mesh_node_foreach_element_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               ret = bt_mesh_node_foreach_element(node_h, NULL, NULL);
+               ret = bt_mesh_node_foreach_element(node, NULL, NULL);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_node_foreach_element(node_h, __bt_mesh_node_foreach_elem_cb, NULL);
+               ret = bt_mesh_node_foreach_element(node, __bt_mesh_node_foreach_elem_cb, NULL);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -428,9 +429,9 @@ int utc_bluetooth_bt_mesh_element_foreach_models_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h element_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h element = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -438,17 +439,17 @@ int utc_bluetooth_bt_mesh_element_foreach_models_n(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &element_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &element);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(element_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(element, &mod_id, &model);
 
-               ret = bt_mesh_element_foreach_models(element_h, NULL, NULL);
+               ret = bt_mesh_element_foreach_models(element, NULL, NULL);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_element_foreach_models(element_h, __bt_mesh_elem_foreach_model_cb, NULL);
+               ret = bt_mesh_element_foreach_models(element, __bt_mesh_elem_foreach_model_cb, NULL);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -459,21 +460,21 @@ int utc_bluetooth_bt_mesh_network_create_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, NULL);
+               ret = bt_mesh_network_create(node, (const char*)network_name, &network, NULL);
                assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
        } else {
-               ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, NULL);
+               ret = bt_mesh_network_create(node, (const char*)network_name, &network, NULL);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -484,9 +485,6 @@ int utc_bluetooth_bt_mesh_network_load_n(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -940,3 +938,326 @@ int utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_n(void)
 
        return 0;
 }
+
+int utc_bluetooth_bt_mesh_network_discover_node_n(void)
+{
+       int ret = BT_ERROR_NONE;
+       char* dev_uuid = "tempName";
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_network_add_netkey(network, &netkey_h);
+
+               ret = bt_mesh_network_discover_node(network, (const char*)dev_uuid, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_network_discover_node(network, (const char*)dev_uuid, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_node_get_features_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_get_features(node_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_node_get_features(node_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_node_foreach_netkeys_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_foreach_netkeys(node_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_node_foreach_netkeys(node_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_node_foreach_appkeys_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h);
+
+               ret = bt_mesh_node_foreach_appkeys(node_h, netkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_node_foreach_appkeys(node_h, netkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_node_get_ttl_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_get_ttl(node_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_node_get_ttl(node_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_node_set_ttl_n(void)
+{
+       int ret = BT_ERROR_NONE;
+       int ttl = 120;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_set_ttl(node_h, ttl, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_node_set_ttl(node_h, ttl, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_node_configure_netkey_n(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_node_key_configuration_e config = 0;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_configure_netkey(node_h, config, netkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_node_configure_netkey(node_h, config, netkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_node_configure_appkey_n(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_node_key_configuration_e config = 0;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_configure_appkey(node_h, config, appkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_node_configure_appkey(node_h, config, appkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_model_bind_appkey_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_bind_appkey(model_h, appkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_bind_appkey(model_h, appkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_model_unbind_appkey_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_unbind_appkey(model_h, appkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_unbind_appkey(model_h, appkey_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_model_get_appkey_list_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_get_appkey_list(model_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_get_appkey_list(model_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_configure_group_subscription_n(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_model_subscription_op_e op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
+       bt_mesh_group_h group_h = NULL;
+       uint16_t group_addr = 0xc001;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_mesh_network_create_group(network, group_addr, &group_h);
+
+               ret = bt_mesh_model_configure_group_subscription(op, model_h, group_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_configure_group_subscription(op, model_h, group_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_model_configure_virtual_group_subscription_n(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_model_subscription_op_e op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
+       bt_mesh_group_h group_h = NULL;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_mesh_network_create_virtual_group(network, &group_h);
+
+               ret = bt_mesh_model_configure_virtual_group_subscription(op, model_h, group_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_configure_virtual_group_subscription(op, model_h, group_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_get_subscription_list_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_get_subscription_list(model_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_get_subscription_list(model_h, NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_set_publication_n(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_model_pub_params_s param;
+       bt_mesh_group_h group_h = NULL;
+       uint16_t group_addr = 0xc001;
+
+       memset(&param, 0x00, sizeof(bt_mesh_model_pub_params_s));
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               param.ttl = 120;
+               param.num_steps =  10;
+               param.per_res = BT_MESH_PUBLICATION_STEP_RES_1_SECOND;
+               param.retrans_cnt = BT_MESH_MAX_PUBISH_RETRANSMIT_COUNT;
+               param.retrans_step = BT_MESH_MAX_PUBISH_RETRANSMIT_INTERVAL_STEPS;
+
+               ret = bt_mesh_network_create_group(network, group_addr, &group_h);
+
+               ret = bt_mesh_model_set_publication(model_h, appkey_h, group_h, &param,
+                               NULL, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_set_publication(model_h, appkey_h, group_h, &param,
+                               NULL, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_model_get_publication_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_get_publication(model_h, NULL,  NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_model_get_publication(model_h, NULL,  NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_appkey_get_netkey_n(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_appkey_get_netkey(appkey_h, NULL);
+               assert_eq(ret, BT_ERROR_INVALID_PARAMETER);
+       } else {
+               ret = bt_mesh_appkey_get_netkey(appkey_h, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
index 6908fdb..b4bdd73 100644 (file)
@@ -32,6 +32,9 @@ static bool mesh_supported = false;
 static bt_mesh_network_h network = NULL;
 static char *token;
 static char *network_name = "test-mesh";
+static bt_mesh_node_h node_h = NULL;
+static bt_mesh_element_h elem_h = NULL;
+static bt_mesh_model_h model_h = NULL;
 static bt_mesh_netkey_h netkey_h = NULL;
 static bt_mesh_appkey_h appkey_h = NULL;
 
@@ -92,6 +95,104 @@ static void __bt_mesh_authentication_request_cb(int result, bt_mesh_authenticati
                g_main_loop_quit(mainloop);
 }
 
+static void __bt_mesh_node_discover_status_cb(int result, bt_mesh_network_h network,
+               bt_mesh_node_h node_param, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static void __bt_mesh_node_features_cb(int result, bt_mesh_node_h node,
+               bt_mesh_node_features_s *features, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static bool __bt_mesh_node_foreach_netkeys_cb(int result, bt_mesh_node_h node, int total,
+               bt_mesh_netkey_h netkey, uint16_t netkey_index, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+
+       return true;
+}
+
+static bool __bt_mesh_node_foreach_appkeys_cb(int result, bt_mesh_node_h node, int total,
+                       bt_mesh_netkey_h netkey, bt_mesh_appkey_h appkey,
+                               uint16_t appkey_index, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+
+       return true;
+}
+
+static void __bt_mesh_node_ttl_cb(int result, bt_mesh_node_h node,
+               bt_mesh_node_ttl_operation_e ttl_op, uint8_t ttl, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static void __bt_mesh_node_configure_netkey_cb(int result, bt_mesh_node_key_configuration_e op,
+               bt_mesh_node_h node, bt_mesh_netkey_h netkey, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static void __bt_mesh_node_configure_appkey_cb(int result, bt_mesh_node_key_configuration_e op,
+               bt_mesh_node_h node, bt_mesh_netkey_h netkey, bt_mesh_appkey_h appkey, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static void __bt_mesh_model_bind_cb(int result, bt_mesh_model_h model,
+                       bt_mesh_appkey_h appkey, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static void __bt_mesh_model_unbind_cb(int result, bt_mesh_model_h model,
+                       bt_mesh_appkey_h appkey, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static void __bt_mesh_model_appkey_list_cb(int result, bt_mesh_model_h model,
+                int total,  const GSList *appkeylist, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static void __bt_mesh_model_subscription_op_cb(int result, bt_mesh_model_subscription_op_e op,
+               bt_mesh_model_h model, bt_mesh_group_h group, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
+static bool __bt_mesh_model_subscription_list_cb(int result, bt_mesh_model_h model,
+               int total, const GSList *sub_addr, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+
+       return true;
+}
+
+static void __bt_mesh_model_publication_status_cb(int result, bt_mesh_model_h model,
+                       bt_mesh_group_h group, bt_mesh_appkey_h appkey, void *user_data)
+{
+       if (mainloop)
+               g_main_loop_quit(mainloop);
+}
+
 static void wait_for_async()
 {
        mainloop = g_main_loop_new(NULL, FALSE);
@@ -215,20 +316,20 @@ int utc_bluetooth_bt_mesh_node_create_element_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
+               ret = bt_mesh_node_create(&features, &node);
 
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create_element(node, &elem);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create_element(node, &elem);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -239,23 +340,23 @@ int utc_bluetooth_bt_mesh_node_get_network_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_network_h net_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_network_h net = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
+               ret = bt_mesh_node_create(&features, &node);
 
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               ret = bt_mesh_node_get_network(node_h, &net_h);
+               ret = bt_mesh_node_get_network(node, &net);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_node_get_network(node_h, &net_h);
+               ret = bt_mesh_node_get_network(node, &net);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -266,9 +367,9 @@ int utc_bluetooth_bt_mesh_element_create_model_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -276,15 +377,15 @@ int utc_bluetooth_bt_mesh_element_create_model_p(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -295,9 +396,9 @@ int utc_bluetooth_bt_mesh_model_get_id_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -305,19 +406,19 @@ int utc_bluetooth_bt_mesh_model_get_id_p(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
 
                memset(&mod_id, 0x00, sizeof(bt_mesh_model_id_s));
 
-               ret = bt_mesh_model_get_id(model_h, &mod_id);
+               ret = bt_mesh_model_get_id(model, &mod_id);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_model_get_id(model_h, &mod_id);
+               ret = bt_mesh_model_get_id(model, &mod_id);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -328,9 +429,9 @@ int utc_bluetooth_bt_mesh_model_destroy_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -338,17 +439,17 @@ int utc_bluetooth_bt_mesh_model_destroy_p(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
 
-               ret = bt_mesh_model_destroy(model_h);
+               ret = bt_mesh_model_destroy(model);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_model_destroy(model_h);
+               ret = bt_mesh_model_destroy(model);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -359,9 +460,9 @@ int utc_bluetooth_bt_mesh_model_get_element_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -369,18 +470,18 @@ int utc_bluetooth_bt_mesh_model_get_element_p(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
 
-               elem_h = NULL;
-               ret = bt_mesh_model_get_element(model_h, &elem_h);
+               elem = NULL;
+               ret = bt_mesh_model_get_element(model, &elem);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_model_get_element(model_h, &elem_h);
+               ret = bt_mesh_model_get_element(model, &elem);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -391,9 +492,9 @@ int utc_bluetooth_bt_mesh_element_destroy_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -401,18 +502,18 @@ int utc_bluetooth_bt_mesh_element_destroy_p(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
 
                mod_id.model_id = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(elem, &mod_id, &model);
 
-               ret = bt_mesh_element_destroy(elem_h);
+               ret = bt_mesh_element_destroy(elem);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_element_destroy(elem_h);
+               ret = bt_mesh_element_destroy(elem);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -423,21 +524,21 @@ int utc_bluetooth_bt_mesh_element_get_node_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               ret = bt_mesh_element_get_node(elem_h, &node_h);
+               ret = bt_mesh_element_get_node(elem, &node);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_element_get_node(elem_h, &node_h);
+               ret = bt_mesh_element_get_node(elem, &node);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -448,21 +549,21 @@ int utc_bluetooth_bt_mesh_node_foreach_element_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h elem = NULL;
 
        if (mesh_supported) {
                assert_eq(startup_flag, BT_ERROR_NONE);
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &elem_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &elem);
 
-               ret = bt_mesh_node_foreach_element(node_h, __bt_mesh_node_foreach_elem_cb, NULL);
+               ret = bt_mesh_node_foreach_element(node, __bt_mesh_node_foreach_elem_cb, NULL);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_node_foreach_element(node_h, __bt_mesh_node_foreach_elem_cb, NULL);
+               ret = bt_mesh_node_foreach_element(node, __bt_mesh_node_foreach_elem_cb, NULL);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -473,9 +574,9 @@ int utc_bluetooth_bt_mesh_element_foreach_models_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h element_h = NULL;
-       bt_mesh_model_h model_h = NULL;
+       bt_mesh_node_h node = NULL;
+       bt_mesh_element_h element = NULL;
+       bt_mesh_model_h model = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -483,17 +584,17 @@ int utc_bluetooth_bt_mesh_element_foreach_models_p(void)
 
                features.features = BT_MESH_FEATURE_RELAY;
                features.features |= BT_MESH_FEATURE_LOWPOWER;
-               ret = bt_mesh_node_create(&features, &node_h);
-               ret = bt_mesh_node_create_element(node_h, &element_h);
+               ret = bt_mesh_node_create(&features, &node);
+               ret = bt_mesh_node_create_element(node, &element);
 
                mod_id.model_id  = BT_MESH_MODEL_ID_GEN_LEVEL_SRV;
                mod_id.company_id = 0xFFFF;
-               ret = bt_mesh_element_create_model(element_h, &mod_id, &model_h);
+               ret = bt_mesh_element_create_model(element, &mod_id, &model);
 
-               ret = bt_mesh_element_foreach_models(element_h, __bt_mesh_elem_foreach_model_cb, NULL);
+               ret = bt_mesh_element_foreach_models(element, __bt_mesh_elem_foreach_model_cb, NULL);
                assert_eq(ret, BT_ERROR_NONE);
        } else {
-               ret = bt_mesh_element_foreach_models(element_h, __bt_mesh_elem_foreach_model_cb, NULL);
+               ret = bt_mesh_element_foreach_models(element, __bt_mesh_elem_foreach_model_cb, NULL);
                assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
        }
 
@@ -504,9 +605,6 @@ int utc_bluetooth_bt_mesh_network_create_p(void)
 {
        int ret = BT_ERROR_NONE;
        bt_mesh_node_features_s features;
-       bt_mesh_node_h node_h = NULL;
-       bt_mesh_element_h elem_h = NULL;
-       bt_mesh_model_h model_h = NULL;
        bt_mesh_model_id_s mod_id;
 
        if (mesh_supported) {
@@ -1001,3 +1099,381 @@ int utc_bluetooth_bt_mesh_network_set_provisioning_capabilities_p(void)
        return 0;
 }
 
+int utc_bluetooth_bt_mesh_network_discover_node_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_netkey_h netkey_h = NULL;
+       char* dev_uuid = "tempName";
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_network_add_netkey(network, &netkey_h);
+
+               ret = bt_mesh_network_discover_node(network, (const char*)dev_uuid,
+                               __bt_mesh_node_discover_status_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_network_discover_node(network, (const char*)dev_uuid,
+                               __bt_mesh_node_discover_status_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_node_get_features_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_get_features(node_h, __bt_mesh_node_features_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_node_get_features(node_h, __bt_mesh_node_features_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_node_foreach_netkeys_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_foreach_netkeys(node_h, __bt_mesh_node_foreach_netkeys_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+       } else {
+               ret = bt_mesh_node_foreach_netkeys(node_h, __bt_mesh_node_foreach_netkeys_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_node_foreach_appkeys_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_foreach_appkeys(node_h, netkey_h,
+                                __bt_mesh_node_foreach_appkeys_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+       } else {
+               ret = bt_mesh_node_foreach_appkeys(node_h, netkey_h,
+                                __bt_mesh_node_foreach_appkeys_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_node_get_ttl_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_get_ttl(node_h, __bt_mesh_node_ttl_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_node_get_ttl(node_h, __bt_mesh_node_ttl_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_node_set_ttl_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       int ttl = 120;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_set_ttl(node_h, ttl, __bt_mesh_node_ttl_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_node_set_ttl(node_h, ttl, __bt_mesh_node_ttl_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_node_configure_netkey_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_node_key_configuration_e config = 0;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_configure_netkey(node_h, config, netkey_h,
+                                       __bt_mesh_node_configure_netkey_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_node_configure_netkey(node_h, config, netkey_h,
+                               __bt_mesh_node_configure_netkey_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_node_configure_appkey_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_node_key_configuration_e config = 0;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_node_configure_appkey(node_h, config, appkey_h,
+                               __bt_mesh_node_configure_appkey_cb, NULL);
+
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_node_configure_appkey(node_h, config, appkey_h,
+                               __bt_mesh_node_configure_appkey_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_bind_appkey_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_bind_appkey(model_h, appkey_h, __bt_mesh_model_bind_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_model_bind_appkey(model_h, appkey_h, __bt_mesh_model_bind_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_unbind_appkey_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_unbind_appkey(model_h, appkey_h, __bt_mesh_model_unbind_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_model_unbind_appkey(model_h, appkey_h, __bt_mesh_model_unbind_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_get_appkey_list_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_get_appkey_list(model_h, __bt_mesh_model_appkey_list_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_model_get_appkey_list(model_h, __bt_mesh_model_appkey_list_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_configure_group_subscription_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_model_subscription_op_e op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
+       bt_mesh_group_h group_h = NULL;
+       uint16_t group_addr = 0xc001;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_mesh_network_create_group(network, group_addr, &group_h);
+
+               ret = bt_mesh_model_configure_group_subscription(op, model_h, group_h,
+                                       __bt_mesh_model_subscription_op_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_model_configure_group_subscription(op, model_h, group_h,
+                                       __bt_mesh_model_subscription_op_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+int utc_bluetooth_bt_mesh_model_configure_virtual_group_subscription_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_model_subscription_op_e op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
+       bt_mesh_group_h group_h = NULL;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+               ret = bt_mesh_network_create_virtual_group(network, &group_h);
+
+               ret = bt_mesh_model_configure_virtual_group_subscription(op, model_h, group_h,
+                               __bt_mesh_model_subscription_op_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_model_configure_virtual_group_subscription(op, model_h, group_h,
+                               __bt_mesh_model_subscription_op_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_get_subscription_list_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_get_subscription_list(model_h,
+                               __bt_mesh_model_subscription_list_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_model_get_subscription_list(model_h,
+                               __bt_mesh_model_subscription_list_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_set_publication_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_model_pub_params_s param;
+       bt_mesh_group_h group_h = NULL;
+       uint16_t group_addr = 0xc001;
+       bt_mesh_node_key_configuration_e config = 0;
+
+       memset(&param, 0x00, sizeof(bt_mesh_model_pub_params_s));
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               param.ttl = 120;
+               param.num_steps =  10;
+               param.per_res = BT_MESH_PUBLICATION_STEP_RES_1_SECOND;
+               param.retrans_cnt = BT_MESH_MAX_PUBISH_RETRANSMIT_COUNT;
+               param.retrans_step = BT_MESH_MAX_PUBISH_RETRANSMIT_INTERVAL_STEPS;
+
+               ret = bt_mesh_network_create_group(network, group_addr, &group_h);
+
+               ret = bt_mesh_node_configure_appkey(node_h, config, appkey_h,
+                               __bt_mesh_node_configure_appkey_cb, NULL);
+               wait_for_async();
+
+               ret = bt_mesh_model_set_publication(model_h, appkey_h, group_h, &param,
+                               __bt_mesh_model_publication_status_cb, NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+
+               wait_for_async();
+       } else {
+               ret = bt_mesh_model_set_publication(model_h, appkey_h, group_h, &param,
+                               __bt_mesh_model_publication_status_cb, NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_model_get_publication_p(void)
+{
+       int ret = BT_ERROR_NONE;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_model_get_publication(model_h, __bt_mesh_model_publication_status_cb,  NULL);
+               assert_eq(ret, BT_ERROR_NONE);
+       } else {
+               ret = bt_mesh_model_get_publication(model_h, __bt_mesh_model_publication_status_cb,  NULL);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}
+
+
+int utc_bluetooth_bt_mesh_appkey_get_netkey_p(void)
+{
+       int ret = BT_ERROR_NONE;
+       bt_mesh_netkey_h netkey_local;
+
+       if (mesh_supported) {
+               assert_eq(startup_flag, BT_ERROR_NONE);
+
+               ret = bt_mesh_appkey_get_netkey(appkey_h, &netkey_local);
+               assert_eq(ret, BT_ERROR_NONE);
+       } else {
+               ret = bt_mesh_appkey_get_netkey(appkey_h, &netkey_local);
+               assert_eq(ret, BT_ERROR_NOT_SUPPORTED);
+       }
+
+       return 0;
+}