a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 7 | *** Keywords *** |
| 8 | |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 9 | PolicyAdminAuth |
| 10 | ${policyadmin}= Create list policyadmin zb!XztG34 |
| 11 | [return] ${policyadmin} |
| 12 | |
| 13 | HealthCheckAuth |
liamfallon | 8d3f129 | 2022-10-18 14:04:06 +0100 | [diff] [blame] | 14 | ${healthcheck}= Create list policyadmin zb!XztG34 |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 15 | [return] ${healthcheck} |
| 16 | |
| 17 | PerformPostRequest |
| 18 | [Arguments] ${hostname} ${url} ${expectedstatus} ${postjson} ${params} ${auth} |
liamfallon | faac45b | 2022-09-01 12:05:47 +0100 | [diff] [blame] | 19 | Log Creating session http://${hostname}:6969 |
| 20 | ${session}= Create Session policy http://${hostname}:6969 auth=${auth} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 21 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 22 | ${resp}= POST On Session policy ${url} data=${postjson} params=${params} headers=${headers} expected_status=${expectedstatus} |
| 23 | Log Received response from policy ${resp.text} |
| 24 | [return] ${resp} |
| 25 | |
| 26 | PerformPutRequest |
| 27 | [Arguments] ${hostname} ${url} ${expectedstatus} ${params} ${auth} |
liamfallon | faac45b | 2022-09-01 12:05:47 +0100 | [diff] [blame] | 28 | Log Creating session http://${hostname}:6969 |
| 29 | ${session}= Create Session policy http://${hostname}:6969 auth=${auth} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 30 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 31 | ${resp}= PUT On Session policy ${url} params=${params} headers=${headers} expected_status=${expectedstatus} |
| 32 | Log Received response from policy ${resp.text} |
| 33 | [return] ${resp} |
| 34 | |
| 35 | PerformGetRequest |
| 36 | [Arguments] ${hostname} ${url} ${expectedstatus} ${params} ${auth} |
liamfallon | faac45b | 2022-09-01 12:05:47 +0100 | [diff] [blame] | 37 | Log Creating session http://${hostname}:6969 |
| 38 | ${session}= Create Session policy http://${hostname}:6969 auth=${auth} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 39 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 40 | ${resp}= GET On Session policy ${url} params=${params} headers=${headers} expected_status=${expectedstatus} |
| 41 | Log Received response from policy ${resp.text} |
| 42 | [return] ${resp} |
| 43 | |
| 44 | PerformDeleteRequest |
| 45 | [Arguments] ${hostname} ${url} ${expectedstatus} ${auth} |
liamfallon | faac45b | 2022-09-01 12:05:47 +0100 | [diff] [blame] | 46 | Log Creating session http://${hostname}:6969 |
| 47 | ${session}= Create Session policy http://${hostname}:6969 auth=${auth} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 48 | ${headers}= Create Dictionary Accept=application/json Content-Type=application/json |
| 49 | ${resp}= DELETE On Session policy ${url} headers=${headers} expected_status=${expectedstatus} |
| 50 | Log Received response from policy ${resp.text} |
| 51 | |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 52 | CreatePolicy |
| 53 | [Arguments] ${url} ${expectedstatus} ${postjson} ${policyname} ${policyversion} |
| 54 | [Documentation] Create the specific policy |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 55 | ${policyadmin}= PolicyAdminAuth |
| 56 | ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} null ${policyadmin} |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 57 | Run Keyword If ${expectedstatus}==200 Dictionary Should Contain Key ${resp.json()['topology_template']['policies'][0]} ${policyname} |
| 58 | Run Keyword If ${expectedstatus}==200 Should Be Equal As Strings ${resp.json()['topology_template']['policies'][0]['${policyname}']['version']} ${policyversion} |
| 59 | |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 60 | CreateNodeTemplate |
| 61 | [Arguments] ${url} ${expectedstatus} ${postjson} ${nodeTemplateListLength} |
| 62 | [Documentation] Create the node templates |
| 63 | ${policyadmin}= PolicyAdminAuth |
| 64 | ${resp}= PerformPostRequest ${POLICY_API_IP} ${url} ${expectedstatus} ${postjson} \ ${policyadmin} |
| 65 | Run Keyword If ${expectedstatus}==200 Length Should Be ${resp.json()['topology_template']['node_templates']} ${nodeTemplateListLength} |
| 66 | |
| 67 | |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 68 | QueryPdpGroups |
| 69 | [Documentation] Verify pdp group query - supports upto 2 groups |
| 70 | [Arguments] ${groupsLength} ${group1Name} ${group1State} ${policiesLengthInGroup1} ${group2Name} ${group2State} ${policiesLengthInGroup2} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 71 | ${policyadmin}= PolicyAdminAuth |
| 72 | ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/pdps 200 null ${policyadmin} |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 73 | Length Should Be ${resp.json()['groups']} ${groupsLength} |
| 74 | Should Be Equal As Strings ${resp.json()['groups'][0]['name']} ${group1Name} |
| 75 | Should Be Equal As Strings ${resp.json()['groups'][0]['pdpGroupState']} ${group1State} |
| 76 | Length Should Be ${resp.json()['groups'][0]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup1} |
| 77 | Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['name']} ${group2Name} |
| 78 | Run Keyword If ${groupsLength}>1 Should Be Equal As Strings ${resp.json()['groups'][1]['pdpGroupState']} ${group2State} |
| 79 | Run Keyword If ${groupsLength}>1 Length Should Be ${resp.json()['groups'][1]['pdpSubgroups'][0]['policies']} ${policiesLengthInGroup2} |
| 80 | |
| 81 | QueryPolicyAudit |
| 82 | [Arguments] ${url} ${expectedstatus} ${pdpGroup} ${pdpType} ${policyName} ${expectedAction} |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 83 | ${policyadmin}= PolicyAdminAuth |
rameshiyer27 | a8be1f7 | 2022-03-16 10:36:33 +0000 | [diff] [blame] | 84 | ${resp}= PerformGetRequest ${POLICY_PAP_IP} ${url} ${expectedstatus} recordCount=2 ${policyadmin} |
| 85 | Log Received response from queryPolicyAudit ${resp.text} |
| 86 | FOR ${responseEntry} IN @{resp.json()} |
| 87 | Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}' |
| 88 | END |
| 89 | Should Be Equal As Strings ${responseEntry['pdpGroup']} ${pdpGroup} |
| 90 | Should Be Equal As Strings ${responseEntry['pdpType']} ${pdpType} |
| 91 | Should Be Equal As Strings ${responseEntry['policy']['name']} ${policyName} |
| 92 | Should Be Equal As Strings ${responseEntry['policy']['version']} 1.0.0 |
| 93 | Should Be Equal As Strings ${responseEntry['action']} ${expectedAction} |
| 94 | Should Be Equal As Strings ${responseEntry['user']} policyadmin |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 95 | |
| 96 | QueryPolicyStatus |
adheli.tavares | 496b301 | 2021-11-01 10:40:32 +0000 | [diff] [blame] | 97 | [Documentation] Verify policy deployment status |
| 98 | [Arguments] ${policyName} ${pdpGroup} ${pdpType} ${pdpName} ${policyTypeName} |
| 99 | ${policyadmin}= PolicyAdminAuth |
| 100 | ${resp}= PerformGetRequest ${POLICY_PAP_IP} /policy/pap/v1/policies/status 200 null ${policyadmin} |
| 101 | FOR ${responseEntry} IN @{resp.json()} |
| 102 | Exit For Loop IF '${responseEntry['policy']['name']}'=='${policyName}' |
| 103 | END |
| 104 | Should Be Equal As Strings ${resp.status_code} 200 |
| 105 | Should Be Equal As Strings ${responseEntry['pdpGroup']} ${pdpGroup} |
| 106 | Should Be Equal As Strings ${responseEntry['pdpType']} ${pdpType} |
| 107 | Should Be Equal As Strings ${responseEntry['pdpId']} ${pdpName} |
| 108 | Should Be Equal As Strings ${responseEntry['policy']['name']} ${policyName} |
| 109 | Should Be Equal As Strings ${responseEntry['policy']['version']} 1.0.0 |
| 110 | Should Be Equal As Strings ${responseEntry['policyType']['name']} ${policyTypeName} |
| 111 | Should Be Equal As Strings ${responseEntry['policyType']['version']} 1.0.0 |
| 112 | Should Be Equal As Strings ${responseEntry['deploy']} True |
| 113 | Should Be Equal As Strings ${responseEntry['state']} SUCCESS |
a.sreekumar | 60d6a08 | 2021-08-20 17:39:53 +0100 | [diff] [blame] | 114 | |
a.sreekumar | 67f7bd9 | 2022-02-14 13:51:34 +0000 | [diff] [blame] | 115 | GetMetrics |
liamfallon | c49f64d | 2023-01-19 15:30:30 +0000 | [diff] [blame^] | 116 | [Arguments] ${hostname} ${auth} ${context_path} |
liamfallon | faac45b | 2022-09-01 12:05:47 +0100 | [diff] [blame] | 117 | Log Creating session http://${hostname}:6969 |
| 118 | ${session}= Create Session policy http://${hostname}:6969 auth=${auth} |
liamfallon | c49f64d | 2023-01-19 15:30:30 +0000 | [diff] [blame^] | 119 | ${resp}= GET On Session policy ${context_path}metrics expected_status=200 |
a.sreekumar | 67f7bd9 | 2022-02-14 13:51:34 +0000 | [diff] [blame] | 120 | Log Received response from policy ${resp.text} |
| 121 | [return] ${resp} |