Mesh: Refactor Unit Test application 53/238853/3
authorAnupam Roy <anupam.r@samsung.com>
Sun, 19 Jul 2020 16:19:33 +0000 (21:49 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Mon, 20 Jul 2020 05:32:05 +0000 (11:02 +0530)
This patch primarily handles following
- Accepts user inputs for most of the variables
- Code refactoring
- Add few missing API's

TODO:
- Accept User input for network handle
- More code refactoring
- Cleanup

Change-Id: I888c1fceda67c1f6eece775376ef8e13b3dac5da
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
test/bt_mesh_unit_test.c
test/bt_mesh_unit_test.h

index a64c1f4..49e1442 100644 (file)
@@ -3,6 +3,7 @@
  *
  * @author: Anupam Roy <anupam.r@samsung.com>
  * @author: Himanshu <h.himanshu@samsung.com>
+ *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -39,28 +40,16 @@ static bool need_to_set_params = false;
 static int g_test_id = -1;
 static tc_params_t g_test_param = {0,};
 
-static bt_mesh_node_h local_node;
+static bt_mesh_node_h local_node = NULL;
 static bt_mesh_node_h node;
-static bt_mesh_model_h model;
-static bt_mesh_element_h element;
 static bt_mesh_network_h network;
-static bt_mesh_appkey_h appkey;
-static bt_mesh_netkey_h netkey;
-static bt_mesh_group_h group;
-static bt_mesh_group_h virtual_group;
+static char *device_uuid;
 
-static bt_mesh_authentication_type_e request_type;
-
-static char* token;
-static bt_mesh_network_h networks[3];
-static bt_mesh_node_h nodes[3];
-static bt_mesh_element_h elements[3];
-static bt_mesh_netkey_h netkeys[10];
+static bt_mesh_netkey_h netkey;
 
-static int current_network_index = 0;
-static int current_node_index = 0;
-static int current_element_index = 0;
-static int current_netkey_index = 0;
+static  bt_mesh_group_h group;
+static char *token;
+static bt_mesh_authentication_type_e request_type = BT_MESH_AUTH_ALPHANUMERIC_DISPLAY;
 
 GMainLoop *main_loop = NULL;
 
@@ -71,10 +60,20 @@ tc_table_t tc_configuration[] = {
                , BT_MESH_UNIT_TEST_FUNCTION_MESH_NETWORK_DISCOVER_NODE},
        {"bt_mesh_node_reset"
                , BT_MESH_UNIT_TEST_FUNCTION_NODE_RESET},
+       {"bt_mesh_node_get_features"
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_FEATURES},
+       {"bt_mesh_node_foreach_netkeys"
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_NETKEYS},
+       {"bt_mesh_node_foreach_appkeys"
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_APPKEYS},
        {"bt_mesh_node_get_ttl"
-               , BT_MESH_UNIT_TEST_FUNCTION_GET_TTL},
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_TTL},
        {"bt_mesh_node_set_ttl"
-               , BT_MESH_UNIT_TEST_FUNCTION_SET_TTL},
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_SET_TTL},
+       {"bt_mesh_node_configure_netkey"
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_NETKEY},
+       {"bt_mesh_node_configure_appkey"
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_APPKEY},
        {"bt_mesh_model_bind_appkey"
                , BT_MESH_UNIT_TEST_FUNCTION_MODEL_BIND_APPKEY},
        {"bt_mesh_model_unbind_appkey"
@@ -119,20 +118,14 @@ tc_table_t tc_network[] = {
                , BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_ELEMENT},
        {"bt_mesh_element_destroy"
                , BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_DESTROY},
-       {"bt_mesh_element_foreach_models"
-               , BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_FOREACH_MODELS},
        {"bt_mesh_element_get_node"
                , BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_GET_NODE},
+       {"bt_mesh_node_foreach_element"
+               , BT_MESH_UNIT_TEST_FUNCTION_NODE_FOREACH_ELEMENTS},
+       {"bt_mesh_element_foreach_models"
+               , BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_FOREACH_MODELS},
        {"bt_mesh_network_create"
                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE},
-       {"bt_mesh_network_unprovisioned_device_scan"
-                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_UNPROVISIONED_DEVICE_SCAN},
-        {"bt_mesh_network_provision_device"
-                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_PROVISION_DEVICE},
-        {"bt_mesh_authentication_reply"
-                , BT_MESH_UNIT_TEST_FUNCTION_MESH_AUTHENTICATION_REPLY},
-        {"bt_mesh_network_set_provisioning_capabilities"
-                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_PROVISIONING_CAPABILITIES},
        {"bt_mesh_network_load"
                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_LOAD},
        {"bt_mesh_network_set_name"
@@ -159,20 +152,28 @@ tc_table_t tc_network[] = {
                , BT_MESH_UNIT_TEST_FUNCTION_APPKEY_UPDATE},
        {"bt_mesh_appkey_delete"
                , BT_MESH_UNIT_TEST_FUNCTION_APPKEY_DELETE},
-       {"bt_mesh_network_foreach_nodes"
-               , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_NODES},
+       {"bt_mesh_network_foreach_devices"
+               , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_DEVICES},
        {"bt_mesh_network_create_group"
                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE_GROUP},
        {"bt_mesh_network_create_virtual_group"
                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE_VIRTUAL_GROUP},
        {"bt_mesh_network_remove_group"
-               , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_REMOVE_GROUP},
+               ,  BT_MESH_UNIT_TEST_FUNCTION_NETWORK_REMOVE_GROUP},
        {"bt_mesh_network_foreach_groups"
                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_GROUPS},
+       {"bt_mesh_network_unprovisioned_device_scan"
+               , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_UNPROVISIONED_DEVICE_SCAN},
        {"bt_mesh_stop_unprovisioned_device_scan"
                , BT_MESH_UNIT_TEST_FUNCTION_STOP_UNPROVISIONED_DEVICE_SCAN},
+       {"bt_mesh_network_provision_device"
+               , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_PROVISION_DEVICE},
        {"bt_mesh_authentication_set_request_cb"
                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_AUTHENTICATION_SET_REQUEST_CB},
+       {"bt_mesh_authentication_reply"
+               , BT_MESH_UNIT_TEST_FUNCTION_MESH_AUTHENTICATION_REPLY},
+       {"bt_mesh_network_set_provisioning_capabilities"
+               , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_PROVISIONING_CAPABILITIES},
        {"bt_mesh_network_get_provisioning_capabilities"
                , BT_MESH_UNIT_TEST_FUNCTION_NETWORK_GET_PROVISIONING_CAPABILITIES},
        {"select this menu to set parameters and then select the function again"
@@ -277,14 +278,14 @@ void print_network_handle(bt_mesh_network_h network)
 {
        if(network == NULL)
                return;
-       bt_mesh_network_s* net = (bt_mesh_network_s*) network;
-       TC_PRT("network_handle=[%p]", (void*)net);
-       TC_PRT("Is Network local      [%d]", net->is_local);
-       TC_PRT("Is Network discovered [%d]", net->is_discovered);
-       TC_PRT("Network UUID          [%s]", net->uuid);
-       TC_PRT("Network Token         [%s]", net->token);
-       TC_PRT("Network Name          [%s]", net->name);
-       TC_PRT("Network Nodes         [%d]", net->num_nodes);
+       bt_mesh_network_s* net  = (bt_mesh_network_s*) network;
+       TC_PRT("network_handle = [%p]", (void*)net);
+       TC_PRT("net->is_local      [%d]", net->is_local);
+       TC_PRT("net->is_discovered [%d]", net->is_discovered);
+       TC_PRT("net->uuid          [%s]", net->uuid);
+       TC_PRT("net->token         [%s]", net->token);
+       TC_PRT("net->name          [%s]", net->name);
+       TC_PRT("net->num_nodes     [%d]", net->num_nodes);
 }
 
 void print_node_handle(bt_mesh_node_h node)
@@ -292,16 +293,14 @@ void print_node_handle(bt_mesh_node_h node)
        if(node == NULL)
                return;
        bt_mesh_node_s* node_info = (bt_mesh_node_s*) node;
-       TC_PRT("node_handle=[%p]",(void*)node_info);
-       TC_PRT("Is Node Local           [%d]", node_info->is_local);
-       TC_PRT("Is Node attached        [%d]", node_info->is_attached);
-       TC_PRT("Node Parent Network name[%s]", node_info->parent->name);
-       TC_PRT("Node UUID          ");
-       for(int i=0; i<16; i++) {
-               printf("%02x", node_info->uuid[i]);
+       TC_PRT("node_handle = [%p]",(void*)node_info);
+       TC_PRT("node->is_local       [%d]", node_info->is_local);
+       TC_PRT("node->is_attached    [%d]", node_info->is_attached);
+       if (node_info->is_attached) {
+               TC_PRT("node->parent_network [%s]", node_info->parent->name);
+               TC_PRT("node->uuid [%s]", node_info->uuid);
+               TC_PRT("node->unicast        [%d]", node_info->unicast);
        }
-       TC_PRT("");
-       TC_PRT("Node Unicast            [%d]", node_info->unicast);
 
 }
 
@@ -310,9 +309,9 @@ void print_element_handle(bt_mesh_element_h element)
        if(element == NULL)
                return;
        bt_mesh_element_s* element_info = (bt_mesh_element_s*) element;
-       TC_PRT("element_handle=[%p]", (void*)element_info);
-       TC_PRT("Is Element Local    [%d]", element_info->is_local);
-       TC_PRT("Element index       [%d]", element_info->index);
+       TC_PRT("element_handle = [%p]", (void*)element_info);
+       TC_PRT("element->is_local    [%d]", element_info->is_local);
+       TC_PRT("element->index       [%d]", element_info->index);
 }
 
 void print_model_handle(bt_mesh_model_h model)
@@ -320,10 +319,10 @@ void print_model_handle(bt_mesh_model_h model)
        if(model == NULL)
                return;
        bt_mesh_model_s* model_info = (bt_mesh_model_s*) model;
-       TC_PRT("model_handle=[%p]", (void*)model_info);
-       TC_PRT("Is Model Local        [%d]", model_info->is_local);
-       TC_PRT("Model ID              [%d]", model_info->id);
-       TC_PRT("Model Pub Address     [%d]", model_info->pub_addr);
+       TC_PRT("model_handle = [%p]", (void*)model_info);
+       TC_PRT("model->is_local      [%d]", model_info->is_local);
+       TC_PRT("model->id            [0x%4.4x]", model_info->id);
+       TC_PRT("model->pub_addr      [0x%2.2x]", model_info->pub_addr);
 }
 
 void print_netkey_handle(bt_mesh_netkey_h netkey)
@@ -331,9 +330,9 @@ void print_netkey_handle(bt_mesh_netkey_h netkey)
        if(netkey == NULL)
                return;
        bt_mesh_netkey_s* netkey_info = (bt_mesh_netkey_s*) netkey;
-       TC_PRT("netkey_handle=[%p]", (void*)netkey_info);
-       TC_PRT("netkey->parent_network_name [%s]", netkey_info->parent->name);
-       TC_PRT("netkey->netkey_index        [%d]", netkey_info->netkey_index);
+       TC_PRT("netkey_handle = [%p]", (void*)netkey_info);
+       TC_PRT("Parent network_name [%s]", netkey_info->parent->name);
+       TC_PRT("Netkey_index        [%d]", netkey_info->netkey_index);
 }
 
 void print_appkey_handle(bt_mesh_appkey_h appkey)
@@ -341,9 +340,9 @@ void print_appkey_handle(bt_mesh_appkey_h appkey)
        if(appkey == NULL)
                return;
        bt_mesh_appkey_s* appkey_info = (bt_mesh_appkey_s*) appkey;
-       TC_PRT("appkey_handle=[%p]", (void*)appkey_info);
-       TC_PRT("appkey->parent->netkey_index [%d]", appkey_info->parent->netkey_index);
-       TC_PRT("appkey->appkey_index         [%d]", appkey_info->appkey_index);
+       TC_PRT("appkey_handle = [%p]", (void*)appkey_info);
+       TC_PRT("Parent netkey_index [%d]", appkey_info->parent->netkey_index);
+       TC_PRT("appkey_index         [%d]", appkey_info->appkey_index);
 }
 
 void print_group_handle(bt_mesh_group_h group)
@@ -351,7 +350,7 @@ void print_group_handle(bt_mesh_group_h group)
        if(group == NULL)
                return;
        bt_mesh_group_s* group_info = (bt_mesh_group_s*) group;
-       TC_PRT("group_handle=[%p]", (void*)group_info);
+       TC_PRT("group_handle = [%p]", (void*)group_info);
        TC_PRT("group->parent_network->name  [%s]", group_info->parent->name);
        TC_PRT("group->addr                  [%d]", group_info->addr);
        TC_PRT("group->label_uuid            [%s]", group_info->label_uuid);
@@ -359,39 +358,184 @@ void print_group_handle(bt_mesh_group_h group)
        TC_PRT("group->ref_count             [%d]", group_info->ref_count);
 }
 
+bool __bt_mesh_network_device_info_cb(int result, bt_mesh_network_h network, int total,
+               const char *dev_uuid, uint16_t primary_unicast, void *user_data)
+{
+       TC_PRT("bt_mesh_network_device_info_cb");
+       TC_PRT("Total number of Devices in network [%d]", total);
+
+       TC_PRT("result: %s", __bt_get_error_message(result));
+       TC_PRT("primary unicast address is [%d]",primary_unicast);
+       TC_PRT("Device UUID [%s]", dev_uuid);
+       return true;
+}
+
 bool __bt_mesh_network_group_info_cb(int result, bt_mesh_network_h network, int total,
                bt_mesh_group_h group, void *user_data)
 {
        bt_mesh_group_s* grp = (bt_mesh_group_s*) group;
        TC_PRT("bt_mesh_network_group_info_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
-               print_network_handle(network);
-               TC_PRT("grp->address [%d]",grp->addr);
-               return true;
+
+       if (result == BT_ERROR_NONE) {
+               print_group_handle(grp);
        }
-       return false;
+       return true;
 }
 
-void __bt_mesh_node_discover_status_cb(int result, bt_mesh_network_h network, bt_mesh_node_h node,
+void __bt_mesh_node_discover_status_cb(int result, bt_mesh_network_h network, bt_mesh_node_h node_param,
                void *user_data)
 {
        TC_PRT("bt_mesh_node_discover_status_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
-               print_network_handle(network);
+       //print_network_handle(network);
+       print_node_handle(node_param);
+       if (result == BT_ERROR_NONE)
+               node = node_param;
+}
+
+static bool __bt_mesh_elem_foreach_model_cb(int result, bt_mesh_element_h element, int total,
+               bt_mesh_model_h model, bt_mesh_model_id_s *model_id, void *user_data)
+{
+       TC_PRT("__bt_mesh_elem_foreach_model_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+
+       if (result == BT_ERROR_NONE) {
+               TC_PRT("Total number of Models in the element [%d]", total);
+               print_element_handle(element);
+               if (total) {
+                       print_model_handle(model);
+                       TC_PRT("Model Comp ID [0x%2.2x] Model ID [0x%2.2x]",
+                                       model_id->company_id, model_id->model_id);
+               }
+               return true;
+       } else
+               return false;
+}
+
+static bool __bt_mesh_node_foreach_elem_cb(int result, bt_mesh_node_h node, int total,
+       bt_mesh_element_h element, int elem_index, uint16_t element_addr, void *user_data)
+{
+       TC_PRT("__bt_mesh_node_foreach_elem_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+
+       if (result == BT_ERROR_NONE) {
+               TC_PRT("Total number of elements in the node [%d]", total);
                print_node_handle(node);
+               if (total) {
+                       print_element_handle(element);
+                       TC_PRT("Element address [0x%2.2x]", element_addr);
+                       TC_PRT("Element index  [%d]", elem_index);
+               }
+               return true;
+       } else
+               return false;
+}
+
+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)
+{
+       TC_PRT("__bt_mesh_node_configure_netkey_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+
+       if (result == BT_ERROR_NONE) {
+               print_node_handle(node);
+               if (op == BT_MESH_NODE_KEY_ADD)
+                       TC_PRT("NetKey Added!");
+               else if (op == BT_MESH_NODE_KEY_UPDATE)
+                       TC_PRT("NetKey Updated!");
+               else
+                       TC_PRT("NetKey Deleted!");
+               print_netkey_handle(netkey);
        }
 }
 
+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)
+{
+       TC_PRT("__bt_mesh_node_configure_netkey_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+
+       if (result == BT_ERROR_NONE) {
+               print_node_handle(node);
+               if (op == BT_MESH_NODE_KEY_ADD)
+                       TC_PRT("AppKey Added!");
+               else if (op == BT_MESH_NODE_KEY_UPDATE)
+                       TC_PRT("AppKey Updated!");
+               else
+                       TC_PRT("AppKey Deleted!");
+               print_appkey_handle(netkey);
+               print_appkey_handle(appkey);
+       }
+}
+
+static void __bt_mesh_node_features_cb(int result, bt_mesh_node_h node,
+                       bt_mesh_node_features_s *features, void *user_data)
+{
+       TC_PRT("__bt_mesh_node_features_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+
+       if (result == BT_ERROR_NONE) {
+               print_node_handle(node);
+               TC_PRT("CID [0x%2.2x]\n", features->cid);
+               TC_PRT("PID [0x%2.2x]\n", features->pid);
+               TC_PRT("VID [0x%2.2x]\n", features->vid);
+               TC_PRT("CRPL [0x%2.2x]\n", features->crpl);
+
+               if (features->features & BT_MESH_FEATURE_RELAY)
+                       TC_PRT("Features: RELAY Supported");
+               if (features->features & BT_MESH_FEATURE_PROXY)
+                       TC_PRT("Features: PROXY Supported");
+               if (features->features & BT_MESH_FEATURE_FRIEND)
+                       TC_PRT("Features: FRIEND Supported");
+               if (features->features & BT_MESH_FEATURE_LOWPOWER)
+                       TC_PRT("Features: LOW POWER Supported\n");
+       }
+}
+
+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)
+{
+       TC_PRT("__bt_mesh_node_foreach_netkeys_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+
+       if (result == BT_ERROR_NONE) {
+               TC_PRT("Total Netkeys in node [%d]", total);
+               print_node_handle(node);
+               print_netkey_handle(netkey);
+               return true;
+       }
+       return false;
+}
+
+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)
+{
+       TC_PRT("__bt_mesh_node_foreach_appkeys_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+
+       if (result == BT_ERROR_NONE) {
+               TC_PRT("Total Appkeys in node [%d]", total);
+               print_node_handle(node);
+               print_netkey_handle(netkey);
+               print_appkey_handle(appkey);
+               return true;
+       }
+       return false;
+}
+
 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)
 {
        TC_PRT("bt_mesh_node_ttl_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
+
+       if (result == BT_ERROR_NONE) {
                print_node_handle(node);
-               TC_PRT("ttl_op is [%d]", ttl_op);
+               TC_PRT("ttl_op is [%s]", ttl_op? "TTL Set" : "TTL Get");
                TC_PRT("ttl value is [%d]",ttl);
        }
 }
@@ -401,9 +545,9 @@ void __bt_mesh_model_bind_cb(int result, bt_mesh_model_h model, bt_mesh_appkey_h
 {
        TC_PRT("bt_mesh_model_bind_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
+       if (result == BT_ERROR_NONE) {
                print_model_handle(model);
-               print_appkey_handle(appkey);
+               print_appkey_handle(netkey);
        }
 }
 
@@ -412,22 +556,27 @@ void __bt_mesh_model_unbind_cb(int result, bt_mesh_model_h model, bt_mesh_appkey
 {
        TC_PRT("bt_mesh_model_unbind_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
+       if (result == BT_ERROR_NONE) {
                print_model_handle(model);
-               print_appkey_handle(appkey);
+               print_appkey_handle(netkey);
        }
 }
 
 void __bt_mesh_model_appkey_list_cb(int result, bt_mesh_model_h model, int total,  const GSList *appkeylist,
                void *user_data)
 {
-       const GSList* keylist = NULL;
        TC_PRT("bt_mesh_model_appkey_list_cb");
+       const GSList *l;
+
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
+       if (result == BT_ERROR_NONE) {
+               TC_PRT("Total number of AppKeys bound to the model [%d]", total);
                print_model_handle(model);
-               for(keylist = appkeylist; keylist!=NULL ;keylist = g_slist_next(keylist))
-                       print_appkey_handle((bt_mesh_appkey_h)keylist);
+
+               for (l = appkeylist; l != NULL; l = l->next) {
+                       bt_mesh_appkey_h appkey = (bt_mesh_appkey_h) l->data;
+                       print_appkey_handle(appkey);
+               }
        }
 }
 
@@ -436,36 +585,44 @@ void __bt_mesh_model_subscription_op_cb(int result, bt_mesh_model_subscription_o
 {
        TC_PRT("bt_mesh_model_subscription_op_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
+
+       if (result == BT_ERROR_NONE) {
+               switch(op) {
+               case 0:
+                       TC_PRT("Model Subscription Operation is ADD");
+                       break;
+               case 1:
+                       TC_PRT("Model Subscription Operation is DELETE");
+                       break;
+               case 2:
+                       TC_PRT("Model Subscription Operation is DELETE ALL");
+                       break;
+               case 3:
+                       TC_PRT("Model Subscription Operation is OVERWRITE");
+                       break;
+               default:
+                       TC_PRT("Invalid Model Subscription Operation");
+                       break;
+               }
                print_model_handle(model);
                print_group_handle(group);
-               if (op == BT_MESH_MODEL_SUBSCRIPTION_ADD) {
-                       TC_PRT("op is BT_MESH_MODEL_SUBSCRIPTION_ADD");
-               }
-               else if (op == BT_MESH_MODEL_SUBSCRIPTION_DELETE) {
-                       TC_PRT("op is BT_MESH_MODEL_SUBSCRIPTION_DELETE");
-               }
-               else if (op == BT_MESH_MODEL_SUBSCRIPTION_DELETE_ALL) {
-                       TC_PRT("op is BT_MESH_MODEL_SUBSCRIPTION_DELETE_ALL");
-               }
-               else if(op == BT_MESH_MODEL_SUBSCRIPTION_OVERWRITE) {
-                       TC_PRT("op is BT_MESH_MODEL_SUBSCRIPTION_OVERWRITE");
-               }
-               else {
-                       TC_PRT("Operation does not exist");
-               }
        }
 }
 
 bool __bt_mesh_model_subscription_list_cb(int result, bt_mesh_model_h model, int total, const GSList *sub_addr,
                void *user_data)
 {
-       const GSList* sublist = NULL;
+       const GSList *l;
        TC_PRT("bt_mesh_model_subscription_list_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       print_model_handle(model);
-       for(sublist = sub_addr; sublist != NULL; sublist = g_slist_next(sublist)) {
-               print_group_handle((bt_mesh_group_h)sublist);
+       if (result == BT_ERROR_NONE) {
+               TC_PRT("Total number of AppKeys bound to the model [%d]", total);
+               print_model_handle(model);
+
+               for (l = sub_addr; l != NULL; l = l->next) {
+                       bt_mesh_group_h group = (bt_mesh_group_h) l->data;
+                       print_group_handle(group);
+               }
        }
        return true;
 }
@@ -475,23 +632,31 @@ void __bt_mesh_model_publication_status_cb(int result, bt_mesh_model_h model, bt
 {
        TC_PRT("bt_mesh_model_publication_status_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
+
+       if (result == BT_ERROR_NONE) {
                print_model_handle(model);
+               print_group_handle(group);
                print_appkey_handle(appkey);
        }
 }
 
+void __bt_mesh_network_create_cb(int result, bt_mesh_network_h network, const char *network_name, void *user_data)
+{
+       TC_PRT("bt_mesh_network_create_cb");
+       TC_PRT("result: %s", __bt_get_error_message(result));
+       print_network_handle(network);
+}
+
 bool __bt_mesh_appkey_info_cb(int result, bt_mesh_network_h network, int total,
                bt_mesh_netkey_h netkey, bt_mesh_appkey_h appkey, uint16_t appkey_index, void *user_data)
 {
        TC_PRT("bt_mesh_network_appkey_info_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
-               print_appkey_handle(appkey);
-               TC_PRT("Total appkeys are [%d]",total);
-               return true;
-       }
-       return false;
+       //print_network_handle(network);
+       //print_netkey_handle(netkey);
+       print_appkey_handle(appkey);
+       TC_PRT("Total appkeys are [%d]",total);
+       return true;
 }
 
 bool  __bt_mesh_network_netkey_info_cb(int result, bt_mesh_network_h network, int total,
@@ -499,13 +664,19 @@ bool  __bt_mesh_network_netkey_info_cb(int result, bt_mesh_network_h network, in
 {
        TC_PRT("bt_mesh_network_netkey_info_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
-               print_network_handle(network);
-               print_netkey_handle(netkey);
-               TC_PRT("Total netkeys are [%d]",total);
-               return true;
+       //print_network_handle(network);
+       print_netkey_handle(netkey);
+       TC_PRT("Total netkeys are [%d]",total);
+       if (result == BT_ERROR_NONE && netkey_index == 0) {
+               TC_PRT("Attempt to delete Primary Subnet");
+               result = bt_mesh_netkey_delete(netkey);
+               TC_PRT("return %s\n", __bt_get_error_message(result));
+               if (result == BT_ERROR_NONE)
+                       TC_PRT("Primary netkey is deleted");
+               else
+                       TC_PRT("Primary NetKey deletion failed");
        }
-       return false;
+       return true;
 }
 
 void __bt_mesh_network_scan_unprovisioned_device_result_cb(int result, bt_mesh_network_h network,
@@ -513,23 +684,19 @@ void __bt_mesh_network_scan_unprovisioned_device_result_cb(int result, bt_mesh_n
 {
        TC_PRT("bt_mesh_network_scan_unprovisioned_device_result_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
-               if (state == BT_MESH_SCANNING_STARTED) {
-                       TC_PRT("The scanning state is: STARTED");
-                       print_network_handle(network);
-               }
-               else if (state == BT_MESH_SCANNING_FINISHED) {
-                       TC_PRT("The scanning state is: STOPPED");
-               }
-               else if(scan_res != NULL){
-                       TC_PRT("Scan Result found");
-                       TC_PRT("Device UUID is %s\n", scan_res->uuid);
-                       TC_PRT("RSSI values is %d\n", scan_res->rssi);
-                       TC_PRT("OOB Info 0x%x\n", scan_res->oob_info);
-               }
-               else {
-                       TC_PRT("scan_res is NULL");
-               }
+       if (state == BT_MESH_SCANNING_STARTED) {
+               TC_PRT("The scanning state is: STARTED");
+               print_network_handle(network);
+       }
+       else if (state == BT_MESH_SCANNING_FINISHED) {
+               TC_PRT("The scanning state is: STOPPED");
+               print_network_handle(network);
+       }
+       else {
+               TC_PRT("Scan Result found");
+               TC_PRT("Device UUID is %s\n", scan_res->uuid);
+               TC_PRT("RSSI values is %d\n", scan_res->rssi);
+               TC_PRT("OOB Info 0x%x\n", scan_res->oob_info);
        }
 }
 
@@ -538,12 +705,12 @@ void __bt_mesh_network_device_provision_cb(int result, bt_mesh_network_h network
 {
        TC_PRT("bt_mesh_network_device_provision_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if(result == BT_ERROR_NONE) {
-               print_network_handle(network);
-               if(dev_uuid == NULL)
-                       TC_PRT("dev_uuid is NULL");
-               else
-                       TC_PRT("The device_uuid is [%s]", dev_uuid);
+       print_network_handle(network);
+       if(dev_uuid == NULL)
+               TC_PRT("dev_uuid is NULL");
+       else {
+               TC_PRT("The device_uuid is [%s]", dev_uuid);
+               device_uuid = g_strdup(dev_uuid);
        }
 }
 
@@ -552,10 +719,9 @@ void __bt_mesh_authentication_request_cb(int result, bt_mesh_authentication_type
 {
        TC_PRT("bt_mesh_authentication_request_cb");
        TC_PRT("result: %s", __bt_get_error_message(result));
-       if (result == BT_ERROR_NONE) {
-               TC_PRT("auth_value is [%s]", auth_value);
-               TC_PRT("auth_type is [%d]", auth_type);
-       }
+       TC_PRT("auth_value is [%s]", auth_value);
+       TC_PRT("auth_type is [%d]", auth_type);
+       request_type = auth_type;
 }
 
 int test_set_params(int test_id, char *param){
@@ -568,30 +734,82 @@ int test_set_params(int test_id, char *param){
        case BT_MESH_UNIT_TEST_TABLE_NETWORK: {
                switch(test_id) {
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE:
-                       param_count=1;
-                       TC_PRT("Input param(%d) (network_name)",param_index + 1);
+                       param_count = 2;
+                       switch(param_index) {
+                       case 0:
+                               TC_PRT("Input param(%d) (network_name)\n",param_index + 1);
+                               break;
+                       case 1:
+                               TC_PRT("Input param(%d) (Node Handle)\n",param_index + 1);
+                               break;
+                       }
                        break;
-               case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_CREATE_MODEL:
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_DESTROY:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (node Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_NETWORK:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (node Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_CREATE_ELEMENT:
                        param_count = 1;
+                       TC_PRT("Input param(%d) (node Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_CREATE_MODEL:
+                       param_count = 2;
                        switch(param_index) {
                        case 0:
-                               TC_PRT("Input param(%d) (model_id)" ,param_index + 1);
+                               TC_PRT("Input param(%d) (Element Handle)\n" ,param_index + 1);
                                break;
-                       default:
+                       case 1:
+                               TC_PRT("Input param(%d) (Model ID)\n",param_index + 1);
                                break;
                        }
                        break;
-               case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_PROVISION_DEVICE:
+               case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_GET_NODE:
+                       param_count=1;
+                       TC_PRT("Input param(%d) (Element Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_ID:
+                       param_count=1;
+                       TC_PRT("Input param(%d) (Model Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_DESTROY:
+                       param_count=1;
+                       TC_PRT("Input param(%d) (Model Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_ELEMENT:
+                       param_count=1;
+                       TC_PRT("Input param(%d) (Model Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_DESTROY:
+                       param_count=1;
+                       TC_PRT("Input param(%d) (Element Handle)\n",param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_FOREACH_ELEMENTS:
                        param_count = 1;
-                       TC_PRT("Input param(%d) (device_uuid)",param_index+1);
+                       TC_PRT("Input param(%d) (Node Handle)", param_index + 1);
                        break;
-               case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_NAME:
+               case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_FOREACH_MODELS:
                        param_count = 1;
-                       TC_PRT("Input param(%d) (network_name)",param_index + 1);
+                       TC_PRT("Input param(%d) (Element Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE_GROUP:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (group address)\n" ,param_index + 1);
                        break;
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_UNPROVISIONED_DEVICE_SCAN:
                        param_count = 1;
-                       TC_PRT("Input param(%d) (scan_seconds)",param_index +1 );
+                       TC_PRT("Input param(%d) (Seconds)\n" ,param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_PROVISION_DEVICE:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (device_uuid)\n",param_index+1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_NAME:
+                       param_count=1;
+                       TC_PRT("Input param(%d) (network_name)",param_index + 1);
                        break;
                case BT_MESH_UNIT_TEST_FUNCTION_MESH_AUTHENTICATION_REPLY:
                        param_count=2;
@@ -633,6 +851,38 @@ int test_set_params(int test_id, char *param){
                                break;
                        }
                        break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_GET_INDEX:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (NetKey Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_UPDATE:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (NetKey Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_DELETE:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (NetKey Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_ADD_APPKEY:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (NetKey Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_FOREACH_APPKEYS:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (NetKey Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_GET_INDEX:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (AppKey Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_UPDATE:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (AppKey Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_DELETE:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (AppKey Handle)", param_index + 1);
+                       break;
                case BT_MESH_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS:
                        need_to_set_params = true;
                        TC_PRT("\nSelect the function again\n");
@@ -643,6 +893,131 @@ int test_set_params(int test_id, char *param){
                }
                break;
        }
+       case BT_MESH_UNIT_TEST_TABLE_CONFIGURATION: {
+               switch(test_id) {
+               case BT_MESH_UNIT_TEST_FUNCTION_MESH_NETWORK_DISCOVER_NODE:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (device_uuid)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_FEATURES:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (Node Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_NETKEYS:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (Node Handle)", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_APPKEYS:
+                       param_count = 2;
+                       switch(param_index) {
+                       case 0:
+                               TC_PRT("Input param(%d) (Node Handle)", param_index + 1);
+                               break;
+                       case 1:
+                               TC_PRT("Input param(%d) (Netkey Handle)\n", param_index + 1);
+                               break;
+                       }
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_GET_NETKEY:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (AppKey Handle)\n", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_PUBLICATION:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (Model Handle)\n", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_SET_PUBLICATION:
+                       param_count = 3;
+                       switch(param_index) {
+                       case 0:
+                               TC_PRT("\nInput param(%d) Model handle\n", param_index + 1);
+                               break;
+                       case 1:
+                               TC_PRT("\nInput param(%d) AppKey handle\n", param_index + 1);
+                               break;
+                       case 2:
+                               TC_PRT("\nInput param(%d) Group Handle\n", param_index + 1);
+                               break;
+                       }
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_SUBSCRIPTION_LIST:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (Model Handle)\n", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_CONFIGURE_GROUP_SUBSCRIPTION:
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_CONFIGURE_VIRTUAL_GROUP_SUBSCRIPTION:
+                       param_count = 3;
+                       switch(param_index) {
+                       case 0:
+                               TC_PRT("\nInput param(%d) Model handle\n", param_index + 1);
+                               break;
+                       case 1:
+                               TC_PRT("\nInput param(%d) Model operation", param_index + 1);
+                               TC_PRT("BT_MESH_MODEL_SUBSCRIPTION_ADD = 0");
+                               TC_PRT("BT_MESH_MODEL_SUBSCRIPTION_DELETE = 1");
+                               TC_PRT("BT_MESH_MODEL_SUBSCRIPTION_DELETE_ALL = 2");
+                               TC_PRT("BT_MESH_MODEL_SUBSCRIPTION_OVERWRITE = 3\n");
+                               break;
+                       case 2:
+                               TC_PRT("\nInput param(%d) Group Handle\n", param_index + 1);
+                               break;
+                       }
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_APPKEY_LIST:
+                       param_count = 1;
+                       TC_PRT("Input param(%d) (Model Handle)\n", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_BIND_APPKEY:
+               case BT_MESH_UNIT_TEST_FUNCTION_MODEL_UNBIND_APPKEY:
+                       param_count = 2;
+                       switch(param_index) {
+                       case 0:
+                               TC_PRT("\nInput param(%d) Model Handle\n", param_index + 1);
+                               break;
+                       case 1:
+                               TC_PRT("\nInput param(%d) AppKey handle\n", param_index + 1);
+                               break;
+                       }
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_NETKEY:
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_APPKEY:
+                       param_count = 3;
+                       switch(param_index) {
+                       case 0:
+                               TC_PRT("\nInput param(%d) Node Handle\n", param_index + 1);
+                               break;
+                       case 1:
+                               TC_PRT("\nInput param(%d) Key Handle\n", param_index + 1);
+                               break;
+                       case 2:
+                               TC_PRT("\nInput param(%d) Key Config Option", param_index + 1);
+                               TC_PRT("BT_MESH_NODE_KEY_ADD = 0");
+                               TC_PRT("BT_MESH_NODE_KEY_UPDATE = 1");
+                               TC_PRT("BT_MESH_NODE_KEY_DELETE = 2\n");
+                               break;
+                       }
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_TTL:
+                       param_count=1;
+                       TC_PRT("\nInput param(%d) Node Handle\n", param_index + 1);
+                       break;
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_SET_TTL:
+                       param_count = 2;
+                       switch(param_index) {
+                       case 0:
+                               TC_PRT("\nInput param(%d) Node Handle\n", param_index + 1);
+                               break;
+                       case 1:
+                               TC_PRT("\nInput param(%d) TTL value\n", param_index + 1);
+                               break;
+                       }
+                       break;
+               default:
+                       TC_PRT("There is no parameter to set\n");
+                       break;
+               }
+               break;
+       }
        default:
                TC_PRT("There is no parameter to set\n");
                need_to_set_params = false;
@@ -680,7 +1055,7 @@ int test_set_params(int test_id, char *param){
 
 int test_input_callback(void *data)
 {
-       int ret = 0;
+               int ret = 0;
 #ifdef ARCH64
        int test_id = (uintptr_t)data;
 #else
@@ -716,209 +1091,366 @@ int test_input_callback(void *data)
 
                        ret = bt_mesh_node_create(&features, &local_node);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE)
+                               print_node_handle(local_node);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NODE_DESTROY: {
-                       ret = bt_mesh_node_destroy(local_node);
+                       bt_mesh_node_h node_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameters first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_node_destroy(node_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_NETWORK: {
-                       if(current_network_index == 3) {
-                               TC_PRT("network instances are full\n");
-                               current_network_index = current_network_index%3;
-                               TC_PRT("Removing the network instance at index: [%d]", current_network_index);
+                       bt_mesh_network_h net_h;
+                       bt_mesh_node_h node_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameters first!");
+                               break;
                        }
-                       ret = bt_mesh_node_get_network(local_node, &networks[current_network_index]);
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret  = bt_mesh_node_get_network(node_h, &net_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE) {
-                               TC_PRT("current network instance stored at index: [%d]", current_network_index);
-                               current_network_index++;
-                       }
+                       if (ret == BT_ERROR_NONE)
+                               print_network_handle(net_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NODE_CREATE_ELEMENT: {
-                       ret = bt_mesh_node_create_element(local_node, &element);
+                       bt_mesh_element_h elem_h;
+                       bt_mesh_node_h node_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameters first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_node_create_element(node_h, &elem_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE)
+                               print_element_handle(elem_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_CREATE_MODEL: {
+                       bt_mesh_element_h elem_h;
+                       bt_mesh_model_h model_h;
                        bt_mesh_model_id_s mod_id;
                        memset(&mod_id, 0x00, sizeof(bt_mesh_model_id_s));
-                       if(g_test_param.param_count > 0) {
-                               mod_id.model_id = (int)strtol(g_test_param.params[0], NULL, 16);
-                               __bt_free_test_param(&g_test_param);
+
+                       if (g_test_param.param_count != 2) {
+                               TC_PRT("Enter parameters first!");
+                               break;
                        }
+                       elem_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       mod_id.model_id = strtoul(g_test_param.params[1], NULL, 16);
                        mod_id.company_id = 0xFFFF;
-                       TC_PRT("The model_id is [%d]\n", mod_id.model_id);
-                       ret = bt_mesh_element_create_model(element,&mod_id, &model);
+                       TC_PRT("The model_id is [0x%2.2x]\n", mod_id.model_id);
+                       ret = bt_mesh_element_create_model(elem_h, &mod_id, &model_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE)
+                               print_model_handle(model_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_GET_NODE: {
-                       if(current_node_index == 3) {
-                               TC_PRT("node instances are full\n");
-                               current_node_index = current_node_index%3;
-                               TC_PRT("Removing the node instance at index: [%d]", current_node_index);
+                       bt_mesh_element_h elem_h;
+                       bt_mesh_node_h node_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!");
+                               break;
                        }
-                       ret = bt_mesh_element_get_node(element, &nodes[current_node_index]);
+                       elem_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_element_get_node(elem_h, &node_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE) {
-                               TC_PRT("current node instance stored at index: [%d]", current_node_index);
-                               current_node_index++;
-                       }
+
+                       if (ret == BT_ERROR_NONE)
+                               print_node_handle(node_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_ID: {
                        bt_mesh_model_id_s model_id;
                        memset(&model_id, 0x00, sizeof(bt_mesh_model_id_s));
-                       ret = bt_mesh_model_get_id(model, &model_id);
+                       bt_mesh_model_h mod_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!");
+                               break;
+                       }
+                       mod_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_model_get_id(mod_h, &model_id);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE)
-                               TC_PRT("The model_id is %d", model_id.model_id);
+                       if (ret == BT_ERROR_NONE) {
+                               TC_PRT("The Model ID is [0x%2.2x]", model_id.model_id);
+                               TC_PRT("The Company ID is [0x%2.2x]", model_id.company_id);
+                       }
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_DESTROY: {
-                       ret = bt_mesh_model_destroy(model);
+                       bt_mesh_model_h mod_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!");
+                               break;
+                       }
+                       mod_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_model_destroy(mod_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_ELEMENT: {
-                       if(current_element_index == 3) {
-                               TC_PRT("node instances are full\n");
-                               current_element_index = current_element_index%3;
-                               TC_PRT("Removing the node instance at index: [%d]", current_element_index);
+                       bt_mesh_model_h mod_h;
+                       bt_mesh_element_h elem_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!");
+                               break;
                        }
-                       ret = bt_mesh_model_get_element(model, &elements[current_element_index]);
+                       mod_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_model_get_element(mod_h, &elem_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE) {
-                               print_element_handle(elements[current_element_index]);
-                               TC_PRT("current network instance stored at index: [%d]", current_element_index);
-                               current_element_index++;
-                       }
+                       if (ret == BT_ERROR_NONE)
+                               print_element_handle(elem_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_DESTROY: {
-                       ret = bt_mesh_element_destroy(element);
+                       bt_mesh_element_h elem_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!");
+                               break;
+                       }
+                       elem_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_element_destroy(elem_h);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_FOREACH_ELEMENTS: {
+                       bt_mesh_node_h node_h = 0;
+                       if (g_test_param.param_count != 1){
+                               TC_PRT("Enter Input parameter first.\n");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret  = bt_mesh_node_foreach_element(node_h, __bt_mesh_node_foreach_elem_cb, NULL);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_FOREACH_MODELS: {
+                       bt_mesh_element_h element_h = 0;
+                       if (g_test_param.param_count != 1){
+                               TC_PRT("Enter Input parameter first.\n");
+                               break;
+                       }
+                       element_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret  = bt_mesh_element_foreach_models(element_h, __bt_mesh_elem_foreach_model_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE: {
                        char* network_name = "Mesh Test Network";
-                       if(g_test_param.param_count > 0) {
-                               network_name = g_strdup(g_test_param.params[0]);
-                               __bt_free_test_param(&g_test_param);
+                       bt_mesh_node_h node_h;
+                       if (g_test_param.param_count != 2) {
+                               TC_PRT("Enter Input parameter first.\n");
+                               break;
                        }
-                       ret = bt_mesh_network_create(local_node, (const char*)network_name, &network, &token);
+                       network_name = g_strdup(g_test_param.params[0]);
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[1], NULL, 16));
+                       ret = bt_mesh_network_create(node_h, (const char*)network_name, &network, &token);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE) {
+                               TC_PRT("Network Created, token [%s]", token);
+                               print_network_handle(network);
+                       }
+                       g_free(network_name);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_LOAD: {
-                       ret = bt_mesh_network_load(token, &network);
+                       char *token_str;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!");
+                               break;
+                       }
+                       token_str = g_strdup(g_test_param.params[0]);
+                       ret = bt_mesh_network_load(token_str, &network);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE)
+                       if (ret == BT_ERROR_NONE)
                                print_network_handle(network);
+                       g_free(token_str);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_NAME: {
-                       char* network_name="Mesh Test Network";
-                       if(g_test_param.param_count > 0) {
-                               network_name = g_strdup(g_test_param.params[0]);
-                               __bt_free_test_param(&g_test_param);
+                       char* network_name="tempName";
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!");
+                               break;
                        }
+                       network_name = g_strdup(g_test_param.params[0]);
                        ret = bt_mesh_network_set_name(network,(const char*)network_name);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       g_free(network_name);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_GET_NAME: {
                        char* network_name;
-                       ret = bt_mesh_network_get_name(network,&network_name);
+                       ret = bt_mesh_network_get_name(network, &network_name);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE)
-                               TC_PRT("network name is [%s]",network_name);
+                       if (ret == BT_ERROR_NONE)
+                               TC_PRT("network name is [%s]", network_name);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_ADD_NETKEY: {
-                       if(current_netkey_index == 10) {
-                               TC_PRT("netkey instances are full\n");
-                               current_netkey_index = current_netkey_index%10;
-                               TC_PRT("Removing the netkey instance at index: [%d]", current_netkey_index);
-                       }
-                       ret = bt_mesh_network_add_netkey(network,&netkeys[current_netkey_index]);
+                       /* netkey 1*/
+                       bt_mesh_netkey_h n_h;
+                       ret = bt_mesh_network_add_netkey(network, &n_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE) {
-                               TC_PRT("cuurent netkey instance stored at index [%d]", current_netkey_index);
-                               print_netkey_handle(netkeys[current_netkey_index]);
-                               current_netkey_index++;
-                       }
+                       if (ret == BT_ERROR_NONE)
+                                print_netkey_handle(n_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_NETKEYS: {
-                       ret = bt_mesh_network_foreach_netkeys(network, __bt_mesh_network_netkey_info_cb, NULL);
+                       ret = bt_mesh_network_foreach_netkeys(network,
+                                       __bt_mesh_network_netkey_info_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_GET_INDEX: {
-                       uint16_t index = 0;
-                       ret = bt_mesh_netkey_get_index(netkey, &index);
+                       uint16_t index = 0xFFFF;
+                       bt_mesh_netkey_h netkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       netkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       /* Get index for netkey 1 */
+                       ret = bt_mesh_netkey_get_index(netkey_h, &index);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE)
+                       if (ret == BT_ERROR_NONE)
                                TC_PRT("The index of the netkey is: [%d]", index);
+
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_UPDATE: {
-                       ret = bt_mesh_netkey_update(netkey);
+                       bt_mesh_netkey_h netkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       netkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_netkey_update(netkey_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_DELETE: {
-                       ret = bt_mesh_netkey_delete(netkey);
+                       bt_mesh_netkey_h netkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       netkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_netkey_delete(netkey_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE)
+                               TC_PRT("netkey is deleted");
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_ADD_APPKEY: {
-                       ret = bt_mesh_netkey_add_appkey(netkey, &appkey);
+                       bt_mesh_netkey_h netkey_h;
+                       bt_mesh_appkey_h appkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       netkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_netkey_add_appkey(netkey_h, &appkey_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret ==  BT_ERROR_NONE)
-                               print_appkey_handle(appkey);
+                       if (ret == BT_ERROR_NONE)
+                               print_appkey_handle(appkey_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETKEY_FOREACH_APPKEYS: {
-                       ret = bt_mesh_netkey_foreach_appkeys(netkey, __bt_mesh_appkey_info_cb, NULL);
+                       /* Get all appkeys for NetKey 1 */
+                       bt_mesh_netkey_h netkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       netkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_netkey_foreach_appkeys(netkey_h, __bt_mesh_appkey_info_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_GET_INDEX: {
-                       uint16_t index = 0;
-                       ret = bt_mesh_appkey_get_index(appkey, &index);
+                       uint16_t index = 0xFFFF;
+                       bt_mesh_appkey_h appkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       /* Get appkey index for appkey 1 */
+                       ret = bt_mesh_appkey_get_index(appkey_h, &index);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE)
+                       if (ret == BT_ERROR_NONE)
                                TC_PRT("The index of the appkey is: [%d]", index);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_UPDATE: {
-                       ret = bt_mesh_appkey_update(appkey);
+                       bt_mesh_appkey_h appkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_appkey_update(appkey_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_DELETE: {
-                       ret = bt_mesh_appkey_delete(appkey);
+                       bt_mesh_appkey_h appkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set parameter first!");
+                               break;
+                       }
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_appkey_delete(appkey_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE)
+                               TC_PRT("appkey is deleted");
                        break;
                }
-               case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_NODES: {
-                       /* TODO */
+               case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_DEVICES: {
+                       ret = bt_mesh_network_foreach_devices(network, __bt_mesh_network_device_info_cb, NULL);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE_GROUP: {
-                       uint16_t group_addr = 1;
-                       ret = bt_mesh_network_create_group(network, group_addr, &group);
+                       uint16_t group_addr = 0xc001;
+                       bt_mesh_group_h group_h;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Enter parameter first!!\n");
+                               break;
+                       }
+                       group_addr = strtoul(g_test_param.params[0], NULL, 16);
+                       TC_PRT("Group addrrss [0x%2.2x]", group_addr);
+                       ret = bt_mesh_network_create_group(network, group_addr, &group_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE)
+                               print_group_handle(group_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE_VIRTUAL_GROUP: {
-                       ret = bt_mesh_network_create_virtual_group(network, &virtual_group);
+                       bt_mesh_group_h group_h;
+                       ret = bt_mesh_network_create_virtual_group(network, &group_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       if (ret == BT_ERROR_NONE)
+                               print_group_handle(group_h);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_REMOVE_GROUP: {
@@ -927,18 +1459,21 @@ int test_input_callback(void *data)
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_GROUPS: {
-                       ret = bt_mesh_network_foreach_groups(network, __bt_mesh_network_group_info_cb, NULL);
+                       ret = bt_mesh_network_foreach_groups(network,
+                                       __bt_mesh_network_group_info_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_UNPROVISIONED_DEVICE_SCAN: {
                        bt_mesh_scan_params_s scan_params;
-                       scan_params.seconds = 30;
-                       if(g_test_param.param_count > 0) {
-                               scan_params.seconds = atoi(g_test_param.params[0]);
+                       memset(&scan_params, 0x00, sizeof(bt_mesh_scan_params_s));
+                       if(g_test_param.param_count != 1) {
+                               TC_PRT("Enter Input parameter first.\n");
+                               break;
                        }
-                       TC_PRT("The scan is set for [%d] seconds.", scan_params.seconds);
-                       ret = bt_mesh_network_unprovisioned_device_scan(network,&scan_params,
+                       scan_params.seconds = strtoul(g_test_param.params[0], NULL, 16);
+                       TC_PRT("The scan is set for [%u] seconds", scan_params.seconds);
+                       ret = bt_mesh_network_unprovisioned_device_scan(network, &scan_params,
                                __bt_mesh_network_scan_unprovisioned_device_result_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
@@ -946,24 +1481,26 @@ int test_input_callback(void *data)
                case BT_MESH_UNIT_TEST_FUNCTION_STOP_UNPROVISIONED_DEVICE_SCAN: {
                        ret = bt_mesh_stop_unprovisioned_device_scan(network);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE)
-                               TC_PRT("Device SCAN : STOPPED\n");
+                       if (ret == BT_ERROR_NONE)
+                               TC_PRT("Device SCAN : STOPPED");
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_PROVISION_DEVICE: {
-                       const char *dev_uuid = NULL;
-                       if(g_test_param.param_count > 0) {
-                               dev_uuid = g_test_param.params[0];
+                       const char *dev_uuid = "abababababababababababababababab";
+                       if(g_test_param.param_count != 1) {
+                               TC_PRT("Enter Input parameter first.\n");
+                               break;
                        }
+                               dev_uuid = g_test_param.params[0];
                        TC_PRT("The dev_uuid is [%s]\n",dev_uuid);
                        ret = bt_mesh_network_provision_device(network, dev_uuid,
                                __bt_mesh_network_device_provision_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       __bt_free_test_param(&g_test_param);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_AUTHENTICATION_SET_REQUEST_CB: {
-                       ret =  bt_mesh_authentication_set_request_cb(__bt_mesh_authentication_request_cb, NULL);
+                       ret =  bt_mesh_authentication_set_request_cb(
+                                       __bt_mesh_authentication_request_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
@@ -971,7 +1508,7 @@ int test_input_callback(void *data)
                        char* value;
                        int len;
                        bool auth_reply;
-                       if(g_test_param.param_count != 2){
+                       if(g_test_param.param_count !=2){
                                TC_PRT("Enter Input parameter first.\n");
                                break;
                        }
@@ -979,30 +1516,29 @@ int test_input_callback(void *data)
                        value = g_malloc0(len+1);
                        g_strlcpy(value, g_test_param.params[0], len+1);
                        auth_reply = atoi(g_test_param.params[1]);
-                       TC_PRT("\nauth_value is  [%s]\n", value);
-                       TC_PRT("auth_reply is    [%d]\n", auth_reply);
-                       TC_PRT("request_type is     [%d]\n",request_type);
+                       TC_PRT("\nauth_value is [%s]\n", value);
+                       TC_PRT("auth_reply is [%d]\n", auth_reply);
+                       TC_PRT("auth_type is [%d]\n", request_type);
                        ret = bt_mesh_authentication_reply(request_type, (const char*)value, auth_reply);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       __bt_free_test_param(&g_test_param);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_PROVISIONING_CAPABILITIES: {
                        bt_mesh_provisioner_capabilities_s capabilities;
                        if(g_test_param.param_count !=4) {
                                TC_PRT("Enter Input parameter first.");
+                               break;
                        }
                        capabilities.public_oob = atoi(g_test_param.params[0]);
                        capabilities.static_oob = atoi(g_test_param.params[1]);
                        capabilities.out_oob = (int)strtol(g_test_param.params[2], NULL, 16);
                        capabilities.in_oob = (int)strtol(g_test_param.params[3], NULL, 16);
-                       TC_PRT("capabilities.public_oob [%d]", capabilities.public_oob);
-                       TC_PRT("capabilities.static_oob [%d]", capabilities.static_oob);
-                       TC_PRT("capabilities.out_oob    [%d]", capabilities.out_oob);
-                       TC_PRT("capabilities.in_oob     [%d]", capabilities.in_oob);
+                       TC_PRT("CAP: PUBLIC OOB [%d]", capabilities.public_oob);
+                       TC_PRT("CAP: STATIC OOB [%d]", capabilities.static_oob);
+                       TC_PRT("CAP: OUT OOB [%d]", capabilities.out_oob);
+                       TC_PRT("CAP: IN OOB [%d]", capabilities.in_oob);
                        ret = bt_mesh_network_set_provisioning_capabilities(network, &capabilities);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       __bt_free_test_param(&g_test_param);
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_NETWORK_GET_PROVISIONING_CAPABILITIES: {
@@ -1011,19 +1547,27 @@ int test_input_callback(void *data)
                }
                case BT_MESH_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS: {
                        need_to_set_params = true;
-                       TC_PRT("Select the function again\n");
+                       TC_PRT("Select the function again");
                        break;
                }
                default:
                        break;
                }
+                       __bt_free_test_param(&g_test_param);
                break;
        }
        case BT_MESH_UNIT_TEST_TABLE_CONFIGURATION: {
                switch (test_id) {
                case BT_MESH_UNIT_TEST_FUNCTION_MESH_NETWORK_DISCOVER_NODE: {
-                       char * dev_uuid = "";
-                       ret = bt_mesh_network_discover_node(network, (const char*)dev_uuid, __bt_mesh_node_discover_status_cb, NULL);
+                       char* dev_uu = "tempName";
+                       if (g_test_param.param_count > 0) {
+                               dev_uu = g_strdup(g_test_param.params[0]);
+                       } else {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       ret = bt_mesh_network_discover_node(network, (const char*)dev_uu,
+                                       __bt_mesh_node_discover_status_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
@@ -1031,81 +1575,256 @@ int test_input_callback(void *data)
                        // TODO: need to implement
                        break;
                }
-               case BT_MESH_UNIT_TEST_FUNCTION_GET_TTL: {
-                       ret = bt_mesh_node_get_ttl(node, __bt_mesh_node_ttl_cb, NULL);
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_FEATURES: {
+                       bt_mesh_node_h node_h = 0;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_node_get_features(node_h, __bt_mesh_node_features_cb, NULL);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_NETKEYS: {
+                       bt_mesh_node_h node_h = 0;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_node_foreach_netkeys(node_h, __bt_mesh_node_foreach_netkeys_cb, NULL);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_APPKEYS: {
+                       bt_mesh_node_h node_h = 0;
+                       bt_mesh_netkey_h netkey_h = 0;
+                       if (g_test_param.param_count != 2) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       netkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[1], NULL, 16));
+
+                       ret = bt_mesh_node_foreach_appkeys(node_h, netkey_h,
+                                       __bt_mesh_node_foreach_appkeys_cb, NULL);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_TTL: {
+                       bt_mesh_node_h node_h = 0;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ret = bt_mesh_node_get_ttl(node_h, __bt_mesh_node_ttl_cb, NULL);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_SET_TTL: {
+                       bt_mesh_node_h node_h = 0;
+                       int ttl = 120;
+                       if (g_test_param.param_count != 2) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       ttl = atoi(g_test_param.params[1]);
+
+                       ret = bt_mesh_node_set_ttl(node_h, (uint8_t) ttl, __bt_mesh_node_ttl_cb, NULL);
+                       TC_PRT("return %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_NETKEY: {
+                       bt_mesh_node_h node_h = 0;
+                       bt_mesh_netkey_h netkey_h = 0;
+                       bt_mesh_node_key_configuration_e config = 0;
+                       if (g_test_param.param_count != 3) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       netkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[1], NULL, 16));
+                       config = atoi(g_test_param.params[2]);
+
+                       ret = bt_mesh_node_configure_netkey(node_h, config, netkey_h,
+                               __bt_mesh_node_configure_netkey_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
-               case BT_MESH_UNIT_TEST_FUNCTION_SET_TTL: {
-                       int ttl = 60;
-                       ret = bt_mesh_node_set_ttl(node, ttl, __bt_mesh_node_ttl_cb, NULL);
+               case BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_APPKEY: {
+                       bt_mesh_node_h node_h = 0;
+                       bt_mesh_appkey_h appkey_h = 0;
+                       bt_mesh_node_key_configuration_e config = 0;
+                       if (g_test_param.param_count != 3) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       node_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[1], NULL, 16));
+                       config = atoi(g_test_param.params[2]);
+
+                       ret = bt_mesh_node_configure_appkey(node_h, config, appkey_h,
+                               __bt_mesh_node_configure_appkey_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_BIND_APPKEY: {
-                       ret = bt_mesh_model_bind_appkey(model, appkey, __bt_mesh_model_bind_cb, NULL);
+                       bt_mesh_model_h model_h = 0;
+                       bt_mesh_appkey_h appkey_h = 0;
+                       if (g_test_param.param_count != 2) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[1], NULL, 16));
+
+                       ret = bt_mesh_model_bind_appkey(model_h, appkey_h, __bt_mesh_model_bind_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_UNBIND_APPKEY: {
-                       ret = bt_mesh_model_unbind_appkey(model, appkey, __bt_mesh_model_unbind_cb, NULL);
+                       bt_mesh_model_h model_h = 0;
+                       bt_mesh_appkey_h appkey_h = 0;
+                       if (g_test_param.param_count != 2) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[1], NULL, 16));
+
+                       ret = bt_mesh_model_unbind_appkey(model_h, appkey_h, __bt_mesh_model_unbind_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_APPKEY_LIST: {
-                       ret = bt_mesh_model_get_appkey_list(model, __bt_mesh_model_appkey_list_cb, NULL);
+                       bt_mesh_model_h model_h = 0;
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+
+                       ret = bt_mesh_model_get_appkey_list(model_h, __bt_mesh_model_appkey_list_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_CONFIGURE_GROUP_SUBSCRIPTION: {
-                       bt_mesh_model_subscription_op_e model_op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
-                       ret = bt_mesh_model_configure_group_subscription(model_op, model,  group,
+                       bt_mesh_model_h model_h = 0;
+                       bt_mesh_group_h group_h = 0;
+                       bt_mesh_model_subscription_op_e op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
+
+                       if (g_test_param.param_count != 3) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       op = atoi(g_test_param.params[1]);
+                       group_h = GUINT_TO_POINTER(strtoul(g_test_param.params[2], NULL, 16));
+
+                       ret = bt_mesh_model_configure_group_subscription(op, model_h, group_h,
                                                                __bt_mesh_model_subscription_op_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_CONFIGURE_VIRTUAL_GROUP_SUBSCRIPTION: {
-                       bt_mesh_model_subscription_op_e model_op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
-                       ret = bt_mesh_model_configure_virtual_group_subscription(model_op, model,  virtual_group,
+                       bt_mesh_model_h model_h = 0;
+                       bt_mesh_group_h group_h = 0;
+                       bt_mesh_model_subscription_op_e op = BT_MESH_MODEL_SUBSCRIPTION_ADD;
+
+                       if (g_test_param.param_count != 3) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       op = atoi(g_test_param.params[1]);
+                       group_h = GUINT_TO_POINTER(strtoul(g_test_param.params[2], NULL, 16));
+
+                       ret = bt_mesh_model_configure_virtual_group_subscription(op, model_h, group_h,
                                        __bt_mesh_model_subscription_op_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_SUBSCRIPTION_LIST: {
-                       ret = bt_mesh_model_get_subscription_list(model, __bt_mesh_model_subscription_list_cb, NULL);
+                       bt_mesh_model_h model_h = 0;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+
+                       ret = bt_mesh_model_get_subscription_list(model_h, __bt_mesh_model_subscription_list_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_SET_PUBLICATION: {
-                       bt_mesh_model_pub_params_s params;
-                       memset(&params, 0x00, sizeof(bt_mesh_model_pub_params_s));
-                       ret = bt_mesh_model_set_publication(model, appkey, group, &params,
+                       bt_mesh_model_h model_h = 0;
+                       bt_mesh_model_h appkey_h = 0;
+                       bt_mesh_group_h group_h = 0;
+                       bt_mesh_model_pub_params_s param;
+
+                       memset(&param, 0x00, sizeof(bt_mesh_model_pub_params_s));
+
+                       if (g_test_param.param_count != 3) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[1], NULL, 16));
+                       group_h = GUINT_TO_POINTER(strtoul(g_test_param.params[2], NULL, 16));
+
+                       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_model_set_publication(model_h, appkey_h, group_h, &param,
                                                        __bt_mesh_model_publication_status_cb, NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_PUBLICATION: {
-                       ret = bt_mesh_model_get_publication(model, __bt_mesh_model_publication_status_cb,  NULL);
+                       bt_mesh_model_h model_h = 0;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
+                       }
+                       model_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+
+                       ret = bt_mesh_model_get_publication(model_h, __bt_mesh_model_publication_status_cb,  NULL);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_MESH_UNIT_TEST_FUNCTION_APPKEY_GET_NETKEY: {
-                       if(current_netkey_index == 10) {
-                               TC_PRT("netkey instances are full\n");
-                               current_netkey_index = current_netkey_index%10;
-                               TC_PRT("Removing the netkey instance at index: [%d]", current_netkey_index);
+                       bt_mesh_appkey_h appkey_h = 0;
+                       bt_mesh_netkey_h netkey_h;
+
+                       if (g_test_param.param_count != 1) {
+                               TC_PRT("Set Input parameter first!");
+                               break;
                        }
-                       ret = bt_mesh_appkey_get_netkey(appkey, &netkeys[current_netkey_index]);
+                       appkey_h = GUINT_TO_POINTER(strtoul(g_test_param.params[0], NULL, 16));
+
+                       ret = bt_mesh_appkey_get_netkey(appkey_h, &netkey_h);
                        TC_PRT("return %s\n", __bt_get_error_message(ret));
-                       if(ret == BT_ERROR_NONE) {
-                               TC_PRT("cuurent netkey instance stored at index [%d]", current_netkey_index);
-                               current_netkey_index++;
-                       }
+                       if (ret == BT_ERROR_NONE)
+                               print_network_handle(netkey_h);
+                       break;
+               }
+               case BT_MESH_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS: {
+                       need_to_set_params = true;
+                       TC_PRT("Select the function again");
                        break;
                }
                default:
                        break;
                }
+                       __bt_free_test_param(&g_test_param);
                break;
        }
        default:
index e51346a..10d02b5 100644 (file)
@@ -52,12 +52,10 @@ typedef enum {
        BT_MESH_UNIT_TEST_FUNCTION_MODEL_DESTROY,
        BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_ELEMENT,
        BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_DESTROY,
-       BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_FOREACH_MODELS,
        BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_GET_NODE,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_FOREACH_ELEMENTS,
+       BT_MESH_UNIT_TEST_FUNCTION_ELEMENT_FOREACH_MODELS,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE,
-       BT_MESH_UNIT_TEST_FUNCTION_NETWORK_UNPROVISIONED_DEVICE_SCAN,
-       BT_MESH_UNIT_TEST_FUNCTION_NETWORK_PROVISION_DEVICE,
-       BT_MESH_UNIT_TEST_FUNCTION_MESH_AUTHENTICATION_REPLY,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_LOAD,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_NAME,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_GET_NAME,
@@ -71,19 +69,27 @@ typedef enum {
        BT_MESH_UNIT_TEST_FUNCTION_APPKEY_GET_INDEX,
        BT_MESH_UNIT_TEST_FUNCTION_APPKEY_UPDATE,
        BT_MESH_UNIT_TEST_FUNCTION_APPKEY_DELETE,
-       BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_NODES,
+       BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_DEVICES,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE_GROUP,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_CREATE_VIRTUAL_GROUP,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_REMOVE_GROUP,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_FOREACH_GROUPS,
+       BT_MESH_UNIT_TEST_FUNCTION_NETWORK_UNPROVISIONED_DEVICE_SCAN,
        BT_MESH_UNIT_TEST_FUNCTION_STOP_UNPROVISIONED_DEVICE_SCAN,
+       BT_MESH_UNIT_TEST_FUNCTION_NETWORK_PROVISION_DEVICE,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_AUTHENTICATION_SET_REQUEST_CB,
+       BT_MESH_UNIT_TEST_FUNCTION_MESH_AUTHENTICATION_REPLY,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_SET_PROVISIONING_CAPABILITIES,
        BT_MESH_UNIT_TEST_FUNCTION_NETWORK_GET_PROVISIONING_CAPABILITIES,
        BT_MESH_UNIT_TEST_FUNCTION_MESH_NETWORK_DISCOVER_NODE=1,
        BT_MESH_UNIT_TEST_FUNCTION_NODE_RESET,
-       BT_MESH_UNIT_TEST_FUNCTION_GET_TTL,
-       BT_MESH_UNIT_TEST_FUNCTION_SET_TTL,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_FEATURES,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_NETKEYS,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_APPKEYS,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_GET_TTL,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_SET_TTL,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_NETKEY,
+       BT_MESH_UNIT_TEST_FUNCTION_NODE_CONFIGURE_APPKEY,
        BT_MESH_UNIT_TEST_FUNCTION_MODEL_BIND_APPKEY,
        BT_MESH_UNIT_TEST_FUNCTION_MODEL_UNBIND_APPKEY,
        BT_MESH_UNIT_TEST_FUNCTION_MODEL_GET_APPKEY_LIST,