aboutsummaryrefslogtreecommitdiffstats
path: root/csit/resources/tests/api-test.robot
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-09-26 14:16:09 +0100
committeradheli.tavares <adheli.tavares@est.tech>2024-09-27 09:36:18 +0100
commita3d2dc6ac57903b4fd970043732159a59f1cb2ae (patch)
tree91d07d6a0c02e587df94159531f31ce5582ec4fa /csit/resources/tests/api-test.robot
parentc4497b791b8d60137a07d0639437e78d9e158bf0 (diff)
Add extra test cases for drools-pdp
- fix some references on robot files - drools policy execution not completing because of issues with AppcLcm simulator - uncommenting the executions - dcae_topic having topic name and effective topic now are the same Issue-ID: POLICY-4955 Change-Id: Ia45730c6ba2b473acfc5b317424a0a46b3660485 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'csit/resources/tests/api-test.robot')
-rw-r--r--csit/resources/tests/api-test.robot183
1 files changed, 91 insertions, 92 deletions
diff --git a/csit/resources/tests/api-test.robot b/csit/resources/tests/api-test.robot
index 3554bb15..29c2fba4 100644
--- a/csit/resources/tests/api-test.robot
+++ b/csit/resources/tests/api-test.robot
@@ -3,106 +3,106 @@ Library Collections
Library RequestsLibrary
Library OperatingSystem
Library json
-Resource ${CURDIR}/common-library.robot
+Resource common-library.robot
*** Test Cases ***
Healthcheck
- [Documentation] Verify policy api health check
- ${resp}= GetReq /policy/api/v1/healthcheck
- Should Be Equal As Strings ${resp.json()['code']} 200
- Should Be Equal As Strings ${resp.json()['healthy']} True
- Should Be Equal As Strings ${resp.json()['message']} alive
+ [Documentation] Verify policy api health check
+ ${resp}= GetReq /policy/api/v1/healthcheck
+ Should Be Equal As Strings ${resp.json()['code']} 200
+ Should Be Equal As Strings ${resp.json()['healthy']} True
+ Should Be Equal As Strings ${resp.json()['message']} alive
RetrievePolicyTypes
- [Documentation] Retrieve all policy types
- FetchPolicyTypes /policy/api/v1/policytypes 37
+ [Documentation] Retrieve all policy types
+ FetchPolicyTypes /policy/api/v1/policytypes 37
CreateTCAPolicyTypeV1
- [Documentation] Create an existing policy type with modification and keeping the same version should result in error.
- CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v1.json null null
+ [Documentation] Create an existing policy type with modification and keeping the same version should result in error.
+ CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v1.json null null
CreateTCAPolicyTypeV2
- [Documentation] Create an existing policy type with modification and keeping the same version should result in error.
- CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v2.json null null
+ [Documentation] Create an existing policy type with modification and keeping the same version should result in error.
+ CreatePolicyType /policy/api/v1/policytypes 406 onap.policy.monitoring.tcagen2.v2.json null null
CreateTCAPolicyTypeV3
- [Documentation] Create a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0'
- CreatePolicyType /policy/api/v1/policytypes 201 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0
+ [Documentation] Create a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0'
+ CreatePolicyType /policy/api/v1/policytypes 201 onap.policy.monitoring.tcagen2.v3.json onap.policies.monitoring.tcagen2 3.0.0
RetrieveMonitoringPolicyTypes
- [Documentation] Retrieve all monitoring related policy types
- FetchPolicyTypes /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2 2
+ [Documentation] Retrieve all monitoring related policy types
+ FetchPolicyTypes /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2 2
CreateNewMonitoringPolicyV1
- [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api
- ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json
- CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies ${postjson} onap.restart.tca 1.0.0
+ [Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api
+ ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.json
+ CreatePolicySuccessfully /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies ${postjson} onap.restart.tca 1.0.0
CreateNewMonitoringPolicyV1Again
- [Documentation] Create an existing policy with modification and keeping the same version should result in error.
- ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v1_2.json
- CreatePolicy /policy/api/v1/policies 406 ${postjson} null null
+ [Documentation] Create an existing policy with modification and keeping the same version should result in error.
+ ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v1_2.json
+ CreatePolicy /policy/api/v1/policies 406 ${postjson} null null
CreateNewMonitoringPolicyV2
- [Documentation] Create a policy named 'onap.restart.tca' and version '2.0.0' using generic api
- ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json
- CreatePolicySuccessfully /policy/api/v1/policies ${postjson} onap.restart.tca 2.0.0
+ [Documentation] Create a policy named 'onap.restart.tca' and version '2.0.0' using generic api
+ ${postjson}= Get file ${DATA}/vCPE.policy.monitoring.input.tosca.v2.json
+ CreatePolicySuccessfully /policy/api/v1/policies ${postjson} onap.restart.tca 2.0.0
CreateNodeTemplates
- [Documentation] Create node templates in database using specific api
- ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json
- CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3
+ [Documentation] Create node templates in database using specific api
+ ${postjson}= Get file ${NODETEMPLATES}/nodetemplates.metadatasets.input.tosca.json
+ CreateNodeTemplate /policy/api/v1/nodetemplates 201 ${postjson} 3
RetrievePoliciesOfType
- [Documentation] Retrieve all policies belonging to a specific Policy Type
- FetchPolicies /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 2
+ [Documentation] Retrieve all policies belonging to a specific Policy Type
+ FetchPolicies /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 2
RetrieveAllPolicies
- [Documentation] Retrieve all policies
- FetchPolicies /policy/api/v1/policies 3
+ [Documentation] Retrieve all policies
+ FetchPolicies /policy/api/v1/policies 3
RetrieveSpecificPolicy
- [Documentation] Retrieve a policy named 'onap.restart.tca' and version '1.0.0' using generic api
- FetchPolicy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 onap.restart.tca
+ [Documentation] Retrieve a policy named 'onap.restart.tca' and version '1.0.0' using generic api
+ FetchPolicy /policy/api/v1/policies/onap.restart.tca/versions/1.0.0 onap.restart.tca
RetrieveAllNodeTemplates
- [Documentation] Retrieve all node templates
- FetchNodeTemplates /policy/api/v1/nodetemplates 3
+ [Documentation] Retrieve all node templates
+ FetchNodeTemplates /policy/api/v1/nodetemplates 3
RetrieveSpecificNodeTemplate
- [Documentation] Retrieve a node template named 'apexMetadata_grpc' and version '1.2.1' using generic api
- FetchNodeTemplate /policy/api/v1/nodetemplates/apexMetadata_grpc/versions/1.2.1 apexMetadata_grpc
+ [Documentation] Retrieve a node template named 'apexMetadata_grpc' and version '1.2.1' using generic api
+ FetchNodeTemplate /policy/api/v1/nodetemplates/apexMetadata_grpc/versions/1.2.1 apexMetadata_grpc
DeleteSpecificNodeTemplate
- [Documentation] Delete a node template named 'apexMetadata_adaptive' and version '2.3.1' using generic api
- DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 200
- DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 404
+ [Documentation] Delete a node template named 'apexMetadata_adaptive' and version '2.3.1' using generic api
+ DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 200
+ DeleteReq /policy/api/v1/nodetemplates/apexMetadata_adaptive/versions/2.3.1 404
DeleteSpecificPolicy
- [Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api
- 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
+ [Documentation] Delete a policy named 'onap.restart.tca' and version '1.0.0' using generic api
+ 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
- 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
+ [Documentation] Delete a policy named 'onap.restart.tca' and version '2.0.0' using specific api
+ 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'
- 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
+ [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '1.0.0'
+ 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'
- 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
+ [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '2.0.0'
+ 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
DeleteSpecificPolicyTypeV3
- [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0'
- DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 200
- DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 404
+ [Documentation] Delete a policy type named 'onap.policies.monitoring.tcagen2' and version '3.0.0'
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 200
+ DeleteReq /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/3.0.0 404
Metrics
[Documentation] Verify policy-api is exporting prometheus metrics
@@ -128,53 +128,52 @@ Metrics
*** Keywords ***
GetReq
- [Arguments] ${url}
- ${auth}= PolicyAdminAuth
- ${resp}= PerformGetRequest ${POLICY_API_IP} ${url} 200 null ${auth}
- RETURN ${resp}
+ [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}
+ [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}
- ${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}
+ [Arguments] ${url} ${expectedstatus} ${jsonfile} ${policytypename} ${policytypeversion}
+ [Documentation] Create the specific policy type
+ ${postjson}= Get file ${CURDIR}/data/${jsonfile}
+ ${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}= GetReq ${url}
- Length Should Be ${resp.json()['policy_types']} ${expectedLength}
+ [Arguments] ${url} ${expectedLength}
+ [Documentation] Fetch all policy types
+ ${resp}= GetReq ${url}
+ Length Should Be ${resp.json()['policy_types']} ${expectedLength}
FetchPolicy
- [Arguments] ${url} ${keyword}
- [Documentation] Fetch the specific policy
- ${resp}= GetReq ${url}
- Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword}
+ [Arguments] ${url} ${keyword}
+ [Documentation] Fetch the specific policy
+ ${resp}= GetReq ${url}
+ Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${keyword}
FetchPolicies
- [Arguments] ${url} ${expectedLength}
- [Documentation] Fetch all policies
- ${resp}= GetReq ${url}
- Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength}
-
+ [Arguments] ${url} ${expectedLength}
+ [Documentation] Fetch all policies
+ ${resp}= GetReq ${url}
+ Length Should Be ${resp.json()['topology_template']['policies']} ${expectedLength}
FetchNodeTemplates
- [Arguments] ${url} ${expectedLength}
- [Documentation] Fetch all node templates
- ${resp}= GetReq ${url}
- Length Should Be ${resp.json()} ${expectedLength}
+ [Arguments] ${url} ${expectedLength}
+ [Documentation] Fetch all node templates
+ ${resp}= GetReq ${url}
+ Length Should Be ${resp.json()} ${expectedLength}
FetchNodeTemplate
- [Arguments] ${url} ${keyword}
- [Documentation] Fetch the specific node template
- ${resp}= GetReq ${url}
- Dictionary Should Contain Value ${resp.json()[0]} ${keyword}
+ [Arguments] ${url} ${keyword}
+ [Documentation] Fetch the specific node template
+ ${resp}= GetReq ${url}
+ Dictionary Should Contain Value ${resp.json()[0]} ${keyword}