Change Management Schedule Optimization
[integration/csit.git] / tests / optf-cmso / cmso / resources / change_management_ete.robot
1 *** Settings ***
2 Documentation     Creates VID VNF Instance
3
4 #Library   StringTemplater
5 #Library   UUID
6 Library         ../attlibs/UID.py
7 Library         ../attlibs/StringTemplater.py
8 Library   Collections
9 Library   SSHLibrary
10
11 Resource        scheduler_common.robot
12 Resource        json_templater.robot
13 Resource        create_schedule.robot
14 Resource        approval_requests.robot
15
16 *** Variables ****
17 ${TEMPLATES}    /assets/templates
18
19 *** Keywords ***
20 Change Management Template
21    [Arguments]    ${request_file}   ${workflow}   ${minutesFromNow}=1
22    ${template_folder}=    Catenate   ${TEMPLATES}/changemanagement
23    ${uuid}=   Generate UUID 
24    ${resp}=   Create Schedule   ${uuid}   ${request_file}   ${template_folder}   workflow=${workflow}   minutesFromNow=${minutesFromNow}   
25    Should Be Equal as Strings    ${resp.status_code}    202
26    Validate Acknowledgment Response Headers    ${resp} 
27    Wait Until Keyword Succeeds    600s    30s    Wait For Pending Approval   ${uuid}
28    Send Tier2 Approval   ${uuid}   jf9860    Accepted      
29    ${resp}=   Get Change Management   auth   schedules/${uuid}
30    Wait Until Keyword Succeeds    120s    30s    Wait For All VNFs Reach Status   Completed   ${uuid}
31    Wait Until Keyword Succeeds    120s    30s    Wait for Schedule to Complete   Completed   ${uuid}
32    ${reps}=   Delete Change Management   auth   schedules/${uuid}
33
34 Change Management Immediate Template
35    [Arguments]    ${request_file}    ${workflow}  
36    ${template_folder}=    Catenate   ${TEMPLATES}/changemanagement
37    ${uuid}=   Generate UUID 
38    ${resp}=   Create Schedule   ${uuid}   ${request_file}   ${template_folder}   workflow=${workflow}
39    Should Be Equal as Strings    ${resp.status_code}   202
40    Validate Acknowledgment Response Headers    ${resp}
41    Wait Until Keyword Succeeds    120s    30s    Wait For All VNFs Reach Status   Completed   ${uuid}
42    Wait Until Keyword Succeeds    120s    30s    Wait for Schedule to Complete   Completed   ${uuid}
43    ${reps}=   Delete Change Management   auth   schedules/${uuid}
44     
45 Wait For All VNFs Reach Status
46     [Arguments]   ${status}   ${uuid}
47     ${resp}=   Get Change Management   auth   schedules/scheduleDetails?request.scheduleId=${uuid}
48     : for   ${vnf}   in  @{resp.json()}
49     \   Dictionary Should Contain Item   ${vnf}   status   Completed 
50       
51 Wait for Schedule to Complete
52     [Arguments]   ${status}   ${uuid}
53     ${resp}=   Get Change Management   auth   schedules/${uuid}
54     Dictionary Should Contain Item   ${resp.json()}   status   Completed 
55
56 Create and Approve
57    [Arguments]    ${request_file}   ${workflow}   ${minutesFromNow}=5  
58    ${template_folder}=    Catenate   ${TEMPLATES}/changemanagement
59    ${uuid}=   Generate UUID 
60    ${resp}=   Create Schedule   ${uuid}   ${request_file}   ${template_folder}   workflow=${workflow}   minutesFromNow=${minutesFromNow}   
61    Should Be Equal as Strings    ${resp.status_code}    202 
62    Validate Acknowledgment Response Headers    ${resp}
63    Wait Until Keyword Succeeds    300s    5s    Wait For Pending Approval   ${uuid}
64    Send Tier2 Approval   ${uuid}   jf9860    Accepted      
65
66 Change Management Cancel Template
67    [Arguments]    ${request_file}   ${workflow}   ${minutesFromNow}=5
68    ${template_folder}=    Catenate   ${TEMPLATES}/changemanagement
69    ${uuid}=   Generate UUID 
70    ${resp}=   Create Schedule   ${uuid}   ${request_file}   ${template_folder}   workflow=${workflow}   minutesFromNow=${minutesFromNow}   
71    Should Be Equal as Strings    ${resp.status_code}    202 
72    Validate Acknowledgment Response Headers    ${resp}
73    Wait Until Keyword Succeeds    600s    5s    Wait For Pending Approval   ${uuid}
74    Send Tier2 Approval   ${uuid}   jf9860    Accepted      
75    ${resp}=   Delete Change Management   auth   schedules/${uuid}
76    Should Be Equal as Strings    ${resp.status_code}    204 
77    Log    ${resp.headers}    
78    
79 Validate Acknowledgment Response Headers 
80     [Arguments]    ${Response} 
81     Log     ${Response.headers} 
82     ${act_headers_keys} =    Get Dictionary Keys    ${Response.headers} 
83     Dictionary Should Contain Key    ${Response.headers}    X-LatestVersion 
84     Dictionary Should Contain Key    ${Response.headers}    X-MinorVersion 
85     Dictionary Should Contain Key    ${Response.headers}    X-PatchVersion
86     
87     
88     
89 Change Management Immediate Template Query Data    
90    [Arguments]    ${request_file}    ${workflow}  
91    ${template_folder}=    Catenate   ${TEMPLATES}/SearchSchedulerDetails
92    ${uuid}=   Generate UUID 
93    ${resp}=   Create Schedule   ${uuid}   ${request_file}   ${template_folder}   workflow=${workflow}
94    Should Be Equal as Strings    ${resp.status_code}   202
95    Validate Acknowledgment Response Headers    ${resp}
96    Wait Until Keyword Succeeds    120s    30s    Wait For All VNFs Reach Status   Completed   ${uuid}
97    Wait Until Keyword Succeeds    120s    30s    Wait for Schedule to Complete   Completed   ${uuid}
98    [Return]    ${uuid}
99    
100    
101
102  
103