2 Documentation The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps
3 Library SeleniumLibrary
6 Library RequestsLibrary
8 Resource ../global_properties.robot
9 Resource ../browser_setup.robot
13 ${VID_ENDPOINT} ${GLOBAL_VID_SERVER_PROTOCOL}://${GLOBAL_INJECTED_VID_IP_ADDR}:${GLOBAL_VID_SERVER_PORT}
14 ${VID_LOGIN_URL} ${VID_ENDPOINT}${VID_ENV}/login.htm
15 ${VID_HEALTHCHECK_PATH} ${VID_ENV}/healthCheck
16 ${VID_HOME_URL} ${VID_ENDPOINT}${VID_ENV}/welcome.htm
17 ${VID_SERVICE_MODELS_URL} ${VID_ENDPOINT}${VID_ENV}/serviceModels.htm#/models/services
21 [Documentation] Logs in to VID GUI
22 ${resp}= Run VID Get Request ${VID_HEALTHCHECK_PATH}
23 Should Be Equal As Strings ${resp.status_code} 200
24 Should Be String ${resp.json()['detailedMsg']}
27 [Documentation] Runs an VID get request
28 [Arguments] ${data_path}
29 ${auth}= Create List ${GLOBAL_VID_HEALTH_USERNAME} ${GLOBAL_VID_HEALTH_PASSWORD}
30 Log Creating session ${VID_ENDPOINT}
31 ${session}= Create Session vid ${VID_ENDPOINT} auth=${auth}
32 ${uuid}= Generate UUID
33 ${headers}= Create Dictionary username=${GLOBAL_VID_HEALTH_USERNAME} password=${GLOBAL_VID_HEALTH_PASSWORD} Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
34 ${resp}= Get Request vid ${data_path} headers=${headers}
35 Log Received response from vid ${resp.text}
39 [Documentation] Logs in to VID GUI
40 # Setup Browser Now being managed by test case
42 Go To ${VID_LOGIN_URL}
43 #Maximize Browser Window
44 Set Selenium Speed ${GLOBAL_SELENIUM_DELAY}
45 Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
46 Log Logging in to ${VID_ENDPOINT}${VID_ENV}
49 Input Text xpath=//input[@id='loginId'] ${GLOBAL_VID_USERNAME}
50 Input Password xpath=//input[@id='password'] ${GLOBAL_VID_PASSWORD}
51 Click Button xpath=//input[@id='loginBtn']
52 Wait Until Page Contains Welcome to VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
53 Select From List By Label //select[@id='selectTestApi'] VNF_API (old)
54 Log Logged in to ${VID_ENDPOINT}${VID_ENV}
57 [Documentation] Naviage to VID Home
59 Wait Until Page Contains Welcome to VID ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
61 Go To VID Browse Service Models
62 [Documentation] Naviage to VID Browse Service Models
63 Go To ${VID_SERVICE_MODELS_URL}
64 Wait Until Page Contains Browse SDC Service Models ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
66 Click On Button When Enabled
67 [Arguments] ${xpath} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
68 Wait Until Page Contains Element xpath=${xpath} ${timeout}
69 Wait Until Element Is Enabled xpath=${xpath} ${timeout}
70 Click Button xpath=${xpath}
72 Click On Element When Visible
73 [Arguments] ${xpath} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
74 Wait Until Page Contains Element xpath=${xpath} ${timeout}
75 Wait Until Element Is Visible xpath=${xpath} ${timeout}
76 Click Element xpath=${xpath}
78 Select From List When Enabled
79 [Arguments] ${xpath} ${value} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
80 Wait Until Page Contains Element xpath=${xpath} ${timeout}
81 Wait Until Element Is Enabled xpath=${xpath} ${timeout}
82 Select From List xpath=${xpath} ${value}
84 Input Text When Enabled
85 [Arguments] ${xpath} ${value} ${timeout}=${GLOBAL_VID_UI_TIMEOUT_MEDIUM}
86 Wait Until Page Contains Element xpath=${xpath} ${timeout}
87 Wait Until Element Is Enabled xpath=${xpath} ${timeout}
88 Input Text xpath=${xpath} ${value}
91 [Arguments] ${mso_response_text}
92 ${request_list}= Split String ${mso_response_text} 202)\n 1
93 ${clean_string}= Replace String ${request_list[1]} \n ${empty}
94 ${json}= To Json ${clean_string}
95 ${request_id}= Catenate ${json['requestReferences']['requestId']}
96 [Return] ${request_id}
99 [Arguments] ${mso_response_text}
100 ${request_list}= Split String ${mso_response_text} 202)\n 1
101 ${json}= To Json ${request_list[1]}
102 ${request_id}= Catenate ${json['requestReferences']['instanceId']}
103 [Return] ${request_id}
105 Get Model UUID from VID
106 [Documentation] Must use UI since rest call get redirect to portal and get DNS error
107 ... Search all services and match on the invariantUUID
108 [Arguments] ${invariantUUID}
109 Go To ${VID_ENDPOINT}${VID_ENV}/rest/models/services
110 ${resp}= Get Text xpath=//body/pre
111 ${json}= To Json ${resp}
112 ${services}= Get From Dictionary ${json} services
113 :FOR ${dict} IN @{services}
114 \ ${uuid}= Get From DIctionary ${dict} uuid
115 \ ${inv}= Get From DIctionary ${dict} invariantUUID
116 \ Return From Keyword If "${invariantUUID}" == "${inv}" ${uuid}
120 Get Module Names from VID
121 [Documentation] Must use UI since rest call get redirect to portal and get DNS error
122 ... Given the invariantUUID of the model, mock up the vf_modules list passed to Preload VNF
123 [Arguments] ${invariantUUID}
124 ${id}= Get Model UUID from VID ${invariantUUID}
125 Go To ${VID_ENDPOINT}${VID_ENV}/rest/models/services/${id}
126 ${resp}= Get Text xpath=//body/pre
127 ${json}= To Json ${resp}
128 ${modules}= Create List
129 ${vnfs}= Get From Dictionary ${json} vnfs
130 ${keys}= Get Dictionary Keys ${vnfs}
131 :FOR ${key} IN @{keys}
132 \ Add VFModule ${vnfs['${key}']} ${modules}
136 [Documentation] Dig the vf module names from the VID service model
137 [Arguments] ${vnf} ${modules}
138 ${vfModules}= Get From Dictionary ${vnf} vfModules
139 ${keys}= Get Dictionary Keys ${vfModules}
140 :FOR ${key} IN @{keys}
141 \ ${module}= Get From Dictionary ${vfModules} ${key}
142 \ ${dict}= Create Dictionary name=${module['name']}
143 \ Append to List ${modules} ${dict}