diff options
author | RamaPrasad Amaranarayana (ra5425) <ra5425@att.com> | 2018-09-19 17:40:40 -0400 |
---|---|---|
committer | RamaPrasad Amaranarayana (ra5425) <ra5425@att.com> | 2018-09-19 17:40:40 -0400 |
commit | fbe4bb98345727d190cefcfb3ec54ad9075fba9d (patch) | |
tree | f2e0c091a4c132c89dafb061c81eeebfb0e9a773 /cmso-robot/robot/testsuites/VtmAccess.robot | |
parent | b031d50f82f8ca5b7fd0609a92c719f43a9f518d (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/testsuites/VtmAccess.robot')
-rw-r--r-- | cmso-robot/robot/testsuites/VtmAccess.robot | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/cmso-robot/robot/testsuites/VtmAccess.robot b/cmso-robot/robot/testsuites/VtmAccess.robot new file mode 100644 index 0000000..4a9c0aa --- /dev/null +++ b/cmso-robot/robot/testsuites/VtmAccess.robot @@ -0,0 +1,105 @@ +*** Settings *** +Documentation Creates VID VNF Instance + +Library String +Library OperatingSystem +Library StringTemplater +Library Collections +Library XML + +Resource ../resources/scheduler_common.robot +Resource ../resources/vtm_common.robot +*** Variables **** +${AOTS_USER} ${GLOBAL_VID_USERID} +${ASSETSSTRING} dummy-id + +*** Test Cases *** +Test1 + ${display} Create List actualStartDate actualEndDate dateModified assetId + ${assets}= Create List dummy + ${status}= Create List New Assigned Planning Scheduled Pending WorkInProgress Resolved + ${filter}= Create Dictionary plannedStartDateFrom=1505389844 assetId=${assets} + vTM Query Template vtm display=${display} filter=${filter} + +Delete Tickets + ${tickets} Create List dummy-id + :for ${ticket} in @{tickets} + \ vTM Close Ticket vtm ${ticket} ${GLOBAL_VID_USERID} + +Delete Old Tickets Atomic + @{assets}= Split String ${ASSETS} separator=, + ${end_time}= Get Current Date UTC - 1440 minutes result_format=timestamp exclude_millis=False + ${end_time}= Convert Date ${end_time} epoch + ${end_time}= Evaluate int(${end_time}) + ${display} Create List actualStartDate actualEndDate dateModified assetId + ${status}= Create List New Assigned Planning Scheduled Pending WorkInProgress Resolved + ${filter}= Create Dictionary plannedStartDateFrom=0 plannedEndDateTo=${end_time} assetId=@{assets} status=${status} + ${resp}= vTM Query Template vtm display=${display} filter=${filter} + Log ${resp.json()} + ${list}= Get From Dictionary ${resp.json()} changeInfo + ${changeIds}= Create Dictionary + :for ${ticket} in @{list} + \ ${changeId}= Get From Dictionary ${ticket} changeId + \ Set To Dictionary ${changeIds} ${changeId}=1 + # Weed out dupes if any + ${idlist} Get Dictionary Keys ${changeIds} + :for ${changeId} in @{idlist} + \ vTM Close Ticket vtm ${changeId} ${AOTS_USER} + +Delete Old Scheduler Tickets + :for ${env} in @{DELETE_TICKET_ENVS} + \ Set Global Variable ${GLOBAL_SCHEDULER_HOST} ${env['scheduler']} + \ Set Global Variable ${GLOBAL_VTM_HOST} ${env['vtm']} + \ Delete Scheduler Tickets For ENV + + +Cancel Tickets + ${tickets} Create List dummy-id + :for ${ticket} in @{tickets} + \ vTM Cancel Ticket vtm ${ticket} + + +Delete Schedule + ${uuid}= Catenate dummy-id + ${resp}= Delete Change Management auth schedules/${uuid} + + +*** Keywords *** +Delete Scheduler Tickets For ENV + # Make sure that the Scheduler in the config and the vTM system are the same. + # We will match the tickets to be deleted to the tickets in the scheduler DB + # to ensure we don't clobber other folks test data! + ${scheduler_tickets}= Get Scheduler Tickets + # ELiminate dupes + @{assets} Get Dictionary Values ${scheduler_tickets} + @{assets}= Remove Duplicates ${assets} + ${end_time}= Get Current Date UTC - 1440 minutes result_format=timestamp exclude_millis=False + ${end_time}= Convert Date ${end_time} epoch + ${end_time}= Evaluate int(${end_time}) + ${display} Create List actualStartDate actualEndDate dateModified assetId requesterId + ${status}= Create List New Assigned Planning Scheduled Pending WorkInProgress Resolved + ${filter}= Create Dictionary plannedStartDateFrom=0 plannedEndDateTo=${end_time} assetId=@{assets} status=${status} + ${resp}= vTM Query Template vtm display=${display} filter=${filter} + Log ${resp.json()} + ${list}= Get From Dictionary ${resp.json()} changeInfo + + ## Get list of tickets that are both in our DB and in AOTS + ${changeIds}= Create Dictionary + :for ${ticket} in @{list} + \ ${changeId}= Get From Dictionary ${ticket} changeId + \ ${status} ${value}= Run Keyword and Ignore Error Get From Dictionary ${scheduler_tickets} ${changeId} + \ Run Keyword If '${status}'=='PASS' Set To Dictionary ${changeIds} ${changeId}=1 + # Weed out dupes if any and only cance ones in our DB! + ${idlist} Get Dictionary Keys ${changeIds} + :for ${changeId} in @{idlist} + \ vTM Cancel Ticket vtm ${changeId} + +Get Scheduler Tickets + ${resp}= Get Change Management auth schedules/scheduleDetails + ${dict}= Create Dictionary + Log ${resp.json()} + :for ${details} in @{resp.json()} + \ ${status} ${value}= Run Keyword and Ignore Error Get From Dictionary ${details} aotsChangeId + \ ${assetId}= Get From Dictionary ${details} vnfName + \ Run Keyword If '${status}'=='PASS' Set To Dictionary ${dict} ${value}=${assetId} + [Return] ${dict} |