[ITC][vpn-service][ACR-739][Added new apis]
authornibha.sharma <nibha.sharma@samsung.com>
Tue, 25 Oct 2016 05:33:34 +0000 (11:03 +0530)
committernibha.sharma <nibha.sharma@samsung.com>
Tue, 25 Oct 2016 05:33:34 +0000 (11:03 +0530)
Change-Id: Ic15030824d6a22801117e0f7a6c9a8536eecda64
Signed-off-by: nibha.sharma <nibha.sharma@samsung.com>
src/itc/vpn-service/ITs-vpn-service.c
src/itc/vpn-service/tct-vpn-service-native_mobile.h

index 0b5113c..e86b3ee 100755 (executable)
@@ -16,6 +16,7 @@
 #include "ITs-vpn-service-common.h"
 
 vpnsvc_h g_hVpnSvcHandle = NULL;
+#define VPNSVC_IP4_STRING_LEN 16
 
 //& set: VpnService
 
@@ -441,6 +442,99 @@ int ITc_vpnsvc_protect_p(void)
        return 0;
 }
 
+//& type: auto
+//& purpose: To Set local IP for VPN
+/** 
+* @testcase                    ITc_vpnsvc_set_local_ip_address_p
+* @since_tizen                 3.0
+* @author                              SRID(nibha.sharma)
+* @reviewer                            SRID(parshant.v)
+* @type                                auto
+* @description                 To Set local IP for VPN
+* @scenario                            To Set local IP for VPN
+* @apicovered                  vpnsvc_set_local_ip_address
+* @passcase                            If vpnsvc_set_local_ip_address returns success
+* @failcase                            If vpnsvc_set_local_ip_address returns false
+* @precondition                        vpn-service should be initialized
+* @postcondition               vpn-service should be de-initialized
+*/
+int ITc_vpnsvc_set_local_ip_address_p(void)
+{
+       START_TEST;
+       
+       char *pszLocalIp = "192.168.123.45";
+
+       // Target API
+       int nRetValue = vpnsvc_set_local_ip_address(g_hVpnSvcHandle, pszLocalIp);
+       PRINT_RESULT(VPNSVC_ERROR_NONE, nRetValue, "vpnsvc_set_local_ip_address", VPNSVCGetError(nRetValue));
+       
+       return 0;
+}
+
+//& type: auto
+//& purpose: To Set remote IP for VPN
+/** 
+* @testcase                    ITc_vpnsvc_set_remote_ip_address_p
+* @since_tizen                 3.0
+* @author                              SRID(nibha.sharma)
+* @reviewer                            SRID(parshant.v)
+* @type                                auto
+* @description                 To Set remote IP for VPN
+* @scenario                            To Set remote IP for VPN
+* @apicovered                  vpnsvc_set_remote_ip_address
+* @passcase                            If vpnsvc_set_remote_ip_address returns success
+* @failcase                            If vpnsvc_set_remote_ip_address returns false
+* @precondition                        vpn-service should be initialized
+* @postcondition               vpn-service should be de-initialized
+*/
+int ITc_vpnsvc_set_remote_ip_address_p(void)
+{
+       START_TEST;
+       
+       char *pszRemoteIp = "192.168.123.123";
+
+       // Target API
+       int nRetValue = vpnsvc_set_remote_ip_address(g_hVpnSvcHandle, pszRemoteIp);
+       PRINT_RESULT(VPNSVC_ERROR_NONE, nRetValue, "vpnsvc_set_remote_ip_address", VPNSVCGetError(nRetValue));
+       
+       return 0;
+}
+
+//& type: auto
+//& purpose: To update vpn settings
+/** 
+* @testcase                    ITc_vpnsvc_update_settings_p
+* @since_tizen                 3.0
+* @author                              SRID(nibha.sharma)
+* @reviewer                            SRID(parshant.v)
+* @type                                auto
+* @description                  To update vpn settings
+* @scenario                             To update vpn settings
+* @apicovered                  vpnsvc_update_settings
+* @passcase                            If vpnsvc_update_settings returns success
+* @failcase                            If vpnsvc_update_settings returns false
+* @precondition                        vpn-service should be initialized
+* @postcondition               vpn-service should be de-initialized
+*/
+int ITc_vpnsvc_update_settings_p(void)
+{
+       START_TEST;
+       
+       char *pszLocalIp = "192.168.123.45";
+       char *pszRemoteIp = "192.168.123.123";
+
+       int nRetValue = vpnsvc_set_local_ip_address(g_hVpnSvcHandle, pszLocalIp);
+       PRINT_RESULT(VPNSVC_ERROR_NONE, nRetValue, "vpnsvc_set_local_ip_address", VPNSVCGetError(nRetValue));
+       
+       nRetValue = vpnsvc_set_remote_ip_address(g_hVpnSvcHandle, pszRemoteIp);
+       PRINT_RESULT(VPNSVC_ERROR_NONE, nRetValue, "vpnsvc_set_remote_ip_address", VPNSVCGetError(nRetValue));
+       
+       // Target API
+       nRetValue = vpnsvc_update_settings(g_hVpnSvcHandle);
+       PRINT_RESULT(VPNSVC_ERROR_NONE, nRetValue, "vpnsvc_update_settings", VPNSVCGetError(nRetValue));
+
+       return 0;
+}
 
 /** @} */
 /** @} */
index 7ebe13c..6d9e69b 100755 (executable)
@@ -31,6 +31,11 @@ extern int ITc_vpnsvc_set_mtu_p(void);
 extern int ITc_vpnsvc_set_blocking_p(void);
 extern int ITc_vpnsvc_block_unblock_networks_p(void);
 extern int ITc_vpnsvc_protect_p(void);
+extern int ITc_vpnsvc_set_local_ip_address_p(void);
+extern int ITc_vpnsvc_set_remote_ip_address_p(void);
+extern int ITc_vpnsvc_update_settings_p(void);
+extern int ITc_vpnsvc_add_remove_route_p(void);
+extern int ITc_vpnsvc_add_remove_dns_server_p(void);
 
 testcase tc_array[] = {
     {"ITc_vpnsvc_init_deinit_p", ITc_vpnsvc_init_deinit_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
@@ -42,6 +47,11 @@ testcase tc_array[] = {
     {"ITc_vpnsvc_set_blocking_p", ITc_vpnsvc_set_blocking_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
     {"ITc_vpnsvc_block_unblock_networks_p", ITc_vpnsvc_block_unblock_networks_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
     {"ITc_vpnsvc_protect_p", ITc_vpnsvc_protect_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
+    {"ITc_vpnsvc_set_local_ip_address_p", ITc_vpnsvc_set_local_ip_address_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
+    {"ITc_vpnsvc_set_remote_ip_address_p", ITc_vpnsvc_set_remote_ip_address_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
+    {"ITc_vpnsvc_update_settings_p", ITc_vpnsvc_update_settings_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
+    {"ITc_vpnsvc_add_remove_route_p", ITc_vpnsvc_add_remove_route_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
+    {"ITc_vpnsvc_add_remove_dns_server_p", ITc_vpnsvc_add_remove_dns_server_p, ITs_vpn_service_startup, ITs_vpn_service_cleanup},
     {NULL, NULL}
 };