sv764t | 8bf4998 | 2018-10-25 01:42:52 -0400 | [diff] [blame^] | 1 | *** Settings *** |
| 2 | Documentation The private interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields |
| 3 | |
| 4 | Library Collections |
| 5 | Library RequestsLibrary |
| 6 | Library ../attlibs/UID.py |
| 7 | Library HTTPUtils |
| 8 | Library DateTime |
| 9 | |
| 10 | Resource misc.robot |
| 11 | *** Variables *** |
| 12 | *** Variables *** |
| 13 | # http://zld03290.vci.att.com:9018 |
| 14 | # |
| 15 | ${CLOSE_PATH} /vtm/manageChangeRecord/v1/closeCancelChangeRecord |
| 16 | ${CLOSE_PORT} 31127 |
| 17 | |
| 18 | |
| 19 | #**************** Test Case Variables ****************** |
| 20 | |
| 21 | *** Keywords *** |
| 22 | |
| 23 | vTM Query Template |
| 24 | [Documentation] |
| 25 | [Arguments] ${alias} ${offset}=0 ${numOfrows}=100 ${display}=[] ${filter}={} |
| 26 | ${request}= Create Dictionary offset=${offset} numOfRows=${numOfRows} displayTuple=${display} filterTuple=${filter} |
| 27 | Log ${request} |
| 28 | ${resp}= vTM Query ${alias} ${request} |
| 29 | [Return] ${resp} |
| 30 | |
| 31 | |
| 32 | vTM Query |
| 33 | [Documentation] |
| 34 | [Arguments] ${alias} ${request} |
| 35 | ${url}= Catenate ${GLOBAL_VTM_URL} |
| 36 | ${data_path}= Catenate ${GLOBAL_LISTCHANGE_PATH} |
| 37 | ${uuid}= Generate UUID |
| 38 | ${proxies}= Create Dictionary no=pass |
| 39 | ${session}= Create Session ${alias} ${url} verify=True |
| 40 | ${auth_string}= B64 Encode ${GLOBAL_VTM_USER}:${GLOBAL_VTM_PASSWORD} |
| 41 | #Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} |
| 42 | ${headers}= Create Dictionary Authorization=Basic ${auth_string} Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 43 | ${resp}= Post Request ${alias} ${data_path} headers=${headers} data=${request} |
| 44 | Log Received response from vTM ${resp.text} |
| 45 | ${valid}= Create List 200 404 |
| 46 | Validate Status ${resp} ${valid} |
| 47 | [Return] ${resp} |
| 48 | |
| 49 | |
| 50 | vTM Close Ticket |
| 51 | [Documentation] |
| 52 | [Arguments] ${alias} ${ticket} ${changeClosedBy}=jf9860 |
| 53 | ${url}= Catenate ${GLOBAL_VTM_PROTO}://${GLOBAL_VTM_HOST}:${CLOSE_PORT} |
| 54 | ${data_path}= Catenate ${CLOSE_PATH} |
| 55 | ${uuid}= Generate UUID |
| 56 | ${proxies}= Create Dictionary no=pass |
| 57 | ${session}= Create Session ${alias} ${url} verify=True |
| 58 | ${auth_string}= B64 Encode ${GLOBAL_VTM_USER}:${GLOBAL_VTM_PASSWORD} |
| 59 | ${end}= Get Current Date result_format=epoch exclude_millis=True |
| 60 | ${end}= Convert To Integer ${end} |
| 61 | ${start}= Evaluate ${end}-60 |
| 62 | ${request}= Create Dictionary changeId=${ticket} status=Closed changeClosedBy=${changeClosedBy} closureCode=Successful As Scheduled |
| 63 | Set To Dictionary ${request} customerImpacted=Unknown actualStartDate=${start} actualEndDate=${end} |
| 64 | |
| 65 | #Authorization=Basic ${GLOBAL_POLICY_AUTH} ClientAuth=${GLOBAL_POLICY_CLIENTAUTH} |
| 66 | ${headers}= Create Dictionary Authorization=Basic ${auth_string} Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 67 | ${resp}= Post Request ${alias} ${data_path} headers=${headers} data=${request} |
| 68 | Log Received response from vTM ${resp.json()} |
| 69 | ${valid}= Create List 200 404 |
| 70 | Validate Status ${resp} ${valid} |
| 71 | [Return] ${resp} |
| 72 | |
| 73 | |
| 74 | vTM Cancel Ticket |
| 75 | [Documentation] |
| 76 | [Arguments] ${alias} ${ticket} |
| 77 | ${url}= Catenate ${GLOBAL_VTM_PROTO}://${GLOBAL_VTM_HOST}:${CLOSE_PORT} |
| 78 | ${data_path}= Catenate ${CLOSE_PATH} |
| 79 | ${uuid}= Generate UUID |
| 80 | ${proxies}= Create Dictionary no=pass |
| 81 | ${session}= Create Session ${alias} ${url} verify=True |
| 82 | ${auth_string}= B64 Encode ${GLOBAL_VTM_USER}:${GLOBAL_VTM_PASSWORD} |
| 83 | ${end}= Get Current Date result_format=epoch exclude_millis=True |
| 84 | ${end}= Convert To Integer ${end} |
| 85 | ${start}= Evaluate ${end}-60 |
| 86 | ${request}= Create Dictionary changeId=${ticket} status=Closed changeClosedBy=${GLOBAL_VID_USERID} closureCode=Cancelled closingComments=Cancel requested by user |
| 87 | Set To Dictionary ${request} customerImpacted=No |
| 88 | ${headers}= Create Dictionary Authorization=Basic ${auth_string} Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} |
| 89 | ${resp}= Post Request ${alias} ${data_path} headers=${headers} data=${request} |
| 90 | Log Received response from vTM ${resp.json()} |
| 91 | ${valid}= Create List 200 404 |
| 92 | Validate Status ${resp} ${valid} |
| 93 | [Return] ${resp} |