blob: dd2f6118135a10ac75244930589aaba9a5a1ffc9 [file] [log] [blame]
sv764t8bf49982018-10-25 01:42:52 -04001*** Settings ***
2Documentation The private interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
3
4Library Collections
5Library RequestsLibrary
6#Library UUID
7Library ../attlibs/UID.py
8#Library HTTPUtils
9Library ../attlibs/HTTPUtils.py
10Library String
11Resource misc.robot
12*** Variables ***
13*** Variables ***
14${GLOBAL_SCHEDULER_PORT} 8080
15${GLOBAL_SCHEDULER_PROTOCOL} http
16#${GLOBAL_SCHEDULER_HOST} 127.0.0.1
17${GLOBAL_SCHEDULER_USER} jf9860@csp.att.com
18${GLOBAL_SCHEDULER_PASSWORD} 45=Forty5
19${GLOBAL_APPLICATION_ID} schedulertest
20${SCHEDULER_PATH} /cmso/v1
21${CHANGE_MANAGEMENT_PATH} ${SCHEDULER_PATH}
22${valid_status_codes} 200 202 400 404 204 409
23#**************** Test Case Variables ******************
24
25*** Keywords ***
26
27
28Post Change Management
29 [Documentation] Runs a scheduler POST request
30 [Arguments] ${alias} ${resource} ${data}={}
31 ${data_path}= Catenate ${CHANGE_MANAGEMENT_PATH}/${resource}
32 ${resp}= Post Scheduler ${alias} ${data_path} ${data}
33 [Return] ${resp}
34
35Delete Change Management
36 [Documentation] Runs a scheduler DELETE request (this may need to be changed for 1802 US change Delete schedule to Cancel Schedule)
37 [Arguments] ${alias} ${resource}
38 ${data_path}= Catenate ${CHANGE_MANAGEMENT_PATH}/${resource}
39 ${resp}= Delete Scheduler ${alias} ${data_path}
40 [Return] ${resp}
41
42Get Change Management
43 [Documentation] Runs a scheduler GET request
44 [Arguments] ${alias} ${resource}
45 ${data_path}= Catenate ${CHANGE_MANAGEMENT_PATH}/${resource}
46 ${resp}= Get Scheduler ${alias} ${data_path}
47 [Return] ${resp}
48
49Post Scheduler
50 [Documentation] Runs a scheduler POST request
51 [Arguments] ${alias} ${data_path} ${data}={}
52 ${url}= Catenate ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
53 ${uuid}= Generate UUID
54 ${proxies}= Create Dictionary no=pass
55 ${session}= Create Session ${alias} ${url}
56 ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_PASSWORD}
57 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Authorization=Basic ${auth_string}
58 ${resp}= Post Request ${alias} ${data_path} headers=${headers} data=${data}
59 Log Received response from scheduler ${resp.text}
60 ${valid}= Split String ${valid_status_codes}
61
62 Validate Status ${resp} ${valid}
63 [Return] ${resp}
64
65Delete Scheduler
66 [Documentation] Runs a scheduler POST request
67 [Arguments] ${alias} ${data_path}
68 ${url}= Catenate ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
69 ${uuid}= Generate UUID
70 ${proxies}= Create Dictionary no=pass
71 ${session}= Create Session ${alias} ${url}
72 ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_PASSWORD}
73 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Authorization=Basic ${auth_string}
74 ${resp}= Delete Request ${alias} ${data_path} headers=${headers}
75 Log Received response from scheduler ${resp.text}
76 ${valid}= Split String ${valid_status_codes}
77 Validate Status ${resp} ${valid}
78 [Return] ${resp}
79
80Get Scheduler
81 [Documentation] Runs a scheduler GET request
82 [Arguments] ${alias} ${data_path}
83 ${url}= Catenate ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
84 ${uuid}= Generate UUID
85 ${proxies}= Create Dictionary no=pass
86 ${session}= Create Session ${alias} ${url}
87 ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_PASSWORD}
88 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} Authorization=Basic ${auth_string}
89 ${resp}= Get Request ${alias} ${data_path} headers=${headers}
90 Log Received response from scheduler ${resp.json()}
91 ${valid}= Split String ${valid_status_codes}
92 Validate Status ${resp} ${valid}
93 [Return] ${resp}