Added CSIT test for abbreviated Monitor decision API call 95/97495/3
authorHOCKLA <ah999m@att.com>
Wed, 23 Oct 2019 18:00:00 +0000 (13:00 -0500)
committerHOCKLA <ah999m@att.com>
Thu, 24 Oct 2019 13:49:24 +0000 (08:49 -0500)
Issue-ID: POLICY-2167
Change-Id: I8f730b3960fb91807e0b9154947db03cb714f870
Signed-off-by: HOCKLA <ah999m@att.com>
tests/policy/xacml-pdp/xacml-pdp-test.robot

index 86463c3..8227996 100644 (file)
@@ -18,7 +18,7 @@ Healthcheck
 
 Statistics
      [Documentation]    Runs Policy Xacml PDP Statistics
-     ${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
@@ -26,13 +26,14 @@ Statistics
      Log    Received response from policy ${resp.text}
      Should Be Equal As Strings    ${resp.status_code}     200
      Should Be Equal As Strings    ${resp.json()['code']}  200
-     
+
 ExecuteXacmlPolicy
      Wait Until Keyword Succeeds    2 min    5 sec    CreateMonitorPolicyType
      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
-     
+
 *** Keywords ***
 
 CreateMonitorPolicyType
@@ -77,7 +78,7 @@ DeployMonitorPolicy
 
 GetStatisticsAfterDeployed
      [Documentation]    Runs Policy Xacml PDP Statistics after policy is deployed
-     ${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
@@ -86,7 +87,26 @@ GetStatisticsAfterDeployed
      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']     1
-     
+
+GetAbbreviatedDecisionResult
+    [Documentation]    Get Decision with abbreviated results from 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
+     ${session}=    Create Session      policy  https://${POLICY_PDPX_IP}:6969   auth=${auth}
+     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json
+     ${params}=  Create Dictionary      abbrev=true
+     ${resp}=   Post Request     policy  /policy/pdpx/v1/decision     params=${params}  data=${postjson}   headers=${headers}
+     Log    Received response from policy ${resp.text}
+     ${policy}=    Get From Dictionary    ${resp.json()['policies']}   onap.restart.tca
+     Should Be Equal As Strings    ${resp.status_code}     200
+     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
+
 GetDecision
     [Documentation]    Get Decision from Policy Xacml PDP
      ${auth}=    Create List    healthcheck    zb!XztG34
@@ -96,7 +116,14 @@ GetDecision
      ${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']}   onap.restart.tca
      Should Be Equal As Strings    ${resp.status_code}     200
+     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
      
 GetStatisticsAfterDecision
      [Documentation]    Runs Policy Xacml PDP Statistics after Decision request