blob: e20640c08ebe424d85f98e593ad51509082574ef [file] [log] [blame]
sv764t8bf49982018-10-25 01:42:52 -04001*** Settings ***
2Library Collections
3Library String
4#Library UUID
5Library ../attlibs/UID.py
6Library Process
7Library HttpLibrary.HTTP
8Documentation Miscellaneous keywords
9
10Resource json_templater.robot
11Resource create_schedule.robot
12
13
14*** Variables ***
15
16*** Keywords ***
17
18Validate Status
19 [Documentation] Fail unless the Request response is in the passed list of valid HTTP status codes.
20 [Arguments] ${resp} ${valid_status_list}
21 ${status_code} Convert To String ${resp.status_code}
22 Return From Keyword If '${resp.status_code}' in ${valid_status_list}
23 Fail ${resp.status_code}
24
25Validate JSON Error
26 [Documentation] Fails if messageIds do not match. expected_errors should be a list but a string would likely work as well
27 [Arguments] ${resp_json} ${expected_errors}
28 ${result}= Get From Dictionary ${resp_json['requestError']} messageId
29 Should Contain ${expected_errors} ${result} #checks expected_errors list for the actual error received from schedule
30
31Check ATTIDs Template
32 [Documentation] This just checks a list of uuids
33 [Arguments] ${expected_status_code} ${template_folder}
34 ${request_file}= Convert to String OneVnfImmediateATTID.json.template
35 ${attid_file}= OperatingSystem.Get File robot/assets/AOTS_CM_IDs.txt
36 @{attids}= Split to lines ${attid_file}
37 :for ${attid} in @{attids}
38 \ ${uuid}= Generate UUID
39 \ ${resp}= Run Keyword and Continue on Failure Create Schedule ${uuid} ${request_file} ${template_folder} attid=${attid}
40 \ Run Keyword and Continue on Failure Should Be Equal as Strings ${resp.status_code} ${expected_status_code}
41 \ ${reps}= Delete Change Management auth schedules/${uuid}
42
43