Updating FTC 2001, 10, 1 series tests to support a1pms V3 image
[nonrtric.git] / test / common / a1pms_api_functions.sh
index ceef204..5fb6e25 100644 (file)
@@ -1594,7 +1594,7 @@ a1pms_api_update_policy_parallel() {
   return 1
 }
 
-# API Test function: DELETE /policy and V2 DELETE /v2/policies/{policy_id}
+# API Test function: DELETE /policy, V2 DELETE /v2/policies/{policy_id} and V3 DELETE a1policymanagement/v1/policies/{policy_id}
 # args: <response-code> <policy-id> [count]
 # (Function for test scripts)
 a1pms_api_delete_policy() {
@@ -2823,7 +2823,7 @@ a1pms_api_get_rics() {
 #### API Test case functions Service registry and supervision ####
 ##################################################################
 
-# API test function: PUT /service and V2 PUT /service
+# API test function: PUT /service, V2 PUT /service and V3 PUT a1policymanagement/v1/services
 # args: <response-code>  <service-name> <keepalive-timeout> <callbackurl>
 # (Function for test scripts)
 a1pms_api_put_service() {
@@ -3019,7 +3019,7 @@ a1pms_api_get_service_ids() {
   return 0
 }
 
-# API test function: DELETE /services and V2 DELETE /v2/services/{serviceId}
+# API test function: DELETE /services, V2 DELETE /v2/services/{serviceId} and V3 DELETE a1policymanagement/v1/services/{serviceId}
 # args: <response-code> <service-name>
 # (Function for test scripts)
 a1pms_api_delete_services() {
@@ -3051,7 +3051,7 @@ a1pms_api_delete_services() {
   return 0
 }
 
-# API test function: PUT /services/keepalive and V2 PUT /v2/services/{service_id}/keepalive
+# API test function: PUT /services/keepalive, V2 PUT /v2/services/{service_id}/keepalive and V3 DELETE a1policymanagement/v1/services/{serviceId}
 # args: <response-code> <service-name>
 # (Function for test scripts)
 a1pms_api_put_services_keepalive() {
@@ -3063,19 +3063,26 @@ a1pms_api_put_services_keepalive() {
   fi
   if [ "$A1PMS_VERSION" == "V2" ]; then
     query="/v2/services/$2/keepalive"
+  elif [ "$A1PMS_VERSION" == "V3" ]; then
+    query="/v1/services/$2/keepalive"
   else
     query="/services/keepalive?name="$2
   fi
 
-  res="$(__do_curl_to_api A1PMS PUT $query)"
+  if [ "$A1PMS_VERSION" == "V3" ]; then
+    empty_json_body={}
+    res="$(__do_curl_to_api A1PMS PUT ${query} ${empty_json_body})"
+  else
+    res="$(__do_curl_to_api A1PMS PUT ${query})"
+  fi
   status=${res:${#res}-3}
 
   if [ $status -ne $1 ]; then
-    __log_test_fail_status_code $1 $status
+    __log_test_fail_status_code ${1} ${status}
     return 1
   fi
 
-  __collect_endpoint_stats "A1PMS" 16 "PUT" $A1PMS_API_PREFIX"/v2/services/{service_id}/keepalive" $status
+  __collect_endpoint_stats "A1PMS" 16 "PUT" ${A1PMS_API_PREFIX}${query} ${status}
   __log_test_pass
   return 0
 }
@@ -3084,7 +3091,7 @@ a1pms_api_put_services_keepalive() {
 #### API Test case functions Configuration                    ####
 ##################################################################
 
-# API Test function: PUT "/v2/configuration" or "/v1/configuration"
+# API Test function: PUT "/v2/configuration" or V3 PUT "a1policymanagement/v1/configuration"
 # args: <response-code> <config-file>
 # (Function for test scripts)
 a1pms_api_put_configuration() {
@@ -3128,7 +3135,7 @@ a1pms_api_put_configuration() {
   return 0
 }
 
-# API Test function: GET /v2/configuration
+# API Test function: GET /v2/configuration and V3 GET a1policymanagement/v1/configuration
 # args: <response-code> [<config-file>]
 # (Function for test scripts)
 a1pms_api_get_configuration() {