Add supported features check
[platform/core/api/connection.git] / test / connection_test.c
old mode 100644 (file)
new mode 100755 (executable)
index d1f1a6c..dbe83c9
@@ -11,7 +11,7 @@
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
- * limitations under the License. 
+ * limitations under the License.
  */
 
 #include <stdio.h>
@@ -47,7 +47,7 @@ static bool test_get_user_string(const char *msg, char *buf, int buf_size)
                return false;
        }
 
-       buf[buf_size - 1] = '\0';
+       buf[rv-1]='\0';
 
        return true;
 }
@@ -85,6 +85,46 @@ static const char *test_print_state(connection_profile_state_e state)
        }
 }
 
+static const char *test_print_error(connection_error_e error)
+{
+       switch (error) {
+       case CONNECTION_ERROR_NONE:
+               return "CONNECTION_ERROR_NONE";
+       case CONNECTION_ERROR_INVALID_PARAMETER:
+               return "CONNECTION_ERROR_INVALID_PARAMETER";
+       case CONNECTION_ERROR_OUT_OF_MEMORY:
+               return "CONNECTION_ERROR_OUT_OF_MEMORY";
+       case CONNECTION_ERROR_INVALID_OPERATION:
+               return "CONNECTION_ERROR_INVALID_OPERATION";
+       case CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED:
+               return "CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED";
+       case CONNECTION_ERROR_OPERATION_FAILED:
+               return "CONNECTION_ERROR_OPERATION_FAILED";
+       case CONNECTION_ERROR_ITERATOR_END:
+               return "CONNECTION_ERROR_ITERATOR_END";
+       case CONNECTION_ERROR_NO_CONNECTION:
+               return "CONNECTION_ERROR_NO_CONNECTION";
+       case CONNECTION_ERROR_NOW_IN_PROGRESS:
+               return "CONNECTION_ERROR_NOW_IN_PROGRESS";
+       case CONNECTION_ERROR_ALREADY_EXISTS:
+               return "CONNECTION_ERROR_ALREADY_EXISTS";
+       case CONNECTION_ERROR_OPERATION_ABORTED:
+               return "CONNECTION_ERROR_OPERATION_ABORTED";
+       case CONNECTION_ERROR_DHCP_FAILED:
+               return "CONNECTION_ERROR_DHCP_FAILED";
+       case CONNECTION_ERROR_INVALID_KEY:
+               return "CONNECTION_ERROR_INVALID_KEY";
+       case CONNECTION_ERROR_NO_REPLY:
+               return "CONNECTION_ERROR_NO_REPLY";
+       case CONNECTION_ERROR_PERMISSION_DENIED:
+               return "CONNECTION_ERROR_PERMISSION_DENIED";
+       case CONNECTION_ERROR_NOT_SUPPORTED:
+               return "CONNECTION_ERROR_NOT_SUPPORTED";
+       default:
+               return "CONNECTION_ERROR_UNKNOWN";
+       }
+}
+
 static void test_type_changed_callback(connection_type_e type, void* user_data)
 {
        printf("Type changed callback, connection type : %d\n", type);
@@ -133,6 +173,31 @@ static void test_connection_closed_callback(connection_error_e result, void* use
                printf("Connection close Failed, err : %d\n", result);
 }
 
+static void test_connection_reset_profile_callback(connection_error_e result, void* user_data)
+{
+       if (result ==  CONNECTION_ERROR_NONE)
+               printf("Reset profile Succeeded\n");
+       else
+               printf("Reset profile Failed, err : [%s]\n", test_print_error(result));
+}
+
+static void test_connection_set_default_callback(connection_error_e result, void* user_data)
+{
+       if (result ==  CONNECTION_ERROR_NONE)
+               printf("Default profile setting Succeeded\n");
+       else
+               printf("Default profile setting Failed, err : %d\n", result);
+}
+
+void test_get_ethernet_cable_state_callback(connection_ethernet_cable_state_e state,
+                                                               void* user_data)
+{
+       if(state == CONNECTION_ETHERNET_CABLE_ATTACHED)
+               printf("Ethernet Cable Connected\n");
+       else if(state == CONNECTION_ETHERNET_CABLE_DETACHED)
+               printf("Ethernet Cable Disconnected\n");
+}
+
 static bool test_get_user_selected_profile(connection_profile_h *profile, bool select)
 {
        int rv = 0;
@@ -320,14 +385,14 @@ static int test_update_wifi_info(connection_profile_h profile)
        return 1;
 }
 
-static int test_update_ip_info(connection_profile_h profile)
+static int test_update_ip_info(connection_profile_h profile, connection_address_family_e address_family)
 {
        int rv = 0;
        char input_str[100] = {0,};
 
        if (test_get_user_string("Input IP Address - (Enter for skip) :", input_str, 100)) {
                rv = connection_profile_set_ip_address(profile,
-                                                       CONNECTION_ADDRESS_FAMILY_IPV4,
+                                                       address_family,
                                                        input_str);
                if (rv != CONNECTION_ERROR_NONE)
                        return -1;
@@ -335,7 +400,7 @@ static int test_update_ip_info(connection_profile_h profile)
 
        if (test_get_user_string("Input Netmask - (Enter for skip) :", input_str, 100)) {
                rv = connection_profile_set_subnet_mask(profile,
-                                                       CONNECTION_ADDRESS_FAMILY_IPV4,
+                                                       address_family,
                                                        input_str);
                if (rv != CONNECTION_ERROR_NONE)
                        return -1;
@@ -343,7 +408,7 @@ static int test_update_ip_info(connection_profile_h profile)
 
        if (test_get_user_string("Input Gateway - (Enter for skip) :", input_str, 100)) {
                rv = connection_profile_set_gateway_address(profile,
-                                                       CONNECTION_ADDRESS_FAMILY_IPV4,
+                                                       address_family,
                                                        input_str);
                if (rv != CONNECTION_ERROR_NONE)
                        return -1;
@@ -352,7 +417,7 @@ static int test_update_ip_info(connection_profile_h profile)
        if (test_get_user_string("Input DNS 1 Address - (Enter for skip) :", input_str, 100)) {
                rv = connection_profile_set_dns_address(profile,
                                                        1,
-                                                       CONNECTION_ADDRESS_FAMILY_IPV4,
+                                                       address_family,
                                                        input_str);
                if (rv != CONNECTION_ERROR_NONE)
                        return -1;
@@ -360,7 +425,7 @@ static int test_update_ip_info(connection_profile_h profile)
                if (test_get_user_string("Input DNS 2 Address - (Enter for skip) :", input_str, 100)) {
                        rv = connection_profile_set_dns_address(profile,
                                                                2,
-                                                               CONNECTION_ADDRESS_FAMILY_IPV4,
+                                                               address_family,
                                                                input_str);
                        if (rv != CONNECTION_ERROR_NONE)
                                return -1;
@@ -370,7 +435,7 @@ static int test_update_ip_info(connection_profile_h profile)
        return 1;
 }
 
-static int test_update_proxy_info(connection_profile_h profile)
+static int test_update_proxy_info(connection_profile_h profile, connection_address_family_e address_family)
 {
        int rv = 0;
        int input_int = 0;
@@ -405,7 +470,7 @@ static int test_update_proxy_info(connection_profile_h profile)
                if (test_get_user_string("Input auto Proxy URL or Proxy address"
                                        " - (Enter for skip) :", input_str, 100)) {
                        rv = connection_profile_set_proxy_address(profile,
-                                                               CONNECTION_ADDRESS_FAMILY_IPV4,
+                                                               address_family,
                                                                input_str);
                        if (rv != CONNECTION_ERROR_NONE)
                                return -1;
@@ -421,26 +486,29 @@ static int test_update_network_info(connection_profile_h profile)
 {
        int rv = 0;
        int input_int = 0;
+       int address_family = 0;
+
+       test_get_user_int("Input Address Family (0:IPv4 1:IPv6) :", &address_family);
 
        if (test_get_user_int("Input IPv4 Address Type (DHCP:1, Static:2)"
                                " - (Enter for skip) :", &input_int)) {
                switch (input_int) {
                case 1:
                        rv = connection_profile_set_ip_config_type(profile,
-                                                               CONNECTION_ADDRESS_FAMILY_IPV4,
-                                                               CONNECTION_IP_CONFIG_TYPE_DYNAMIC);
+                                                                  address_family,
+                                                                  CONNECTION_IP_CONFIG_TYPE_DYNAMIC);
                        break;
                case 2:
                        rv = connection_profile_set_ip_config_type(profile,
-                                                               CONNECTION_ADDRESS_FAMILY_IPV4,
-                                                               CONNECTION_IP_CONFIG_TYPE_STATIC);
+                                                                  address_family,
+                                                                  CONNECTION_IP_CONFIG_TYPE_STATIC);
                        if (rv != CONNECTION_ERROR_NONE)
                                return -1;
 
-                       if (test_update_ip_info(profile) == -1)
+                       if (test_update_ip_info(profile, address_family) == -1)
                                return -1;
 
-                       if (test_update_proxy_info(profile) == -1)
+                       if (test_update_proxy_info(profile, address_family) == -1)
                                return -1;
                        break;
                default:
@@ -465,6 +533,8 @@ static void test_print_cellular_info(connection_profile_h profile)
        char *password = NULL;
        char *home_url = NULL;
        bool roaming = false;
+       bool hidden = false;
+       bool editable = false;
 
        if (connection_profile_get_cellular_network_type(profile, &network_type) != CONNECTION_ERROR_NONE)
                printf("Fail to get cellular network type!\n");
@@ -504,6 +574,16 @@ static void test_print_cellular_info(connection_profile_h profile)
                printf("Fail to get cellular is roaming!\n");
        else
                printf("Cellular roaming : %s\n", roaming ? "true" : "false");
+
+       if (connection_profile_is_cellular_hidden(profile, &hidden) != CONNECTION_ERROR_NONE)
+               printf("Fail to get cellular hidden state!\n");
+       else
+               printf("Cellular hidden : %s\n", hidden ? "true" : "false");
+
+       if (connection_profile_is_cellular_editable(profile, &editable) != CONNECTION_ERROR_NONE)
+               printf("Fail to get cellular editing state!\n");
+       else
+               printf("Cellular editable : %s\n", editable ? "true" : "false");
 }
 
 static void test_print_wifi_info(connection_profile_h profile)
@@ -568,7 +648,7 @@ static void test_print_wifi_info(connection_profile_h profile)
                printf("Wi-Fi wps supported : %s\n", wps_supported ? "true" : "false");
 }
 
-static void test_print_network_info(connection_profile_h profile)
+static void test_print_network_info(connection_profile_h profile, connection_address_family_e address_family)
 {
        char *interface_name = NULL;
        connection_ip_config_type_e ip_type;
@@ -587,40 +667,40 @@ static void test_print_network_info(connection_profile_h profile)
                g_free(interface_name);
        }
 
-       if (connection_profile_get_ip_config_type(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_type) != CONNECTION_ERROR_NONE)
+       if (connection_profile_get_ip_config_type(profile, address_family, &ip_type) != CONNECTION_ERROR_NONE)
                printf("Fail to get ipconfig type!\n");
        else
                printf("Ipconfig type : %d\n", ip_type);
 
-       if (connection_profile_get_ip_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &ip) != CONNECTION_ERROR_NONE)
+       if (connection_profile_get_ip_address(profile, address_family, &ip) != CONNECTION_ERROR_NONE)
                printf("Fail to get IP address!\n");
        else {
                printf("IP address : %s\n", ip);
                g_free(ip);
        }
 
-       if (connection_profile_get_subnet_mask(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &subnet) != CONNECTION_ERROR_NONE)
+       if (connection_profile_get_subnet_mask(profile, address_family, &subnet) != CONNECTION_ERROR_NONE)
                printf("Fail to get subnet mask!\n");
        else {
                printf("Subnet mask : %s\n", subnet);
                g_free(subnet);
        }
 
-       if (connection_profile_get_gateway_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &gateway) != CONNECTION_ERROR_NONE)
+       if (connection_profile_get_gateway_address(profile, address_family, &gateway) != CONNECTION_ERROR_NONE)
                printf("Fail to get gateway!\n");
        else {
                printf("Gateway : %s\n", gateway);
                g_free(gateway);
        }
 
-       if (connection_profile_get_dns_address(profile, 1, CONNECTION_ADDRESS_FAMILY_IPV4, &dns1) != CONNECTION_ERROR_NONE)
+       if (connection_profile_get_dns_address(profile, 1, address_family, &dns1) != CONNECTION_ERROR_NONE)
                printf("Fail to get DNS1!\n");
        else {
                printf("DNS1 : %s\n", dns1);
                g_free(dns1);
        }
 
-       if (connection_profile_get_dns_address(profile, 2, CONNECTION_ADDRESS_FAMILY_IPV4, &dns2) != CONNECTION_ERROR_NONE)
+       if (connection_profile_get_dns_address(profile, 2, address_family, &dns2) != CONNECTION_ERROR_NONE)
                printf("Fail to get DNS2!\n");
        else {
                printf("DNS2 : %s\n", dns2);
@@ -632,7 +712,7 @@ static void test_print_network_info(connection_profile_h profile)
        else
                printf("Proxy type : %d\n", proxy_type);
 
-       if (connection_profile_get_proxy_address(profile, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy) != CONNECTION_ERROR_NONE)
+       if (connection_profile_get_proxy_address(profile, address_family, &proxy) != CONNECTION_ERROR_NONE)
                printf("Fail to get proxy!\n");
        else {
                printf("Proxy : %s\n", proxy);
@@ -649,6 +729,8 @@ int test_register_client(void)
                connection_set_type_changed_cb(connection, test_type_changed_callback, NULL);
                connection_set_ip_address_changed_cb(connection, test_ip_changed_callback, NULL);
                connection_set_proxy_address_changed_cb(connection, test_proxy_changed_callback, NULL);
+               connection_set_ethernet_cable_state_chaged_cb(connection,
+                                       test_get_ethernet_cable_state_callback, NULL);
        } else {
                printf("Client registration failed %d\n", err);
                return -1;
@@ -763,31 +845,55 @@ int test_get_current_proxy(void)
 int test_get_current_ip(void)
 {
        char *ip_addr = NULL;
+       int input;
+       bool rv;
+
+       rv = test_get_user_int("Input Address type to get"
+                       "(1:IPV4, 2:IPV6):", &input);
 
-       connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_addr);
+       if (rv == false) {
+               printf("Invalid input!!\n");
+               return -1;
+       }
 
-       if (ip_addr == NULL) {
-               printf("IP address does not exist\n");
+       switch (input) {
+       case 1:
+               connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &ip_addr);
+               if (ip_addr == NULL) {
+                       printf("IPv4 address does not exist\n");
+                       return -1;
+               }
+               printf("IPv4 address : %s\n", ip_addr);
+               break;
+
+       case 2:
+               connection_get_ip_address(connection, CONNECTION_ADDRESS_FAMILY_IPV6, &ip_addr);
+               if (ip_addr == NULL) {
+                       printf("IPv6 address does not exist\n");
+                       return -1;
+               }
+               printf("IPv6 address : %s\n", ip_addr);
+               break;
+       default:
+               printf("Wrong IP address family!!\n");
                return -1;
        }
 
-       printf("IPv4 address : %s\n", ip_addr);
        g_free(ip_addr);
-
-       return 1;       
+       return 1;
 }
 
 int test_get_call_statistics_info(void)
 {
        long long rv = 0;
 
-       connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv);
        printf("last recv data size [%lld]\n", rv);
-       connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv);
        printf("last sent data size [%lld]\n",rv );
-       connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv);
        printf("total received data size [%lld]\n",rv );
-       connection_get_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv);
        printf("total sent data size [%lld]\n", rv);
 
        return 1;
@@ -797,13 +903,13 @@ int test_get_wifi_call_statistics_info(void)
 {
        long long rv = 0;
 
-       connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA, &rv);
        printf("WiFi last recv data size [%lld]\n", rv);
-       connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA, &rv);
        printf("WiFi last sent data size [%lld]\n",rv );
-       connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA, &rv);
        printf("WiFi total received data size [%lld]\n",rv );
-       connection_get_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv);
+       connection_get_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA, &rv);
        printf("WiFi total sent data size [%lld]\n", rv);
 
        return 1;
@@ -817,12 +923,58 @@ int test_get_profile_list(void)
        return 1;
 }
 
+int test_get_default_profile_list(void)
+{
+       int rv = 0;
+       char *profile_name = NULL;
+       connection_profile_iterator_h profile_iter;
+       connection_profile_h profile_h;
+       connection_cellular_service_type_e service_type;
+       bool is_default = false;
+
+       rv = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_DEFAULT, &profile_iter);
+       if (rv != CONNECTION_ERROR_NONE) {
+               printf("Fail to get profile iterator [%s]\n", test_print_error(rv));
+               return -1;
+       }
+
+       while (connection_profile_iterator_has_next(profile_iter)) {
+               if (connection_profile_iterator_next(profile_iter, &profile_h) != CONNECTION_ERROR_NONE) {
+                       printf("Fail to get profile handle\n");
+                       return -1;
+               }
+
+               if (connection_profile_get_name(profile_h, &profile_name) != CONNECTION_ERROR_NONE) {
+                       printf("Fail to get profile name\n");
+                       return -1;
+               }
+               printf("profile name : %s\n", profile_name);
+               g_free(profile_name);
+
+               if (connection_profile_get_cellular_service_type(profile_h, &service_type) != CONNECTION_ERROR_NONE) {
+                       printf("Fail to get profile service type\n");
+                       return -1;
+               }
+               printf("service type : %d\n", service_type);
+
+               if (connection_profile_is_cellular_default(profile_h, &is_default) != CONNECTION_ERROR_NONE) {
+                       printf("Fail to get profile subscriber id\n");
+                       return -1;
+               }
+               printf("Default : %d\n", is_default);
+       }
+
+       return 1;
+}
+
 int test_get_connected_profile_list(void)
 {
        int rv = 0;
        char *profile_name = NULL;
        connection_profile_iterator_h profile_iter;
        connection_profile_h profile_h;
+       bool is_default = false;
+       connection_profile_type_e type;
 
        rv = connection_get_profile_iterator(connection, CONNECTION_ITERATOR_TYPE_CONNECTED, &profile_iter);
        if (rv != CONNECTION_ERROR_NONE) {
@@ -842,6 +994,20 @@ int test_get_connected_profile_list(void)
                }
                printf("profile name : %s\n", profile_name);
                g_free(profile_name);
+
+               if (connection_profile_get_type(profile_h, &type) != CONNECTION_ERROR_NONE) {
+                       printf("Fail to get profile type\n");
+                       return -1;
+               }
+               printf("profile type is %d\n", type);
+
+               if (type == CONNECTION_PROFILE_TYPE_CELLULAR) {
+               if (connection_profile_is_cellular_default(profile_h, &is_default) != CONNECTION_ERROR_NONE) {
+                       printf("Fail to get profile is default\n");
+                       return -1;
+               }
+                       printf("[%s]\n", is_default ? "default" : "not default");
+               }
        }
 
        return 1;
@@ -945,8 +1111,17 @@ int test_set_default_cellular_service_type(void)
 {
        connection_profile_h profile;
        connection_cellular_service_type_e type;
+       int input, rv;
+
+       rv = test_get_user_int("Input API type (1:sync, 2:async)", &input);
+
+       if (rv == false || (input != 1 && input != 2)) {
+               printf("Invalid input!!\n");
+               return -1;
+       }
 
        printf("\n** Choose a profile to set default service(internet or prepaid internet type only). **\n");
+
        if (test_get_user_selected_profile(&profile, true) == false)
                return -1;
 
@@ -955,8 +1130,14 @@ int test_set_default_cellular_service_type(void)
                return -1;
        }
 
-       if (connection_set_default_cellular_service_profile(connection, type, profile) != CONNECTION_ERROR_NONE)
-               return -1;
+       if (input == 1) {
+               if (connection_set_default_cellular_service_profile(connection, type, profile) != CONNECTION_ERROR_NONE)
+                       return -1;
+       } else {
+               if (connection_set_default_cellular_service_profile_async(connection,
+                               type, profile, test_connection_set_default_callback, NULL) != CONNECTION_ERROR_NONE)
+                       return -1;
+       }
 
        return 1;
 }
@@ -1047,6 +1228,10 @@ int test_update_profile(void)
 
                break;
        case CONNECTION_PROFILE_TYPE_ETHERNET:
+               if (test_update_network_info(profile) == -1)
+                       return -1;
+
+               break;
        case CONNECTION_PROFILE_TYPE_BT:
                printf("Not supported!\n");
                /* fall through */
@@ -1067,6 +1252,7 @@ int test_get_profile_info(void)
        connection_profile_state_e profile_state;
        connection_profile_h profile;
        char *profile_name = NULL;
+       int address_family = 0;
 
        printf("\n** Choose a profile to print. **\n");
        if (test_get_user_selected_profile(&profile, true) == false)
@@ -1086,10 +1272,11 @@ int test_get_profile_info(void)
        } else
                printf("Profile State : %s\n", test_print_state(profile_state));
 
-
        if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE)
                return -1;
 
+       test_get_user_int("Input Address Family (0:IPv4 1:IPv6) :", &address_family);
+
        switch (prof_type) {
        case CONNECTION_PROFILE_TYPE_CELLULAR:
                printf("Profile Type : Cellular\n");
@@ -1109,7 +1296,7 @@ int test_get_profile_info(void)
                return -1;
        }
 
-       test_print_network_info(profile);
+       test_print_network_info(profile, address_family);
 
        return 1;
 }
@@ -1120,6 +1307,7 @@ int test_refresh_profile_info(void)
        connection_profile_state_e profile_state;
        connection_profile_h profile;
        char *profile_name = NULL;
+       int address_family = 0;
 
        printf("\n** Choose a profile to refresh. **\n");
        if (test_get_user_selected_profile(&profile, true) == false)
@@ -1146,6 +1334,8 @@ int test_refresh_profile_info(void)
        if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE)
                return -1;
 
+       test_get_user_int("Input Address Family (0:IPv4 1:IPv6) :", &address_family);
+
        switch (prof_type) {
        case CONNECTION_PROFILE_TYPE_CELLULAR:
                printf("Profile Type : Cellular\n");
@@ -1165,7 +1355,7 @@ int test_refresh_profile_info(void)
                return -1;
        }
 
-       test_print_network_info(profile);
+       test_print_network_info(profile, address_family);
 
        return 1;
 }
@@ -1248,13 +1438,13 @@ int test_reset_call_statistics_info(void)
 {
        int ret = CONNECTION_ERROR_NONE;
 
-       ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
        printf("reset last recv data size [%d]\n", ret);
-       ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
        printf("last sent data size [%d]\n", ret);
-       ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
        printf("total received data size [%d]\n", ret);
-       ret = connection_reset_statistics(CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_CELLULAR, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
        printf("total sent data size [%d]\n", ret);
 
        return 1;
@@ -1264,13 +1454,13 @@ int test_reset_wifi_call_statistics_info(void)
 {
        int ret = CONNECTION_ERROR_NONE;
 
-       ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA);
        printf("WiFi last sent data size [%d]\n", ret);
-       ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA);
        printf("WiFi last recv data size [%d]\n", ret);
-       ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA);
        printf("WiFi total sent data size [%d]\n", ret);
-       ret = connection_reset_statistics(CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
+       ret = connection_reset_statistics(connection, CONNECTION_TYPE_WIFI, CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA);
        printf("WiFi total received data size [%d]\n", ret);
 
        return 1;
@@ -1279,20 +1469,105 @@ int test_reset_wifi_call_statistics_info(void)
 int test_add_route(void)
 {
        int rv = 0;
-       char ip_addr[30];
-       char if_name[40];
+       char ip_addr[100] = {0};
+       char if_name[40] = {0};
 
-       if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 30) == false)
+       if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 100) == false)
                return -1;
 
        if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false)
                return -1;
 
+       g_strstrip(ip_addr);
+       g_strstrip(if_name);
        rv = connection_add_route(connection, if_name, ip_addr);
        if (rv != CONNECTION_ERROR_NONE) {
                printf("Fail to get add new route [%d]\n", rv);
                return -1;
        }
+       printf("Add Route successfully\n");
+
+       return 1;
+}
+
+int test_remove_route(void)
+{
+       int rv = 0;
+       char ip_addr[100] = {0};
+       char if_name[40] = {0};
+
+       if (test_get_user_string("Input IP - (Enter for skip) :", ip_addr, 100) == false)
+               return -1;
+
+       if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false)
+               return -1;
+
+       g_strstrip(ip_addr);
+       g_strstrip(if_name);
+       rv = connection_remove_route(connection, if_name, ip_addr);
+       if (rv != CONNECTION_ERROR_NONE) {
+               printf("Fail to remove the route [%s]\n", test_print_error(rv));
+               return -1;
+       }
+       printf("Remove Route successfully\n");
+
+       return 1;
+}
+
+int test_add_route_ipv6(void)
+{
+       int rv = 0;
+       char ip_addr[100] = {0};
+       char gateway[100] = {0};
+       char if_name[40] = {0};
+
+       if (test_get_user_string("Input IPv6 - (Enter for skip) :", ip_addr, 100) == false)
+               return -1;
+
+       if (test_get_user_string("Input Gateway - (Enter for skip) :", gateway, 100) == false)
+               return -1;
+
+       if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false)
+               return -1;
+
+       g_strstrip(ip_addr);
+       g_strstrip(gateway);
+       g_strstrip(if_name);
+       rv = connection_add_route_ipv6(connection, if_name, ip_addr, gateway);
+       if (rv != CONNECTION_ERROR_NONE) {
+               printf("Fail to get add new route [%d]\n", rv);
+               return -1;
+       }
+       printf("Add Route successfully\n");
+
+       return 1;
+}
+
+int test_remove_route_ipv6(void)
+{
+       int rv = 0;
+       char ip_addr[100] = {0};
+       char gateway[100] = {0};
+       char if_name[40] = {0};
+
+       if (test_get_user_string("Input IPv6 - (Enter for skip) :", ip_addr, 100) == false)
+               return -1;
+
+       if (test_get_user_string("Input Gateway - (Enter for skip) :", gateway, 100) == false)
+               return -1;
+
+       if (test_get_user_string("Input Interface name - (Enter for skip) :", if_name, 40) == false)
+               return -1;
+
+       g_strstrip(ip_addr);
+       g_strstrip(gateway);
+       g_strstrip(if_name);
+       rv = connection_remove_route_ipv6(connection, if_name, ip_addr, gateway);
+       if (rv != CONNECTION_ERROR_NONE) {
+               printf("Fail to remove the route [%d]\n", rv);
+               return -1;
+       }
+       printf("Remove Route successfully\n");
 
        return 1;
 }
@@ -1334,9 +1609,84 @@ int test_get_profile_id(void)
        return 1;
 }
 
+int test_get_mac_address(void)
+{
+       int rv = 0, type = 0;
+       connection_type_e conn_type;
+       char *mac_addr = NULL;
+
+       test_get_user_int("Input connection type (1:wifi, 2:ethernet)", &type);
+
+       switch (type) {
+       case 1:
+               conn_type = CONNECTION_TYPE_WIFI;
+               break;
+       case 2:
+               conn_type = CONNECTION_TYPE_ETHERNET;
+               break;
+       default:
+               printf("Wrong number!!\n");
+               return -1;
+       }
+
+       rv = connection_get_mac_address(connection, conn_type, &mac_addr);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               printf("Fail to get MAC address [%s]\n", test_print_error(rv));
+               return -1;
+       }
+
+       printf("mac address is %s\n", mac_addr);
+
+       g_free(mac_addr);
+
+       return 1;
+}
+
+int test_get_ethernet_cable_state(void)
+{
+       int rv = 0;
+       connection_ethernet_cable_state_e cable_state;
+
+       rv = connection_get_ethernet_cable_state(connection, &cable_state);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               printf("Fail to get ethernet cable state [%s]\n", test_print_error(rv));
+               return -1;
+       }
+
+       printf("Retval = [%s], Ethernet cable state [%d]\n", test_print_error(rv), cable_state);
+
+       return 1;
+}
+
+int test_reset_profile(void)
+{
+       int type, sim_id, rv;
+
+       rv = test_get_user_int("Input reset type (0:default profile reset, 1:delete profile reset)", &type);
+
+       if (rv == false || (type != 0 && type != 1)) {
+               printf("Invalid input!!\n");
+               return -1;
+       }
+
+       rv = test_get_user_int("Input SIM id to reset (0:SIM1, 1:SIM2)", &sim_id);
+
+       if (rv == false || (sim_id != 0 && sim_id != 1)) {
+               printf("Invalid input!!\n");
+               return -1;
+       }
+
+       if (connection_reset_profile(connection, type, sim_id, test_connection_reset_profile_callback, NULL) != CONNECTION_ERROR_NONE) {
+               return -1;
+       }
+
+       return 1;
+}
+
 int main(int argc, char **argv)
 {
-       
        GMainLoop *mainloop;
        mainloop = g_main_loop_new (NULL, FALSE);
 
@@ -1354,12 +1704,12 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
 {
        int rv = 0;
        char a[100];
-       
+
        memset(a, '\0', 100);
        printf("Event received from stdin\n");
-       
+
        rv = read(0, a, 100);
-       
+
        if (rv < 0 || a[0] == '0') {
                if (connection != NULL)
                        test_deregister_client();
@@ -1396,8 +1746,15 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                printf("o       - Reset cellular data call statistics\n");
                printf("p       - Reset WiFi data call statistics\n");
                printf("q       - Add new route\n");
-               printf("r       - Get Bluetooth state\n");
-               printf("s       - Get profile id\n");
+               printf("r       - Remove a route\n");
+               printf("s       - Get Bluetooth state\n");
+               printf("t       - Get profile id\n");
+               printf("u       - Reset profile\n");
+               printf("v       - Get all cellular default profiles\n");
+               printf("w       - Get mac address\n");
+               printf("x       - Get ethernet cable state\n");
+               printf("B       - Add IPv6 new route\n");
+               printf("C       - Remove IPv6 route\n");
                printf("0       - Exit \n");
                printf("ENTER  - Show options menu.......\n");
        }
@@ -1482,11 +1839,32 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                rv = test_add_route();
                break;
        case 'r':
-               rv = test_get_bt_state();
+               rv = test_remove_route();
                break;
        case 's':
+               rv = test_get_bt_state();
+               break;
+       case 't':
                rv = test_get_profile_id();
                break;
+       case 'u':
+               rv = test_reset_profile();
+               break;
+       case 'v':
+               rv = test_get_default_profile_list();
+               break;
+       case 'w':
+               rv = test_get_mac_address();
+               break;
+       case 'x':
+               rv = test_get_ethernet_cable_state();
+               break;
+       case 'B':
+               rv = test_add_route_ipv6();
+               break;
+       case 'C':
+               rv = test_remove_route_ipv6();
+               break;
        }
 
        if (rv == 1)