summaryrefslogtreecommitdiffstats
path: root/cmso-robot/robot/resources/scheduler_common.robot
diff options
context:
space:
mode:
authorRamaPrasad Amaranarayana (ra5425) <ra5425@att.com>2018-09-19 17:40:40 -0400
committerRamaPrasad Amaranarayana (ra5425) <ra5425@att.com>2018-09-19 17:40:40 -0400
commitfbe4bb98345727d190cefcfb3ec54ad9075fba9d (patch)
treef2e0c091a4c132c89dafb061c81eeebfb0e9a773 /cmso-robot/robot/resources/scheduler_common.robot
parentb031d50f82f8ca5b7fd0609a92c719f43a9f518d (diff)
Change Management Schedule Optimization
Adding Robot Test Scripts for Change Management Schedule Optimization Change-Id: Id5edf9d3fb3c2390791362692c8b25f7607045c6 Issue-ID: OPTFRA-352 Signed-off-by: RamaPrasad Amaranarayana (ra5425) <ra5425@att.com>
Diffstat (limited to 'cmso-robot/robot/resources/scheduler_common.robot')
-rw-r--r--cmso-robot/robot/resources/scheduler_common.robot85
1 files changed, 85 insertions, 0 deletions
diff --git a/cmso-robot/robot/resources/scheduler_common.robot b/cmso-robot/robot/resources/scheduler_common.robot
new file mode 100644
index 0000000..7fa8a59
--- /dev/null
+++ b/cmso-robot/robot/resources/scheduler_common.robot
@@ -0,0 +1,85 @@
+*** Settings ***
+Documentation The private interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
+
+Library Collections
+Library RequestsLibrary
+Library UUID
+Library HTTPUtils
+Library String
+Resource misc.robot
+*** Variables ***
+*** Variables ***
+${SCHEDULER_PATH} /scheduler/v1
+${CHANGE_MANAGEMENT_PATH} ${SCHEDULER_PATH}/ChangeManagement
+${valid_status_codes} 200 202 400 404 204 409
+#**************** Test Case Variables ******************
+
+*** Keywords ***
+
+
+Post Change Management
+ [Documentation] Runs a scheduler POST request
+ [Arguments] ${alias} ${resource} ${data}={}
+ ${data_path}= Catenate ${CHANGE_MANAGEMENT_PATH}/${resource}
+ ${resp}= Post Scheduler ${alias} ${data_path} ${data}
+ [Return] ${resp}
+
+Delete Change Management
+ [Documentation] Runs a scheduler DELETE request (this may need to be changed for 1802 US change Delete schedule to Cancel Schedule)
+ [Arguments] ${alias} ${resource}
+ ${data_path}= Catenate ${CHANGE_MANAGEMENT_PATH}/${resource}
+ ${resp}= Delete Scheduler ${alias} ${data_path}
+ [Return] ${resp}
+
+Get Change Management
+ [Documentation] Runs a scheduler GET request
+ [Arguments] ${alias} ${resource}
+ ${data_path}= Catenate ${CHANGE_MANAGEMENT_PATH}/${resource}
+ ${resp}= Get Scheduler ${alias} ${data_path}
+ [Return] ${resp}
+
+Post Scheduler
+ [Documentation] Runs a scheduler POST request
+ [Arguments] ${alias} ${data_path} ${data}={}
+ ${url}= Catenate ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
+ ${uuid}= Generate UUID
+ ${proxies}= Create Dictionary no=pass
+ ${session}= Create Session ${alias} ${url}
+ ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_PASSWORD}
+ ${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}
+ ${resp}= Post Request ${alias} ${data_path} headers=${headers} data=${data}
+ Log Received response from scheduler ${resp.text}
+ ${valid}= Split String ${valid_status_codes}
+
+ Validate Status ${resp} ${valid}
+ [Return] ${resp}
+
+Delete Scheduler
+ [Documentation] Runs a scheduler POST request
+ [Arguments] ${alias} ${data_path}
+ ${url}= Catenate ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
+ ${uuid}= Generate UUID
+ ${proxies}= Create Dictionary no=pass
+ ${session}= Create Session ${alias} ${url}
+ ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_PASSWORD}
+ ${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}
+ ${resp}= Delete Request ${alias} ${data_path} headers=${headers}
+ Log Received response from scheduler ${resp.text}
+ ${valid}= Split String ${valid_status_codes}
+ Validate Status ${resp} ${valid}
+ [Return] ${resp}
+
+Get Scheduler
+ [Documentation] Runs a scheduler GET request
+ [Arguments] ${alias} ${data_path}
+ ${url}= Catenate ${GLOBAL_SCHEDULER_PROTOCOL}://${GLOBAL_SCHEDULER_HOST}:${GLOBAL_SCHEDULER_PORT}
+ ${uuid}= Generate UUID
+ ${proxies}= Create Dictionary no=pass
+ ${session}= Create Session ${alias} ${url}
+ ${auth_string}= B64 Encode ${GLOBAL_SCHEDULER_USER}:${GLOBAL_SCHEDULER_PASSWORD}
+ ${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}
+ ${resp}= Get Request ${alias} ${data_path} headers=${headers}
+ Log Received response from scheduler ${resp.json()}
+ ${valid}= Split String ${valid_status_codes}
+ Validate Status ${resp} ${valid}
+ [Return] ${resp}