summaryrefslogtreecommitdiffstats
path: root/csit
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
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')
-rw-r--r--csit/apex-pdp/tests/apex-pdp-test.robot13
-rw-r--r--csit/api/tests/api-test.robot43
-rw-r--r--csit/common-library.robot116
-rw-r--r--csit/config/distribution/defaultConfig.json4
-rw-r--r--csit/config/pap/defaultConfig.json4
-rw-r--r--csit/config/xacml-pdp/defaultConfig.json2
-rw-r--r--csit/distribution/tests/distribution-test.robot19
-rw-r--r--csit/drools-applications/tests/drools-applications-test.robot6
-rw-r--r--csit/pap/tests/pap-test.robot33
-rw-r--r--csit/xacml-pdp/tests/xacml-pdp-test.robot194
10 files changed, 244 insertions, 190 deletions
diff --git a/csit/apex-pdp/tests/apex-pdp-test.robot b/csit/apex-pdp/tests/apex-pdp-test.robot
index 380b3779..911a4371 100644
--- a/csit/apex-pdp/tests/apex-pdp-test.robot
+++ b/csit/apex-pdp/tests/apex-pdp-test.robot
@@ -11,13 +11,15 @@ Resource ${CURDIR}/../../common-library.robot
Healthcheck
[Documentation] Runs Apex PDP Health check
- ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null
+ ${hcauth}= HealthCheckAuth
+ ${resp}= PerformGetRequest ${APEX_IP} /policy/apex-pdp/v1/healthcheck 200 null ${hcauth}
Should Be Equal As Strings ${resp.json()['code']} 200
Set Suite Variable ${pdpName} ${resp.json()['name']}
Metrics
[Documentation] Verify policy-apex-pdp is exporting prometheus metrics
- ${resp}= PerformGetRequest ${APEX_IP} /metrics 200 null
+ ${hcauth}= HealthCheckAuth
+ ${resp}= PerformGetRequest ${APEX_IP} /metrics 200 null ${hcauth}
Should Contain ${resp.text} jvm_threads_current
ExecuteApexSampleDomainPolicy
@@ -53,14 +55,14 @@ ExecuteApexTestVnfPolicy
*** Keywords ***
-
DeployPolicy
[Documentation] Deploy the policy in apex-pdp engine
${postjson}= Get file ${CURDIR}/data/policy_deploy.json
${postjson}= evaluate json.loads('''${postjson}''') json
set to dictionary ${postjson['groups'][0]['deploymentSubgroups'][0]['policies'][0]} name=${policyName}
${postjson}= evaluate json.dumps(${postjson}) json
- PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null
+ ${policyadmin}= PolicyAdminAuth
+ PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${policyadmin}
RunEventOnApexEngine
[Documentation] Send event to verify policy execution
@@ -104,7 +106,8 @@ CheckLogMessage
VerifyPdpStatistics
[Documentation] Verify pdp statistics after policy execution
[Arguments] ${deployCount} ${deploySuccessCount} ${executedCount} ${executedSuccessCount}
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/statistics/defaultGroup/apex/${pdpName} 200 null
+ ${policyadmin}= PolicyAdminAuth
+ ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/statistics/defaultGroup/apex/${pdpName} 200 null ${policyadmin}
Should Be Equal As Strings ${resp.status_code} 200
Should Be Equal As Strings ${resp.json()['defaultGroup']['apex'][0]['pdpInstanceId']} ${pdpName}
Should Be Equal As Strings ${resp.json()['defaultGroup']['apex'][0]['pdpGroupName']} defaultGroup
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}
diff --git a/csit/common-library.robot b/csit/common-library.robot
index 639d32a8..830d0f63 100644
--- a/csit/common-library.robot
+++ b/csit/common-library.robot
@@ -4,59 +4,18 @@ Library RequestsLibrary
Library OperatingSystem
Library json
-
*** Keywords ***
-CreatePolicy
- [Arguments] ${url} ${expectedstatus} ${postjson} ${policyname} ${policyversion}
- [Documentation] Create the specific policy
- ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null
- Run Keyword If ${expectedstatus}==200 Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname}
- Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion}
+PolicyAdminAuth
+ ${policyadmin}= Create list policyadmin zb!XztG34
+ [return] ${policyadmin}
-QueryPdpGroups
- [Documentation] Verify pdp group query - supports upto 2 groups
- [Arguments] ${groupsLength} ${group1Name} ${group1State} ${policiesLengthInGroup1} ${group2Name} ${group2State} ${policiesLengthInGroup2}
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps 200 null
- Length Should Be ${resp.json()['groups']} ${groupsLength}
- Should Be Equal As Strings ${resp.json()['groups'][0]['name']} ${group1Name}
- Should Be Equal As Strings ${resp.json()['groups'][0]['pdpGroupState']} ${group1State}
- Length Should Be ${resp.json()['groups'][0]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup1}
- Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} ${group2Name}
- Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ${group2State}
- Run Keyword If ${groupsLength}>1 Length Should Be ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup2}
-
-QueryPolicyAudit
- [Arguments] ${url} ${expectedstatus} ${pdpGroup} ${pdpType} ${policyName} ${expectedAction}
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} ${expectedstatus} recordCount=1
- Should Be Equal As Strings ${resp.json()[0]['pdpGroup']} ${pdpGroup}
- Should Be Equal As Strings ${resp.json()[0]['pdpType']} ${pdpType}
- Should Be Equal As Strings ${resp.json()[0]['policy']['name']} ${policyName}
- Should Be Equal As Strings ${resp.json()[0]['policy']['version']} 1.0.0
- Should Be Equal As Strings ${resp.json()[0]['action']} ${expectedAction}
- Should Be Equal As Strings ${resp.json()[0]['user']} healthcheck
-
-QueryPolicyStatus
- [Documentation] Verify policy deployment status
- [Arguments] ${policyName} ${pdpGroup} ${pdpType} ${pdpName} ${policyTypeName}
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/policies/status 200 null
- FOR ${responseEntry} IN @{resp.json()}
- Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}'
- END
- Should Be Equal As Strings ${resp.status_code} 200
- Should Be Equal As Strings ${responseEntry['pdpGroup']} ${pdpGroup}
- Should Be Equal As Strings ${responseEntry['pdpType']} ${pdpType}
- Should Be Equal As Strings ${responseEntry['pdpId']} ${pdpName}
- Should Be Equal As Strings ${responseEntry['policy']['name']} ${policyName}
- Should Be Equal As Strings ${responseEntry['policy']['version']} 1.0.0
- Should Be Equal As Strings ${responseEntry['policyType']['name']} ${policyTypeName}
- Should Be Equal As Strings ${responseEntry['policyType']['version']} 1.0.0
- Should Be Equal As Strings ${responseEntry['deploy']} True
- Should Be Equal As Strings ${responseEntry['state']} SUCCESS
+HealthCheckAuth
+ ${healthcheck}= Create list healthcheck zb!XztG34
+ [return] ${healthcheck}
PerformPostRequest
- [Arguments] ${hostname} ${url} ${expectedstatus} ${postjson} ${params}
- ${auth}= Create List healthcheck zb!XztG34
+ [Arguments] ${hostname} ${url} ${expectedstatus} ${postjson} ${params} ${auth}
Log Creating session https://${hostname}:6969
${session}= Create Session policy https://${hostname}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
@@ -65,8 +24,7 @@ PerformPostRequest
[return] ${resp}
PerformPutRequest
- [Arguments] ${hostname} ${url} ${expectedstatus} ${params}
- ${auth}= Create List healthcheck zb!XztG34
+ [Arguments] ${hostname} ${url} ${expectedstatus} ${params} ${auth}
Log Creating session https://${hostname}:6969
${session}= Create Session policy https://${hostname}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
@@ -75,8 +33,7 @@ PerformPutRequest
[return] ${resp}
PerformGetRequest
- [Arguments] ${hostname} ${url} ${expectedstatus} ${params}
- ${auth}= Create List healthcheck zb!XztG34
+ [Arguments] ${hostname} ${url} ${expectedstatus} ${params} ${auth}
Log Creating session https://${hostname}:6969
${session}= Create Session policy https://${hostname}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
@@ -85,10 +42,61 @@ PerformGetRequest
[return] ${resp}
PerformDeleteRequest
- [Arguments] ${hostname} ${url} ${expectedstatus}
- ${auth}= Create List healthcheck zb!XztG34
+ [Arguments] ${hostname} ${url} ${expectedstatus} ${auth}
Log Creating session https://${hostname}:6969
${session}= Create Session policy https://${hostname}:6969 auth=${auth}
${headers}= Create Dictionary Accept=application/json Content-Type=application/json
${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=${expectedstatus}
Log Received response from policy ${resp.text}
+
+CreatePolicy
+ [Arguments] ${url} ${expectedstatus} ${postjson} ${policyname} ${policyversion}
+ [Documentation] Create the specific policy
+ ${policyadmin}= PolicyAdminAuth
+ ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${policyadmin}
+ Run Keyword If ${expectedstatus}==200 Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname}
+ Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion}
+
+QueryPdpGroups
+ [Documentation] Verify pdp group query - supports upto 2 groups
+ [Arguments] ${groupsLength} ${group1Name} ${group1State} ${policiesLengthInGroup1} ${group2Name} ${group2State} ${policiesLengthInGroup2}
+ ${policyadmin}= PolicyAdminAuth
+ ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps 200 null ${policyadmin}
+ Length Should Be ${resp.json()['groups']} ${groupsLength}
+ Should Be Equal As Strings ${resp.json()['groups'][0]['name']} ${group1Name}
+ Should Be Equal As Strings ${resp.json()['groups'][0]['pdpGroupState']} ${group1State}
+ Length Should Be ${resp.json()['groups'][0]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup1}
+ Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} ${group2Name}
+ Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ${group2State}
+ Run Keyword If ${groupsLength}>1 Length Should Be ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup2}
+
+QueryPolicyAudit
+ [Arguments] ${url} ${expectedstatus} ${pdpGroup} ${pdpType} ${policyName} ${expectedAction}
+ ${policyadmin}= PolicyAdminAuth
+ ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} ${expectedstatus} recordCount=1 ${policyadmin}
+ Should Be Equal As Strings ${resp.json()[0]['pdpGroup']} ${pdpGroup}
+ Should Be Equal As Strings ${resp.json()[0]['pdpType']} ${pdpType}
+ Should Be Equal As Strings ${resp.json()[0]['policy']['name']} ${policyName}
+ Should Be Equal As Strings ${resp.json()[0]['policy']['version']} 1.0.0
+ Should Be Equal As Strings ${resp.json()[0]['action']} ${expectedAction}
+ Should Be Equal As Strings ${resp.json()[0]['user']} policyadmin
+
+QueryPolicyStatus
+ [Documentation] Verify policy deployment status
+ [Arguments] ${policyName} ${pdpGroup} ${pdpType} ${pdpName} ${policyTypeName}
+ ${policyadmin}= PolicyAdminAuth
+ ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/policies/status 200 null ${policyadmin}
+ FOR ${responseEntry} IN @{resp.json()}
+ Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}'
+ END
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Be Equal As Strings ${responseEntry['pdpGroup']} ${pdpGroup}
+ Should Be Equal As Strings ${responseEntry['pdpType']} ${pdpType}
+ Should Be Equal As Strings ${responseEntry['pdpId']} ${pdpName}
+ Should Be Equal As Strings ${responseEntry['policy']['name']} ${policyName}
+ Should Be Equal As Strings ${responseEntry['policy']['version']} 1.0.0
+ Should Be Equal As Strings ${responseEntry['policyType']['name']} ${policyTypeName}
+ Should Be Equal As Strings ${responseEntry['policyType']['version']} 1.0.0
+ Should Be Equal As Strings ${responseEntry['deploy']} True
+ Should Be Equal As Strings ${responseEntry['state']} SUCCESS
+
diff --git a/csit/config/distribution/defaultConfig.json b/csit/config/distribution/defaultConfig.json
index ba1a682c..05640d92 100644
--- a/csit/config/distribution/defaultConfig.json
+++ b/csit/config/distribution/defaultConfig.json
@@ -57,7 +57,7 @@
"clientName": "policy-api",
"hostname": "policy-api",
"port": 6969,
- "userName": "healthcheck",
+ "userName": "policyadmin",
"password": "zb!XztG34",
"useHttps": true
},
@@ -65,7 +65,7 @@
"clientName": "policy-pap",
"hostname": "policy-pap",
"port": 6969,
- "userName": "healthcheck",
+ "userName": "policyadmin",
"password": "zb!XztG34",
"useHttps": true
},
diff --git a/csit/config/pap/defaultConfig.json b/csit/config/pap/defaultConfig.json
index b7c5b310..28595321 100644
--- a/csit/config/pap/defaultConfig.json
+++ b/csit/config/pap/defaultConfig.json
@@ -3,7 +3,7 @@
"restServerParameters": {
"host": "0.0.0.0",
"port": 6969,
- "userName": "healthcheck",
+ "userName": "policyadmin",
"password": "zb!XztG34",
"https": true,
"aaf": false,
@@ -62,7 +62,7 @@
"clientName": "api",
"hostname": "policy-api",
"port": 6969,
- "userName": "healthcheck",
+ "userName": "policyadmin",
"password": "zb!XztG34",
"useHttps": true,
"basePath": "policy/api/v1/healthcheck"
diff --git a/csit/config/xacml-pdp/defaultConfig.json b/csit/config/xacml-pdp/defaultConfig.json
index f6ee81a4..e2536ce1 100644
--- a/csit/config/xacml-pdp/defaultConfig.json
+++ b/csit/config/xacml-pdp/defaultConfig.json
@@ -14,7 +14,7 @@
"policyApiParameters": {
"hostname": "policy-api",
"port": 6969,
- "userName": "healthcheck",
+ "userName": "policyadmin",
"password": "zb!XztG34",
"useHttps": true,
"aaf": false
diff --git a/csit/distribution/tests/distribution-test.robot b/csit/distribution/tests/distribution-test.robot
index 2513a6ca..8bf4b84d 100644
--- a/csit/distribution/tests/distribution-test.robot
+++ b/csit/distribution/tests/distribution-test.robot
@@ -8,22 +8,25 @@ Resource ${CURDIR}/../../common-library.robot
*** Test Cases ***
Healthcheck
- [Documentation] Verify policy distribution health check
- ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /healthcheck 200 null
- Should Be Equal As Strings ${resp.json()['code']} 200
+ [Documentation] Verify policy distribution health check
+ ${hcauth}= HealthCheckAuth
+ ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /healthcheck 200 null ${hcauth}
+ Should Be Equal As Strings ${resp.json()['code']} 200
Statistics
- [Documentation] Verify policy distribution statistics
- ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /statistics 200 null
- Should Be Equal As Strings ${resp.json()['code']} 200
+ [Documentation] Verify policy distribution statistics
+ ${hcauth}= HealthCheckAuth
+ ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /statistics 200 null ${hcauth}
+ Should Be Equal As Strings ${resp.json()['code']} 200
Metrics
[Documentation] Verify policy-distribution is exporting prometheus metrics
- ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /metrics 200 null
+ ${hcauth}= HealthCheckAuth
+ ${resp}= PerformGetRequest ${POLICY_DISTRIBUTION_IP} /metrics 200 null ${hcauth}
Should Contain ${resp.text} jvm_threads_current
InvokeDistributionAndRunEventOnEngine
- Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine
+ Wait Until Keyword Succeeds 5 min 30 sec InvokeDistributionUsingFile And RunEventOnApexEngine
*** Keywords ***
diff --git a/csit/drools-applications/tests/drools-applications-test.robot b/csit/drools-applications/tests/drools-applications-test.robot
index 60bccfed..a908f79b 100644
--- a/csit/drools-applications/tests/drools-applications-test.robot
+++ b/csit/drools-applications/tests/drools-applications-test.robot
@@ -222,10 +222,10 @@ PeformGetRequest
PerformPostRequest
[Arguments] ${url} ${params} ${hostname} ${port} ${jsonfile} ${filepath} ${contenttype} ${expectedstatus}
- ${auth}= Create List healthcheck zb!XztG34
+ ${auth}= Create List policyadmin zb!XztG34
${postjson}= Get file ${filepath}/${jsonfile}
- Log Creating session https://${hostname}:6969
- ${session}= Create Session policy https://${hostname}:6969 auth=${auth}
+ Log Creating session https://${hostname}:${port}
+ ${session}= Create Session policy https://${hostname}:${port} auth=${auth}
${headers}= Create Dictionary Accept=application/${contenttype} Content-Type=application/${contenttype}
${resp}= POST On Session policy ${url} params=${params} data=${postjson} headers=${headers} expected_status=${expectedstatus}
Log Received response from policy ${resp.text}
diff --git a/csit/pap/tests/pap-test.robot b/csit/pap/tests/pap-test.robot
index b666eb50..9fb7e61f 100644
--- a/csit/pap/tests/pap-test.robot
+++ b/csit/pap/tests/pap-test.robot
@@ -5,6 +5,13 @@ Library OperatingSystem
Library json
Resource ${CURDIR}/../../common-library.robot
+*** Keywords ***
+GetReq
+ [Arguments] ${url}
+ ${auth}= PolicyAdminAuth
+ ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} 200 null ${auth}
+ [return] ${resp}
+
*** Test Cases ***
LoadPolicy
[Documentation] Create a policy named 'onap.restart.tca' and version '1.0.0' using specific api
@@ -13,28 +20,29 @@ LoadPolicy
Healthcheck
[Documentation] Verify policy pap health check
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/healthcheck 200 null
+ ${resp}= GetReq /policy/pap/v1/healthcheck
Should Be Equal As Strings ${resp.json()['code']} 200
Consolidated Healthcheck
[Documentation] Verify policy consolidated health check
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/components/healthcheck 200 null
+ ${resp}= GetReq /policy/pap/v1/components/healthcheck
Should Be Equal As Strings ${resp.json()['healthy']} True
Metrics
[Documentation] Verify policy pap is exporting prometheus metrics
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} /metrics 200 null
+ ${resp}= GetReq /metrics
Should Contain ${resp.text} jvm_threads_current
Statistics
[Documentation] Verify policy pap statistics
- ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/statistics 200 null
+ ${resp}= GetReq /policy/pap/v1/statistics
Should Be Equal As Strings ${resp.json()['code']} 200
AddPdpGroup
[Documentation] Add a new PdpGroup named 'testGroup' in the policy database
${postjson}= Get file ${CURDIR}/data/create.group.request.json
- PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/batch 200 ${postjson} null
+ ${auth}= PolicyAdminAuth
+ PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/batch 200 ${postjson} null ${auth}
QueryPdpGroupsBeforeActivation
[Documentation] Verify PdpGroups before activation
@@ -42,7 +50,8 @@ QueryPdpGroupsBeforeActivation
ActivatePdpGroup
[Documentation] Change the state of PdpGroup named 'testGroup' to ACTIVE
- PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=ACTIVE
+ ${auth}= PolicyAdminAuth
+ PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=ACTIVE ${auth}
QueryPdpGroupsAfterActivation
[Documentation] Verify PdpGroups after activation
@@ -51,7 +60,8 @@ QueryPdpGroupsAfterActivation
DeployPdpGroups
[Documentation] Deploy policies in PdpGroups
${postjson}= Get file ${CURDIR}/data/deploy.group.request.json
- PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null
+ ${auth}= PolicyAdminAuth
+ PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/deployments/batch 202 ${postjson} null ${auth}
QueryPdpGroupsAfterDeploy
[Documentation] Verify PdpGroups after undeploy
@@ -63,7 +73,8 @@ QueryPolicyAuditAfterDeploy
UndeployPolicy
[Documentation] Undeploy a policy named 'onap.restart.tca' from PdpGroups
- PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202
+ ${auth}= PolicyAdminAuth
+ PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${auth}
QueryPdpGroupsAfterUndeploy
[Documentation] Verify PdpGroups after undeploy
@@ -75,11 +86,13 @@ QueryPolicyAuditAfterUnDeploy
DeactivatePdpGroup
[Documentation] Change the state of PdpGroup named 'testGroup' to PASSIVE
- PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=PASSIVE
+ ${auth}= PolicyAdminAuth
+ PerformPutRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 state=PASSIVE ${auth}
DeletePdpGroups
[Documentation] Delete the PdpGroup named 'testGroup' from policy database
- PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200
+ ${auth}= PolicyAdminAuth
+ PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/groups/testGroup 200 ${auth}
QueryPdpGroupsAfterDelete
[Documentation] Verify PdpGroups after delete
diff --git a/csit/xacml-pdp/tests/xacml-pdp-test.robot b/csit/xacml-pdp/tests/xacml-pdp-test.robot
index c1bba0af..9b3df140 100644
--- a/csit/xacml-pdp/tests/xacml-pdp-test.robot
+++ b/csit/xacml-pdp/tests/xacml-pdp-test.robot
@@ -8,129 +8,143 @@ Resource ${CURDIR}/../../common-library.robot
*** Test Cases ***
Healthcheck
- [Documentation] Verify policy xacml-pdp health check
- ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/healthcheck 200 null
- Should Be Equal As Strings ${resp.json()['code']} 200
+ [Documentation] Verify policy xacml-pdp health check
+ ${resp}= PdpxGetReq /policy/pdpx/v1/healthcheck
+ Should Be Equal As Strings ${resp.json()['code']} 200
Statistics
- [Documentation] Verify policy xacml-pdp statistics
- ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null
- Should Be Equal As Strings ${resp.json()['code']} 200
+ [Documentation] Verify policy xacml-pdp statistics
+ ${resp}= PdpxGetReq /policy/pdpx/v1/statistics
+ Should Be Equal As Strings ${resp.json()['code']} 200
Metrics
[Documentation] Verify policy-xacml-pdp is exporting prometheus metrics
- ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /metrics 200 null
+ ${resp}= PdpxGetReq /metrics
Should Contain ${resp.text} jvm_threads_current
MakeTopics
- [Documentation] Creates the Policy topics
- ${result}= Run Process ${SCR_DMAAP}/make_topic.sh POLICY-PDP-PAP
- Should Be Equal As Integers ${result.rc} 0
+ [Documentation] Creates the Policy topics
+ ${result}= Run Process ${SCR_DMAAP}/make_topic.sh POLICY-PDP-PAP
+ Should Be Equal As Integers ${result.rc} 0
ExecuteXacmlPolicy
- CreateMonitorPolicy
- CreateOptimizationPolicy
- Wait Until Keyword Succeeds 1 min 15 sec GetDefaultDecision
- DeployPolicies
- Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDeployed
- Wait Until Keyword Succeeds 1 min 15 sec GetAbbreviatedDecisionResult
- Wait Until Keyword Succeeds 1 min 15 sec GetMonitoringDecision
- Wait Until Keyword Succeeds 1 min 15 sec GetNamingDecision
- Wait Until Keyword Succeeds 1 min 15 sec GetOptimizationDecision
- Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDecision
- UndeployMonitorPolicy
- Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterUndeploy
+ CreateMonitorPolicy
+ CreateOptimizationPolicy
+ Wait Until Keyword Succeeds 1 min 15 sec GetDefaultDecision
+ DeployPolicies
+ Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDeployed
+ Wait Until Keyword Succeeds 1 min 15 sec GetAbbreviatedDecisionResult
+ Wait Until Keyword Succeeds 1 min 15 sec GetMonitoringDecision
+ Wait Until Keyword Succeeds 1 min 15 sec GetNamingDecision
+ Wait Until Keyword Succeeds 1 min 15 sec GetOptimizationDecision
+ Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterDecision
+ UndeployMonitorPolicy
+ Wait Until Keyword Succeeds 1 min 15 sec GetStatisticsAfterUndeploy
*** Keywords ***
CreateMonitorPolicy
- [Documentation] Create a Monitoring policy
- ${postjson}= Get file ${DATA2}/vCPE.policy.monitoring.input.tosca.json
- CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0
+ [Documentation] Create a Monitoring policy
+ ${postjson}= Get file ${DATA2}/vCPE.policy.monitoring.input.tosca.json
+ CreatePolicy /policy/api/v1/policytypes/onap.policies.monitoring.tcagen2/versions/1.0.0/policies 200 ${postjson} onap.restart.tca 1.0.0
CreateOptimizationPolicy
- [Documentation] Create an Optimization policy
- ${postjson}= Get file ${DATA2}/vCPE.policies.optimization.input.tosca.json
- CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0
+ [Documentation] Create an Optimization policy
+ ${postjson}= Get file ${DATA2}/vCPE.policies.optimization.input.tosca.json
+ CreatePolicy /policy/api/v1/policytypes/onap.policies.optimization.resource.AffinityPolicy/versions/1.0.0/policies 200 ${postjson} OSDF_CASABLANCA.Affinity_Default 1.0.0
GetDefaultDecision
- [Documentation] Get Default Decision with no policies in Xacml PDP
- ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json
- ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} abbrev=true
- ${status}= Get From Dictionary ${resp.json()} status
- Should Be Equal As Strings ${status} Permit
+ [Documentation] Get Default Decision with no policies in Xacml PDP
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.guard.decision.request.json
+ ${resp}= DecisionPostReq ${postjson} abbrev=true
+ ${status}= Get From Dictionary ${resp.json()} status
+ Should Be Equal As Strings ${status} Permit
DeployPolicies
- [Documentation] Runs Policy PAP to deploy a policy
- ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json
- PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies 202 ${postjson} null
- ${result}= Run Process ${SCR_DMAAP}/wait_topic.sh POLICY-PDP-PAP
- ... responseTo xacml ACTIVE onap.restart.tca
- Should Be Equal As Integers ${result.rc} 0
+ [Documentation] Runs Policy PAP to deploy a policy
+ ${postjson}= Get file ${CURDIR}/data/vCPE.policy.input.tosca.deploy.json
+ ${policyadmin}= PolicyAdminAuth
+ PerformPostRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies 202 ${postjson} null ${policyadmin}
+ ${result}= Run Process ${SCR_DMAAP}/wait_topic.sh POLICY-PDP-PAP
+ ... responseTo xacml ACTIVE onap.restart.tca
+ Should Be Equal As Integers ${result.rc} 0
GetStatisticsAfterDeployed
- [Documentation] Verify policy xacml-pdp statistics after policy is deployed
- ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null
- Should Be Equal As Strings ${resp.json()['code']} 200
- Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 3
+ [Documentation] Verify policy xacml-pdp statistics after policy is deployed
+ ${resp}= PdpxGetReq /policy/pdpx/v1/statistics
+ Should Be Equal As Strings ${resp.json()['code']} 200
+ Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 3
GetAbbreviatedDecisionResult
- [Documentation] Get Decision with abbreviated results from Policy Xacml PDP
- ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json
- ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} abbrev=true
- ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca
- Dictionary Should Contain Key ${policy} type
- Dictionary Should Contain Key ${policy} metadata
- Dictionary Should Not Contain Key ${policy} type_version
- Dictionary Should Not Contain Key ${policy} properties
- Dictionary Should Not Contain Key ${policy} name
- Dictionary Should Not Contain Key ${policy} version
+ [Documentation] Get Decision with abbreviated results from Policy Xacml PDP
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json
+ ${resp}= DecisionPostReq ${postjson} abbrev=true
+ ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca
+ Dictionary Should Contain Key ${policy} type
+ Dictionary Should Contain Key ${policy} metadata
+ Dictionary Should Not Contain Key ${policy} type_version
+ Dictionary Should Not Contain Key ${policy} properties
+ Dictionary Should Not Contain Key ${policy} name
+ Dictionary Should Not Contain Key ${policy} version
GetMonitoringDecision
- [Documentation] Get Decision from Monitoring Policy Xacml PDP
- ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json
- ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} null
- ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca
- Dictionary Should Contain Key ${policy} type
- Dictionary Should Contain Key ${policy} metadata
- Dictionary Should Contain Key ${policy} type_version
- Dictionary Should Contain Key ${policy} properties
- Dictionary Should Contain Key ${policy} name
- Dictionary Should Contain Key ${policy} version
+ [Documentation] Get Decision from Monitoring Policy Xacml PDP
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.monitoring.decision.request.json
+ ${resp}= DecisionPostReq ${postjson} null
+ ${policy}= Get From Dictionary ${resp.json()['policies']} onap.restart.tca
+ Dictionary Should Contain Key ${policy} type
+ Dictionary Should Contain Key ${policy} metadata
+ Dictionary Should Contain Key ${policy} type_version
+ Dictionary Should Contain Key ${policy} properties
+ Dictionary Should Contain Key ${policy} name
+ Dictionary Should Contain Key ${policy} version
GetNamingDecision
- [Documentation] Get Decision from Naming Policy Xacml PDP
- ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json
- ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} null
- ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP
- Dictionary Should Contain Key ${policy} type
- Dictionary Should Contain Key ${policy} type_version
- Dictionary Should Contain Key ${policy} properties
- Dictionary Should Contain Key ${policy} name
+ [Documentation] Get Decision from Naming Policy Xacml PDP
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.naming.decision.request.json
+ ${resp}= DecisionPostReq ${postjson} null
+ ${policy}= Get From Dictionary ${resp.json()['policies']} SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP
+ Dictionary Should Contain Key ${policy} type
+ Dictionary Should Contain Key ${policy} type_version
+ Dictionary Should Contain Key ${policy} properties
+ Dictionary Should Contain Key ${policy} name
GetOptimizationDecision
- [Documentation] Get Decision from Optimization Policy Xacml PDP
- ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json
- ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} null
- ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default
- Dictionary Should Contain Key ${policy} type
- Dictionary Should Contain Key ${policy} type_version
- Dictionary Should Contain Key ${policy} properties
- Dictionary Should Contain Key ${policy} name
+ [Documentation] Get Decision from Optimization Policy Xacml PDP
+ ${postjson}= Get file ${CURDIR}/data/onap.policy.optimization.decision.request.json
+ ${resp}= DecisionPostReq ${postjson} null
+ ${policy}= Get From Dictionary ${resp.json()['policies']} OSDF_CASABLANCA.Affinity_Default
+ Dictionary Should Contain Key ${policy} type
+ Dictionary Should Contain Key ${policy} type_version
+ Dictionary Should Contain Key ${policy} properties
+ Dictionary Should Contain Key ${policy} name
GetStatisticsAfterDecision
- [Documentation] Runs Policy Xacml PDP Statistics after Decision request
- ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null
- Should Be Equal As Strings ${resp.json()['code']} 200
- Should Be Equal As Strings ${resp.json()['permitDecisionsCount']} 4
- Should Be Equal As Strings ${resp.json()['notApplicableDecisionsCount']} 1
+ [Documentation] Runs Policy Xacml PDP Statistics after Decision request
+ ${resp}= PdpxGetReq /policy/pdpx/v1/statistics
+ Should Be Equal As Strings ${resp.json()['code']} 200
+ Should Be Equal As Strings ${resp.json()['permitDecisionsCount']} 4
+ Should Be Equal As Strings ${resp.json()['notApplicableDecisionsCount']} 1
UndeployMonitorPolicy
- [Documentation] Runs Policy PAP to undeploy a policy
- PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202
+ [Documentation] Runs Policy PAP to undeploy a policy
+ ${policyadmin}= PolicyAdminAuth
+ PerformDeleteRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps/policies/onap.restart.tca 202 ${policyadmin}
GetStatisticsAfterUndeploy
- [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed
- ${resp}= PerformGetRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/statistics 200 null
- Should Be Equal As Strings ${resp.json()['code']} 200
- Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 2
+ [Documentation] Runs Policy Xacml PDP Statistics after policy is undeployed
+ ${resp}= PdpxGetReq /policy/pdpx/v1/statistics
+ Should Be Equal As Strings ${resp.json()['code']} 200
+ Should Be Equal As Strings ${resp.json()['totalPoliciesCount']} 2
+
+PdpxGetReq
+ [Arguments] ${url}
+ ${hcauth}= HealthCheckAuth
+ ${resp}= PerformGetRequest ${POLICY_PDPX_IP} ${url} 200 null ${hcauth}
+ [return] ${resp}
+
+DecisionPostReq
+ [Arguments] ${postjson} ${abbr}
+ ${hcauth}= HealthCheckAuth
+ ${resp}= PerformPostRequest ${POLICY_PDPX_IP} /policy/pdpx/v1/decision 200 ${postjson} ${abbr} ${hcauth}
+ [return] ${resp}