From 496b301c101f2a21e8408048dc0fd57c59a12d92 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Mon, 1 Nov 2021 10:40:32 +0000 Subject: 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 --- csit/pap/tests/pap-test.robot | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'csit/pap/tests/pap-test.robot') 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 -- cgit 1.2.3-korg