}
-# API Test function: GET /policy and V2 GET /v2/policies/{policy_id}
+# API Test function: GET /policy, V2 GET /v2/policies/{policy_id} and V3 GET a1policymanagement/v1/policies/{policy_id}
# args: <response-code> <policy-id> [<template-file>]
# args(V2): <response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]
-
# (Function for test scripts)
a1pms_api_get_policy() {
__log_test_start $@
return 1
fi
query="/v2/policies/$UUID$2"
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ if [ $# -ne 2 ] && [ $# -ne 8 ]; then
+ __print_err "<response-code> <policy-id> [ <template-file> <service-name> <ric-id> <policytype-id>|NOTYPE <transient> <notification-url>|NOURL ]" $@
+ return 1
+ fi
+ query="/v1/policies/$UUID$2"
else
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
__print_err "<response-code> <policy-id> [<template-file>] " $@
targetJson=$targetJson", \"policy_data\":$data"
targetJson="{$targetJson}"
+ echo "TARGET JSON: $targetJson" >>$HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ if [ $# -eq 8 ]; then
+ #Create a policy json to compare with
+ body=${res:0:${#res}-3}
+ data=$(sed 's/XXX/'${2}'/g' $3)
+ targetJson=$data
+
echo "TARGET JSON: $targetJson" >>$HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
if [ $res -ne 0 ]; then
fi
fi
- __collect_endpoint_stats "A1PMS" 01 "GET" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $status
+ __collect_endpoint_stats "A1PMS" 01 "GET" ${A1PMS_API_PREFIX}${query} ${status}
__log_test_pass
return 0
}
a1pms_api_put_policy() {
__log_test_start $@
- if [ "$A1PMS_VERSION" == "V2" ]; then
+ if [ "$A1PMS_VERSION" == "V2" ] || [ "$A1PMS_VERSION" == "V3" ]; then
if [ $# -lt 8 ] || [ $# -gt 9 ]; then
__print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]" $@
return 1
let count=$count+1
echo -ne " Executed "$count"("$max")${SAMELINE}"
done
- __collect_endpoint_stats "A1PMS" 02 "PUT" $A1PMS_API_PREFIX"/v2/policies" $status $max
+ __collect_endpoint_stats "A1PMS" 02 "PUT" ${A1PMS_API_PREFIX}${query} ${status} ${max}
+ echo ""
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: V3 PUT a1policymanagement/v1/policies
+# args: <response-code> <policy-id> <template-file> [<count>]
+# args(V2): <response-code> <policy-id> <template-file> [<count>]
+# (Function for test scripts)
+a1pms_api_put_policy_v3() {
+ __log_test_start $@
+
+ if [ $# -lt 3 ] || [ $# -gt 4 ]; then
+ __print_err "<response-code> <policy-id> <template-file> [<count>]" $@
+ return 1
+ fi
+
+ count=0
+ max=1
+ pid=$2
+ temp=$3
+
+ if [ $# -eq 4 ]; then
+ max=$4
+ fi
+
+ while [ $count -lt $max ]; do
+ query="/v1/policies/$UUID$pid"
+ file="./tmp/.p_v3.json"
+ let update_value=$pid+300
+ data=$(sed 's/XXX/'${update_value}'/g' $temp)
+ inputJson="$data"
+ echo $inputJson >$file
+ res="$(__do_curl_to_api A1PMS PUT $query $file)"
+ status=${res:${#res}-3}
+ echo -ne " Executing "$count"("$max")${SAMELINE}"
+ if [ $status -ne $1 ]; then
+ echo " Executed "$count"?("$max")"
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+ let pid=$pid+1
+ let count=$count+1
+ echo -ne " Executed "$count"("$max")${SAMELINE}"
+ done
+ __collect_endpoint_stats "A1PMS" 02 "PUT" ${A1PMS_API_PREFIX}${query} ${status} ${max}
+ echo ""
+
+ __log_test_pass
+ return 0
+}
+
+# API Test function: V£ POST a1policymanagement/v1/policies
+# args: <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <template-file> [<count>]
+# args(V2): <response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]
+# (Function for test scripts)
+a1pms_api_post_policy_v3() {
+ __log_test_start $@
+
+ if [ $# -lt 8 ] || [ $# -gt 9 ]; then
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id>|NOTYPE <policy-id> <transient>|NOTRANSIENT <notification-url>|NOURL <template-file> [<count>]" $@
+ return 1
+ fi
+
+ count=0
+ max=1
+ serv=$2
+ ric=$3
+ pt=$4
+ pid=$5
+ trans=$6
+ noti=$7
+ temp=$8
+ if [ $# -eq 9 ]; then
+ max=$9
+ fi
+
+ while [ $count -lt $max ]; do
+ query="/v1/policies"
+
+ inputJson="\"nearRtRicId\":\"$ric\""
+ if [ $pt != "NOTYPE" ]; then
+ inputJson=$inputJson", \"policyTypeId\":\"$pt\""
+ else
+ inputJson=$inputJson", \"policyTypeId\":\"\""
+ fi
+ if [ $serv != "NOSERVICE" ]; then
+ inputJson=$inputJson", \"serviceId\":\"$serv\""
+ fi
+ if [ $noti != "NONOTIFYURL" ]; then
+ inputJson=$inputJson", \"statusNotificationUri\":\"$noti\""
+ fi
+ if [ $trans != "NOTRANSIENT" ]; then
+ inputJson=$inputJson", \"transient\":\"$trans\""
+ fi
+ file="./tmp/.p.json"
+ data=$(sed 's/XXX/'${pid}'/g' $temp)
+ inputJson=$inputJson", \"policyObject\":$data"
+ inputJson=$inputJson", \"policyId\":\"$UUID$pid\""
+ inputJson="{$inputJson}"
+ echo $inputJson >$file
+ res="$(__do_curl_to_api A1PMS POST $query $file)"
+ status=${res:${#res}-3}
+ echo -ne " Executing "$count"("$max")${SAMELINE}"
+ if [ $status -ne $1 ]; then
+ echo " Executed "$count"?("$max")"
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+ let pid=$pid+1
+ let count=$count+1
+ echo -ne " Executed "$count"("$max")${SAMELINE}"
+ done
+ __collect_endpoint_stats "A1PMS" 02 "PUT" ${A1PMS_API_PREFIX}${A1PMS_VERSION} ${status} ${max}
echo ""
__log_test_pass
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() {
while [ $count -lt $max ]; do
if [ "$A1PMS_VERSION" == "V2" ]; then
query="/v2/policies/"$UUID$pid
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ query="/v1/policies/"$UUID$pid
else
query="/policy?id="$UUID$pid
fi
res="$(__do_curl_to_api A1PMS DELETE $query)"
status=${res:${#res}-3}
- echo -ne " Executing "$count"("$max")${SAMELINE}"
+ echo -ne " Executing "${count}"("${max}")${SAMELINE}"
if [ $status -ne $1 ]; then
- echo " Executed "$count"?("$max")"
+ echo " Executed "${count}"?("${max}")"
__log_test_fail_status_code $1 $status
return 1
fi
let pid=$pid+1
let count=$count+1
- echo -ne " Executed "$count"("$max")${SAMELINE}"
+ echo -ne " Executed "${count}"("${max}")${SAMELINE}"
done
- __collect_endpoint_stats "A1PMS" 03 "DELETE" $A1PMS_API_PREFIX"/v2/policies/{policy_id}" $status $max
+ __collect_endpoint_stats "A1PMS" 03 "DELETE" ${A1PMS_API_PREFIX}${query} ${status} ${max}
echo ""
__log_test_pass
return 0
}
-# API Test function: V2 GET /v2/policy-types/{policyTypeId}
+# API Test function: V3 GET a1policymanagement/v1/policies
+# args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)
+# (Function for test scripts)
+a1pms_api_get_all_policies_v3() {
+ __log_test_start $@
+
+ if [ $# -lt 4 ]; then
+ __print_err "<response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)" $@
+ return 1
+ fi
+
+ queryparams=""
+
+ if [ $2 != "NORIC" ]; then
+ queryparams="?nearRtRicId="$2
+ fi
+
+ if [ $3 != "NOSERVICE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?serviceId="$3
+ else
+ queryparams=$queryparams"&serviceId="$3
+ fi
+ fi
+ if [ $4 != "NOTYPE" ]; then
+ if [ -z $queryparams ]; then
+ queryparams="?policyTypeId="$4
+ else
+ queryparams=$queryparams"&policyTypeId="$4
+ fi
+ fi
+
+ query="/v1/policies"$queryparams
+
+ res="$(__do_curl_to_api A1PMS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ if [ $# -gt 4 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="["
+
+ for pid in ${@:5}; do
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ IFS=':' read -r policy_id ric_id <<<"$pid"
+ if [ $policy_id != "NOID" ]; then
+ targetJson=$targetJson"{ \"policyId\": \"${UUID}${policy_id}\", \"nearRtRicId\": \"$ric_id\" }"
+ fi
+ done
+
+ targetJson=$targetJson"]"
+ echo "TARGET JSON: $targetJson" >>$HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+
+ __collect_endpoint_stats "A1PMS" 04 "GET" ${A1PMS_API_PREFIX}${query} ${status}
+ __log_test_pass
+ return 0
+}
+
+# API Test function: V2 GET a1-policy/v2/policy-types/{policyTypeId} and V3 GET a1policymanagement/v1/policytypes/{policyTypeId}
# args(V2): <response-code> <policy-type-id> [<schema-file>]
# (Function for test scripts)
a1pms_api_get_policy_type() {
__log_test_start $@
- if [ "$A1PMS_VERSION" != "V2" ]; then
+ if [ "$A1PMS_VERSION" != "V2" ] && [ "$A1PMS_VERSION" != "V3" ]; then
__log_test_fail_not_supported
return 1
fi
__print_err "<response-code> <policy-type-id> [<schema-file>]" $@
return 1
fi
- query="/v2/policy-types/$2"
+ if [ "$A1PMS_VERSION" == "V2" ]; then
+ query="/v2/policy-types/$2"
+ fi
+ if [ "$A1PMS_VERSION" == "V3" ]; then
+ query="/v1/policytypes/$2"
+ fi
res="$(__do_curl_to_api A1PMS GET $query)"
status=${res:${#res}-3}
body=${res:0:${#res}-3}
targetJson=$(<$3)
- targetJson="{\"policy_schema\":$targetJson}"
+ if [ "$A1PMS_VERSION" == "V2" ]; then
+ targetJson="{\"policy_schema\":$targetJson}"
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ targetJson="$targetJson"
+ fi
echo "TARGET JSON: $targetJson" >>$HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
fi
fi
- __collect_endpoint_stats "A1PMS" 05 "GET" $A1PMS_API_PREFIX"/v2/policy-types/{policyTypeId}" $status
+ __collect_endpoint_stats "A1PMS" 05 "GET" ${A1PMS_API_PREFIX}${query} ${status}
__log_test_pass
return 0
}
return 0
}
+# API Test function: V3 GET a1policymanagement/v1/policytypes
+# args: <response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]
+# (Function for test scripts)
+a1pms_api_get_policy_types_v3() {
+ __log_test_start $@
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<ric-id>|NORIC [<policy-type-id>|EMPTY [<policy-type-id>]*]]" $@
+ return 1
+ fi
+
+ if [ $# -eq 1 ]; then
+ query="/v1/policytypes"
+ elif [ $2 == "NORIC" ]; then
+ query="/v1/policytypes"
+ else
+ query="/v1/policytypes?nearRtRicId=$2"
+ fi
+ res="$(__do_curl_to_api A1PMS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ if [ $# -gt 2 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="["
+
+ for pid in ${@:3}; do
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ IFS=':' read -r policy_type_id ric_id <<<"$pid"
+ # if [ -n "$policy_type_id" ] && [ -n "$ric_id" ]; then
+ if [ $policy_type_id == "EMPTY" ]; then
+ policy_type_id=""
+ fi
+ targetJson=$targetJson"{ \"policyTypeId\": \"$policy_type_id\", \"nearRtRicId\": \"$ric_id\" }"
+ # fi
+ done
+
+ targetJson=$targetJson"]"
+
+ echo "TARGET JSON: $targetJson" >>$HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+
+ __collect_endpoint_stats "A1PMS" 09 "GET" ${A1PMS_API_PREFIX}${query} ${status}
+ __log_test_pass
+ return 0
+}
+
#########################################################
#### Test case functions Health check
#########################################################
return 1
fi
- __collect_endpoint_stats "A1PMS" 10 "GET" ${A1PMS_API_PREFIX}${query} ${status}
+ __collect_endpoint_stats "A1PMS" 10 "GET" $A1PMS_API_PREFIX$query $status
__log_test_pass
return 0
}
#### Test case functions RIC Repository
#########################################################
-# API Test function: GET /ric and V2 GET /v2/rics/ric
+# API Test function: GET /ric, V2 GET /v2/rics/ric, and V3 GET a1policymanagement/v1/rics/ric
# args: <reponse-code> <management-element-id> [<ric-id>]
# (V2) args: <reponse-code> <management-element-id>|NOME <ric-id>|<NORIC> [<string-of-ricinfo>]
# (V2) example of <string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4"
return 1
fi
+ targetJson=$(<./tmp/.tmp_rics.json)
+ targetJson=${targetJson:1:${#targetJson}-2} #remove array brackets
+ echo " TARGET JSON: $targetJson" >>$HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+ if [ $res -ne 0 ]; then
+ __log_test_fail_body
+ return 1
+ fi
+ fi
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ if [ $# -lt 3 ]; then
+ __print_err "<reponseCode> <managementElementId>|NOME <ricId>|<NORIC> [stringOfRicInfo>]" $@
+ return 1
+ fi
+ search=""
+ if [ $2 != "NOME" ]; then
+ search="?managedElementId="$2
+ fi
+ if [ $3 != "NORIC" ]; then
+ if [ -z $search ]; then
+ search="?ricId="$3
+ else
+ search=$search"&ricId="$3
+ fi
+ fi
+ query="/v1/rics/ric"$search
+
+ res="$(__do_curl_to_api A1PMS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ __log_test_fail_status_code $1 $status
+ return 1
+ fi
+
+ if [ $# -gt 3 ]; then
+ body=${res:0:${#res}-3}
+ res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "${A1PMS_VERSION}" "$4")
+ if [ $res -ne 0 ]; then
+ __log_test_fail_general "Could not create target ric info json"
+ return 1
+ fi
+
targetJson=$(<./tmp/.tmp_rics.json)
targetJson=${targetJson:1:${#targetJson}-2} #remove array brackets
echo " TARGET JSON: $targetJson" >>$HTTPLOG
fi
else
if [ $# -lt 2 ] || [ $# -gt 3 ]; then
- __print_err "<reponse-code> <management-element-id> [<ric-id>]" $@
+ __print_err "<reponseCode> <managedElementIds> [<ricId>]" $@
return 1
fi
fi
fi
- __collect_endpoint_stats "A1PMS" 11 "GET" $A1PMS_API_PREFIX"/v2/rics/ric" $status
+ __collect_endpoint_stats "A1PMS" 11 "GET" ${A1PMS_API_PREFIX}${query} ${status}
__log_test_pass
return 0
}
-# API test function: GET /rics and V2 GET /v2/rics
+# API test function: GET /rics, V2 GET /v2/rics, and V3 GET /a1policymanagement/v1/rics
# args: <reponse-code> <policy-type-id>|NOTYPE [<space-separate-string-of-ricinfo>]
# example of <space-separate-string-of-ricinfo> = "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1,2,4 ricsim_g1_1:me2_........."
# format of ric-info: <ric-id>:<list-of-mes>:<list-of-policy-type-ids>
if [ $2 != "NOTYPE" ]; then
query="/v2/rics?policytype_id="$2
fi
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ query="/v1/rics"
+ if [ $2 != "NOTYPE" ]; then
+ query=${query}"?policyTypeId="$2
+ fi
else
query="/rics"
if [ $2 != "NOTYPE" ]; then
if [ $# -gt 2 ]; then
body=${res:0:${#res}-3}
- if [ "$A1PMS_VERSION" == "V2" ]; then
- res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V2" "$3")
- else
- res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "V1" "$3")
- fi
+ res=$(python3 ../common/create_rics_json.py "./tmp/.tmp_rics.json" "${A1PMS_VERSION}" "$3")
if [ $res -ne 0 ]; then
__log_test_fail_general "Could not create target ric info json"
return 1
fi
targetJson=$(<./tmp/.tmp_rics.json)
- if [ "$A1PMS_VERSION" == "V2" ]; then
+ if [ "$A1PMS_VERSION" == "V2" ] || [ "$A1PMS_VERSION" == "V3" ]; then
targetJson="{\"rics\": $targetJson }"
fi
echo "TARGET JSON: $targetJson" >>$HTTPLOG
fi
fi
- __collect_endpoint_stats "A1PMS" 12 "GET" $A1PMS_API_PREFIX"/v2/rics" $status
+ __collect_endpoint_stats "A1PMS" 12 "GET" ${A1PMS_API_PREFIX}${query} ${status}
__log_test_pass
return 0
}
#### 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() {
return 1
fi
- __collect_endpoint_stats "A1PMS" 13 "PUT" ${A1PMS_API_PREFIX}${query} ${status}
+ __collect_endpoint_stats "A1PMS" 13 "PUT" $A1PMS_API_PREFIX$query $status
__log_test_pass
return 0
}
-# API test function: GET /services and V2 GET /v2/services
+# API test function: GET /services, V2 GET /v2/services and V3 /a1policymanagement/v1/services
#args: <response-code> [ (<query-service-name> <target-service-name> <keepalive-timeout> <callbackurl>) | (NOSERVICE <target-service-name> <keepalive-timeout> <callbackurl> [<target-service-name> <keepalive-timeout> <callbackurl>]* )]
# (Function for test scripts)
a1pms_api_get_services() {
if [ "$A1PMS_VERSION" == "V2" ]; then
query="/v2/services"
-
if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then
query="/v2/services?service_id="$2
fi
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ query="/v1/services"
+ if [ $# -gt 1 ] && [ $2 != "NOSERVICE" ]; then
+ query="/v1/services?serviceId="$2
+ fi
else
query="/services"
# timeSinceLastActivitySeconds value cannot be checked since value varies
if [ "$A1PMS_VERSION" == "V2" ]; then
targetJson=$targetJson"{\"service_id\": \""$servicename"\",\"keep_alive_interval_seconds\": "$timeout",\"time_since_last_activity_seconds\":\"????\",\"callback_url\": \""$callback"\"}"
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ targetJson=$targetJson"{\"serviceId\": \""$servicename"\",\"keepAliveIntervalSeconds\": "$timeout",\"timeSinceLastActivitySeconds\":\"????\",\"callbackUrl\": \""$callback"\"}"
else
targetJson=$targetJson"{\"serviceName\": \""$servicename"\",\"keepAliveIntervalSeconds\": "$timeout",\"timeSinceLastActivitySeconds\":\"????\",\"callbackUrl\": \""$callback"\"}"
fi
targetJson=$targetJson"]"
if [ "$A1PMS_VERSION" == "V2" ]; then
targetJson="{\"service_list\": $targetJson }"
+ URL_for_Collect_End_Point="/v2/services"
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ targetJson="{\"serviceList\": $targetJson }"
+ URL_for_Collect_End_Point="/v1/services"
fi
echo "TARGET JSON: $targetJson" >>$HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
fi
fi
- __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX"/v2/services" $status
+ __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX$URL_for_Collect_End_Point $status
__log_test_pass
return 0
}
-# API test function: GET /services V2 GET /v2/services - (only checking service names)
+# API test function: GET /services, V2 GET /v2/services and V3 /a1policymanagement/v1/services - (only checking service names)
# args: <response-code> [<service-name>]*"
# (Function for test scripts)
a1pms_api_get_service_ids() {
if [ "$A1PMS_VERSION" == "V2" ]; then
query="/v2/services"
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ query="/v1/services"
else
query="/services"
fi
fi
if [ "$A1PMS_VERSION" == "V2" ]; then
targetJson=$targetJson"{\"callback_url\":\"????\",\"keep_alive_interval_seconds\":\"????\",\"service_id\":\""$rapp"\",\"time_since_last_activity_seconds\":\"????\"}"
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ targetJson=$targetJson"{\"callbackUrl\":\"????\",\"keepAliveIntervalSeconds\":\"????\",\"serviceId\":\""$rapp"\",\"timeSinceLastActivitySeconds\":\"????\"}"
else
targetJson=$targetJson"{\"callbackUrl\":\"????\",\"keepAliveIntervalSeconds\":\"????\",\"serviceName\":\""$rapp"\",\"timeSinceLastActivitySeconds\":\"????\"}"
fi
targetJson=$targetJson"]"
if [ "$A1PMS_VERSION" == "V2" ]; then
targetJson="{\"service_list\": $targetJson }"
+ URL_for_Collect_End_Point="/v2/services"
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ targetJson="{\"serviceList\": $targetJson }"
+ URL_for_Collect_End_Point="/v1/services"
fi
echo "TARGET JSON: $targetJson" >>$HTTPLOG
res=$(python3 ../common/compare_json.py "$targetJson" "$body")
return 1
fi
- __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX"/v2/services" $status
+ __collect_endpoint_stats "A1PMS" 14 "GET" $A1PMS_API_PREFIX$URL_for_Collect_End_Point $status
__log_test_pass
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() {
return 1
fi
if [ "$A1PMS_VERSION" == "V2" ]; then
- query="/v2/services/"$2
+ url_part="/v2/services/"
+ query=${url_part}${2}
+ elif [ "$A1PMS_VERSION" == "V3" ]; then
+ url_part="/v1/services/"
+ query=${url_part}${2}
else
query="/services?name="$2
fi
return 1
fi
- __collect_endpoint_stats "A1PMS" 15 "DELETE" $A1PMS_API_PREFIX"/v2/services/{serviceId}" $status
+ __collect_endpoint_stats "A1PMS" 15 "DELETE" ${A1PMS_API_PREFIX}${url_part}"{serviceId}" $status
__log_test_pass
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() {
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
}
#### 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() {
return 1
fi
- __collect_endpoint_stats "A1PMS" 17 "PUT" ${A1PMS_API_PREFIX}${query} ${status}
+ __collect_endpoint_stats "A1PMS" 17 "PUT" $A1PMS_API_PREFIX$query $status
__log_test_pass
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() {
__log_test_start $@
- if [ "$A1PMS_VERSION" != "V2" ]; then
+ if [ "$A1PMS_VERSION" != "V2" ] && [ "$A1PMS_VERSION" != "V3" ]; then
__log_test_fail_not_supported
return 1
fi
return 1
fi
- query="/v2/configuration"
+ if [ "$A1PMS_VERSION" == "V3" ]; then
+ #The V3 of a1-pms URL is a1policymanagement/v1 and the v2 is a1-policy/v2
+ query="/v1/configuration"
+ else
+ query="/v2/configuration"
+ fi
res="$(__do_curl_to_api A1PMS GET $query)"
status=${res:${#res}-3}
fi
fi
- __collect_endpoint_stats "A1PMS" 18 "GET" $A1PMS_API_PREFIX"/v2/configuration" $status
+ if [ "$A1PMS_VERSION" == "V3" ]; then
+ __collect_endpoint_stats "A1PMS" 18 "GET" $A1PMS_API_PREFIX"/v1/configuration" $status
+ else
+ __collect_endpoint_stats "A1PMS" 18 "GET" $A1PMS_API_PREFIX"/v2/configuration" $status
+ fi
__log_test_pass
return 0
}