aboutsummaryrefslogtreecommitdiffstats
path: root/csit/api
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2021-11-01 10:40:32 +0000
committeradheli.tavares <adheli.tavares@est.tech>2021-11-05 19:18:24 +0000
commit496b301c101f2a21e8408048dc0fd57c59a12d92 (patch)
treecc4761ab8dbe6c29caefd08391a2e06341fe29dd /csit/api
parent6db3db236b6987af30a6fdb12ae6f9ea017c3856 (diff)
Rename username for API and PAP operations.
Use an account other than healthcheck in API and PAP for provisioning of policies. Issue-ID: POLICY-2744 Change-Id: Id2cbba8e5e5095996622572fbf42383bb854fb43 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'csit/api')
-rw-r--r--csit/api/tests/api-test.robot43
1 files changed, 28 insertions, 15 deletions
diff --git a/csit/api/tests/api-test.robot b/csit/api/tests/api-test.robot
index 1f94c9ce..892bf0e4 100644
--- a/csit/api/tests/api-test.robot
+++ b/csit/api/tests/api-test.robot
@@ -9,17 +9,17 @@ Resource ${CURDIR}/../../common-library.robot
Healthcheck
[Documentation] Verify policy api health check
- ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/healthcheck 200 null
+ ${resp}= GetReq /policy/api/v1/healthcheck
Should Be Equal As Strings ${resp.json()['code']} 200
Metrics
[Documentation] Verify policy-api is exporting prometheus metrics
- ${resp}= PerformGetRequest ${POLICY_API_IP} /metrics 200 null
+ ${resp}= GetReq /metrics
Should Contain ${resp.text} jvm_threads_current
Statistics
[Documentation] Verify policy api statistics
- ${resp}= PerformGetRequest ${POLICY_API_IP} /policy/api/v1/statistics 200 null
+ ${resp}= GetReq /policy/api/v1/statistics
Should Be Equal As Strings ${resp.json()['code']} 200
RetrievePolicyTypes
@@ -67,48 +67,61 @@ RetrieveSpecificPolicy
DeleteSpecificPolicy
[Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 200
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 404
+ DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 200
+ DeleteReq /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 404
DeleteSpecificPolicyV2
[Documentation] Delete a policy named 'onap.restart.tca' and version '2.0.0' using specific api
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 200
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 404
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 200
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies/onap.restart.tca/versions/2.0.0 404
DeleteSpecificPolicyTypeV1
[Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '1.0.0'
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 200
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 404
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 200
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0 404
DeleteSpecificPolicyTypeV2
[Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '2.0.0'
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 200
- PerformDeleteRequest ${POLICY_API_IP} /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 404
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 200
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/2.0.0 404
*** Keywords ***
+GetReq
+ [Arguments] ${url}
+ ${auth}= PolicyAdminAuth
+ ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth}
+ [return] ${resp}
+
+DeleteReq
+ [Arguments] ${url} ${expectedstatus}
+ ${auth}= PolicyAdminAuth
+ ${resp}= PerformDeleteRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${auth}
+ [return] ${resp}
+
CreatePolicyType
[Arguments] ${url} ${expectedstatus} ${jsonfile} ${policytypename} ${policytypeversion}
[Documentation] Create the specific policy type
${postjson}= Get file ${CURDIR}/data/${jsonfile}
- ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null
+ ${auth}= PolicyAdminAuth
+ ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${auth}
Run Keyword If ${expectedstatus}==200 List Should Contain Value ${resp.json()['policy_types']} ${policytypename}
Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['policy_types']['${policytypename}']['version']} ${policytypeversion}
FetchPolicyTypes
[Arguments] ${url} ${expectedLength}
[Documentation] Fetch all policy types
- ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null
+ ${resp}= GetReq ${url}
Length Should Be ${resp.json()['policy_types']} ${expectedLength}
FetchPolicy
[Arguments] ${url} ${keyword}
[Documentation] Fetch the specific policy
- ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null
+ ${resp}= GetReq ${url}
Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword}
FetchPolicies
[Arguments] ${url} ${expectedLength}
[Documentation] Fetch all policies
- ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null
+ ${resp}= GetReq ${url}
Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength}