Add Naming policy test for xacml CSIT 64/106164/2
authorJim Hahn <jrh3@att.com>
Thu, 16 Apr 2020 22:32:27 +0000 (18:32 -0400)
committerJim Hahn <jrh3@att.com>
Thu, 16 Apr 2020 22:41:37 +0000 (18:41 -0400)
Issue-ID: POLICY-2491
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: I06db49336860f7fccb5b72f769f9f9bdcd42f11a
Signed-off-by: Jim Hahn <jrh3@att.com>
plans/policy/xacml-pdp/setup.sh
tests/policy/xacml-pdp/data/onap.policy.naming.decision.request.json [new file with mode: 0644]
tests/policy/xacml-pdp/xacml-pdp-test.robot

index 79c4307..72d1115 100644 (file)
@@ -61,10 +61,6 @@ echo ${POLICY_XACML_PDP_VERSION}
 # Adding this waiting container due to race condition between pap and mariadb
 docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_dependencies
 
-#Configure the database
-docker exec -it mariadb  chmod +x /docker-entrypoint-initdb.d/db.sh
-docker exec -it mariadb  /docker-entrypoint-initdb.d/db.sh
-
 # now bring everything else up
 docker-compose -f ${WORKSPACE}/scripts/policy/policy-xacml-pdp/docker-compose-pdpx.yml run --rm start_all
 
diff --git a/tests/policy/xacml-pdp/data/onap.policy.naming.decision.request.json b/tests/policy/xacml-pdp/data/onap.policy.naming.decision.request.json
new file mode 100644 (file)
index 0000000..d30e0e2
--- /dev/null
@@ -0,0 +1,13 @@
+{
+  "ONAPName": "SDNC",
+  "ONAPComponent": "SNDC-component",
+  "ONAPInstance": "SDNC-component-instance",
+  "requestId": "unique-request-sdnc-1",
+  "action": "naming",
+  "resource": {
+      "nfRole": [],
+      "naming-type": [],
+      "property-name": [],
+      "policy-type": ["onap.policies.Naming"]
+  }
+}
index 0305af8..5144f96 100644 (file)
@@ -7,7 +7,7 @@ Library     json
 *** Test Cases ***
 Healthcheck
      [Documentation]    Runs Policy Xacml PDP Health check
-     ${auth}=    Create List    healthcheck    zb!XztG34 
+     ${auth}=    Create List    healthcheck    zb!XztG34
      Log    Creating session https://${POLICY_PDPX_IP}:6969
      ${session}=    Create Session      policy  https://${POLICY_PDPX_IP}:6969   auth=${auth}
      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
@@ -28,10 +28,11 @@ Statistics
      Should Be Equal As Strings    ${resp.json()['code']}  200
 
 ExecuteXacmlPolicy
-     Wait Until Keyword Succeeds    2 min    5 sec    CreateNewMonitorPolicy
-     Wait Until Keyword Succeeds    2 min    5 sec    DeployMonitorPolicy
-     Wait Until Keyword Succeeds    2 min    10 sec   GetAbbreviatedDecisionResult
-     Wait Until Keyword Succeeds    2 min    10 sec   GetDecision
+     Wait Until Keyword Succeeds    0 min   15 sec  CreateNewMonitorPolicy
+     Wait Until Keyword Succeeds    0 min   15 sec  DeployMonitorPolicy
+     Wait Until Keyword Succeeds    0 min   15 sec  GetAbbreviatedDecisionResult
+     Wait Until Keyword Succeeds    0 min   15 sec  GetMonitoringDecision
+     Wait Until Keyword Succeeds    0 min   15 sec  GetNamingDecision
 
 *** Keywords ***
 
@@ -92,8 +93,8 @@ GetAbbreviatedDecisionResult
      Dictionary Should Not Contain Key    ${policy}    name
      Dictionary Should Not Contain Key    ${policy}    version
 
-GetDecision
-    [Documentation]    Get Decision from Policy Xacml PDP
+GetMonitoringDecision
+    [Documentation]    Get Decision from Monitoring Policy Xacml PDP
      ${auth}=    Create List    healthcheck    zb!XztG34
      ${postjson}=  Get file  ${CURDIR}/data/onap.policy.monitoring.decision.request.json
      Log    Creating session https://${POLICY_PDPX_IP}:6969
@@ -109,10 +110,26 @@ GetDecision
      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
+     ${auth}=    Create List    healthcheck    zb!XztG34
+     ${postjson}=  Get file  ${CURDIR}/data/onap.policy.naming.decision.request.json
+     Log    Creating session https://${POLICY_PDPX_IP}:6969
+     ${session}=    Create Session      policy  https://${POLICY_PDPX_IP}:6969   auth=${auth}
+     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+     ${resp}=   Post Request     policy  /policy/pdpx/v1/decision  data=${postjson}   headers=${headers}
+     Log    Received response from policy ${resp.text}
+     ${policy}=    Get From Dictionary    ${resp.json()['policies']}   SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP
+     Should Be Equal As Strings    ${resp.status_code}     200
+     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
-     ${auth}=    Create List    healthcheck    zb!XztG34 
+     ${auth}=    Create List    healthcheck    zb!XztG34
      Log    Creating session https://${POLICY_PDPX_IP}:6969
      ${session}=    Create Session      policy  https://${POLICY_PDPX_IP}:6969   auth=${auth}
      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
@@ -121,7 +138,7 @@ GetStatisticsAfterDecision
      Should Be Equal As Strings    ${resp.status_code}     200
      Should Be Equal As Strings    ${resp.json()['code']}  200
      Should Be Equal As Strings    ${resp.json()['totalDecisionsCount']     1
-     
+
 UndeployMonitorPolicy
      [Documentation]    Runs Policy PAP to undeploy a policy
      ${auth}=    Create List    healthcheck    zb!XztG34
@@ -131,10 +148,10 @@ UndeployMonitorPolicy
      ${resp}=   Delete Request     policy  /policy/pap/v1/pdps/policies/onap.restart.tca     headers=${headers}
      Log    Received response from policy ${resp.text}
      Should Be Equal As Strings    ${resp.status_code}     200
-     
+
 GetStatisticsAfterUndeploy
      [Documentation]    Runs Policy Xacml PDP Statistics after policy is undeployed
-     ${auth}=    Create List    healthcheck    zb!XztG34 
+     ${auth}=    Create List    healthcheck    zb!XztG34
      Log    Creating session https://${POLICY_PDPX_IP}:6969
      ${session}=    Create Session      policy  https://${POLICY_PDPX_IP}:6969   auth=${auth}
      ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
@@ -143,5 +160,3 @@ GetStatisticsAfterUndeploy
      Should Be Equal As Strings    ${resp.status_code}     200
      Should Be Equal As Strings    ${resp.json()['code']}  200
      Should Be Equal As Strings    ${resp.json()['totalPoliciesCount']     0
-
-