From f054e4f598a2b4046b74fbc6aadaff0c886bb542 Mon Sep 17 00:00:00 2001 From: "nibha.sharma" Date: Tue, 25 Oct 2016 11:03:34 +0530 Subject: [PATCH] [ITC][vpn-service][ACR-739][Added new apis] Change-Id: Ic15030824d6a22801117e0f7a6c9a8536eecda64 Signed-off-by: nibha.sharma --- src/itc/vpn-service/ITs-vpn-service.c | 94 ++++++++++++++++++++++ .../vpn-service/tct-vpn-service-native_mobile.h | 10 +++ 2 files changed, 104 insertions(+) diff --git a/src/itc/vpn-service/ITs-vpn-service.c b/src/itc/vpn-service/ITs-vpn-service.c index 0b5113c..e86b3ee 100755 --- a/src/itc/vpn-service/ITs-vpn-service.c +++ b/src/itc/vpn-service/ITs-vpn-service.c @@ -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; +} /** @} */ /** @} */ diff --git a/src/itc/vpn-service/tct-vpn-service-native_mobile.h b/src/itc/vpn-service/tct-vpn-service-native_mobile.h index 7ebe13c..6d9e69b 100755 --- a/src/itc/vpn-service/tct-vpn-service-native_mobile.h +++ b/src/itc/vpn-service/tct-vpn-service-native_mobile.h @@ -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} }; -- 2.7.4