blob: 54802003b1eac465d5755b74b884ce9e90badfd8 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001*** Settings ***
2Documentation The main interface for interacting with ASDC. It handles low level stuff like managing the http request library and DCAE required fields
Yang Xu7037e542018-12-28 01:19:26 -05003Library RequestsLibrary
Jerry Floode2a48d72017-06-21 15:06:29 -04004Library UUID
5Library JSONUtils
DR695Hccff30b2017-02-17 18:44:24 -05006Library OperatingSystem
7Library Collections
Yang Xu7037e542018-12-28 01:19:26 -05008Library ExtendedSelenium2Library
bdfreeman1421b2a49512018-11-25 07:32:19 -05009Library HttpLibrary.HTTP
Yang Xu7037e542018-12-28 01:19:26 -050010Library ArchiveLibrary
11Library HEATUtils
DR695Hccff30b2017-02-17 18:44:24 -050012Resource global_properties.robot
13Resource browser_setup.robot
14Resource json_templater.robot
15*** Variables ***
16${ASDC_DESIGNER_USER_ID} cs0008
17${ASDC_TESTER_USER_ID} jm0007
18${ASDC_GOVERNOR_USER_ID} gv0001
19${ASDC_OPS_USER_ID} op0001
20${ASDC_HEALTH_CHECK_PATH} /sdc1/rest/healthCheck
21${ASDC_VENDOR_LICENSE_MODEL_PATH} /onboarding-api/v1.0/vendor-license-models
22${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH} /onboarding-api/v1.0/vendor-software-products
23${ASDC_VENDOR_KEY_GROUP_PATH} /license-key-groups
24${ASDC_VENDOR_ENTITLEMENT_POOL_PATH} /entitlement-pools
25${ASDC_VENDOR_FEATURE_GROUP_PATH} /feature-groups
26${ASDC_VENDOR_LICENSE_AGREEMENT_PATH} /license-agreements
27${ASDC_VENDOR_ACTIONS_PATH} /actions
Jerry Floode2a48d72017-06-21 15:06:29 -040028${ASDC_VENDOR_SOFTWARE_UPLOAD_PATH} /orchestration-template-candidate
Yang Xu2ec80382018-11-01 12:30:37 -040029${ASDC_FE_CATALOG_RESOURCES_PATH} /sdc1/feProxy/rest/v1/catalog/resources
Brian Freemaneef7c6f2018-11-16 18:42:21 -050030${ASDC_FE_CATALOG_SERVICES_PATH} /sdc1/feProxy/rest/v1/catalog/services
DR695Hccff30b2017-02-17 18:44:24 -050031${ASDC_CATALOG_RESOURCES_PATH} /sdc2/rest/v1/catalog/resources
32${ASDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services
33${ASDC_CATALOG_INACTIVE_RESOURCES_PATH} /sdc2/rest/v1/inactiveComponents/resource
Brian Freemaneef7c6f2018-11-16 18:42:21 -050034${ASDC_CATALOG_RESOURCES_QUERY_PATH} /sdc2/rest/v1/catalog/resources/resourceName
DR695Hccff30b2017-02-17 18:44:24 -050035${ASDC_CATALOG_INACTIVE_SERVICES_PATH} /sdc2/rest/v1/inactiveComponents/service
36${ASDC_CATALOG_LIFECYCLE_PATH} /lifecycleState
37${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} /resourceInstance
38${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state
39${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH} /distribution
40${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve
41${ASDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} /distribution/PROD/activate
42${ASDC_LICENSE_MODEL_TEMPLATE} robot/assets/templates/asdc/license_model.template
43${ASDC_KEY_GROUP_TEMPLATE} robot/assets/templates/asdc/key_group.template
44${ASDC_ENTITLEMENT_POOL_TEMPLATE} robot/assets/templates/asdc/entitlement_pool.template
45${ASDC_FEATURE_GROUP_TEMPLATE} robot/assets/templates/asdc/feature_group.template
46${ASDC_LICENSE_AGREEMENT_TEMPLATE} robot/assets/templates/asdc/license_agreement.template
47${ASDC_ACTION_TEMPLATE} robot/assets/templates/asdc/action.template
48${ASDC_SOFTWARE_PRODUCT_TEMPLATE} robot/assets/templates/asdc/software_product.template
49${ASDC_CATALOG_RESOURCE_TEMPLATE} robot/assets/templates/asdc/catalog_resource.template
50${ASDC_USER_REMARKS_TEMPLATE} robot/assets/templates/asdc/user_remarks.template
51${ASDC_CATALOG_SERVICE_TEMPLATE} robot/assets/templates/asdc/catalog_service.template
52${ASDC_RESOURCE_INSTANCE_TEMPLATE} robot/assets/templates/asdc/resource_instance.template
Yang Xu2ec80382018-11-01 12:30:37 -040053${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} robot/assets/templates/asdc/catalog_vnf_properties.template
54${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} robot/assets/templates/asdc/catalog_vnf_inputs.template
Brian Freemaneef7c6f2018-11-16 18:42:21 -050055${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} robot/assets/templates/asdc/catalog_net_input_properties.template
bdfreeman1421b2a49512018-11-25 07:32:19 -050056${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} robot/assets/templates/asdc/catalog_resource_alloted_resource.template
57${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} robot/assets/templates/asdc/catalog_allotted_properties.template
58${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} robot/assets/templates/asdc/catalog_allotted_inputs.template
Brian Freemanf508ab22018-03-15 21:19:41 -050059${ASDC_FE_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_FE_IP_ADDR}:${GLOBAL_ASDC_FE_PORT}
60${ASDC_BE_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_IP_ADDR}:${GLOBAL_ASDC_BE_PORT}
Brian Freeman44b8bb32018-05-03 21:08:42 -050061${ASDC_BE_ONBOARD_ENDPOINT} ${GLOBAL_ASDC_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SDC_BE_ONBOARD_IP_ADDR}:${GLOBAL_ASDC_BE_ONBOARD_PORT}
DR695Hbf5a3a32017-06-30 13:09:57 -040062
DR695Hccff30b2017-02-17 18:44:24 -050063*** Keywords ***
64Distribute Model From ASDC
65 [Documentation] goes end to end creating all the asdc objects based ona model and distributing it to the systems. it then returns the service name, vf name and vf module name
Brian Freemaneef7c6f2018-11-16 18:42:21 -050066 [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}= ${service}=
bdfreeman1421b2a49512018-11-25 07:32:19 -050067 # For Testing use random service names
Brian Freemaneef7c6f2018-11-16 18:42:21 -050068 #${random}= Get Current Date
69 #${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}_${random}
jf986075010a42017-02-22 16:52:54 -050070 ${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}
DR695Hccff30b2017-02-17 18:44:24 -050071 ${catalog_resource_ids}= Create List
Jerry Flood3a169a32017-12-01 12:39:10 -050072 ${catalog_resources}= Create Dictionary
DR695Hccff30b2017-02-17 18:44:24 -050073 : FOR ${zip} IN @{model_zip_path}
Yang Xu2ec80382018-11-01 12:30:37 -040074 \ ${loop_catalog_resource_id}= Setup ASDC Catalog Resource ${zip} ${cds}
Jerry Floode2a48d72017-06-21 15:06:29 -040075 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
DR695Hccff30b2017-02-17 18:44:24 -050076 \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id}
77 \ Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
Jerry Flood3a169a32017-12-01 12:39:10 -050078 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
Brian Freemaneef7c6f2018-11-16 18:42:21 -050079 #
80 # do this here because the loop_catalog_resource_resp is different format after adding networks
81 ${vf_module}= Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule
82 #
83 # do network
84 ${networklist}= Get From Dictionary ${GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING} ${service}
85 ${xoffset}= Set Variable ${100}
86 ${generic_neutron_net_uuid}= Get Generic NeutronNet UUID
87 :FOR ${network} in @{networklist}
88 \ ${loop_catalog_resource_id}= Set Variable ${generic_neutron_net_uuid}
89 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
90 \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id}
Brian Freemaneef7c6f2018-11-16 18:42:21 -050091 \ ${loop_catalog_resource_id}= Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${network} ${xoffset} ${0}
92 \ ${nf_role}= Convert To Lowercase ${network}
93 \ Setup SDC Catalog Resource GenericNeutronNet Properties ${catalog_service_id} ${nf_role} ${loop_catalog_resource_id}
94 \ ${xoffset}= Set Variable ${xoffset+100}
95 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
DR695Hccff30b2017-02-17 18:44:24 -050096 ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id}
97 Checkin ASDC Catalog Service ${catalog_service_id}
98 Request Certify ASDC Catalog Service ${catalog_service_id}
99 Start Certify ASDC Catalog Service ${catalog_service_id}
100 # on certify it gets a new id
101 ${catalog_service_id}= Certify ASDC Catalog Service ${catalog_service_id}
102 Approve ASDC Catalog Service ${catalog_service_id}
Brian Freeman796b9eb2018-10-08 08:23:20 -0500103 : FOR ${DIST_INDEX} IN RANGE 1
Brian Freeman18df8912018-05-25 13:27:29 -0500104 \ Log Distribution Attempt ${DIST_INDEX}
105 \ Distribute ASDC Catalog Service ${catalog_service_id}
106 \ ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id}
Brian Freemanf940ee92018-05-25 21:09:05 -0500107 \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']}
108 \ Exit For Loop If '${status}'=='PASS'
Brian Freeman8c002d52018-07-30 19:35:36 -0500109 Should Be Equal As Strings ${status} PASS
Jerry Flood3a169a32017-12-01 12:39:10 -0500110 [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources}
Brian Freeman18df8912018-05-25 13:27:29 -0500111
bdfreeman1421b2a49512018-11-25 07:32:19 -0500112Distribute vCPEResCust Model From ASDC
113 [Documentation] goes end to end creating all the asdc objects for the vCPE ResCust Service model and distributing it to the systems. it then returns the service name, vf name and vf module name
114 [Arguments] ${model_zip_path} ${catalog_service_name}= ${cds}= ${service}=
115 # For testing use random service name
Brian Freeman9c42ae12018-11-27 14:33:27 -0500116 #${random}= Get Current Date
117 #${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}_${random}
118 # catalog_service_name already
119 ${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500120 Log To Console ${\n}ServiceName: ${catalog_service_name}_${random}
121 #${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name}
122 ${catalog_resource_ids}= Create List
123 ${catalog_resources}= Create Dictionary
124 : FOR ${zip} IN @{model_zip_path}
125 \ ${loop_catalog_resource_id}= Setup ASDC Catalog Resource ${zip} ${cds}
126 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
127 \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id}
128 \ Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
129 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
130 #
131 # do this here because the loop_catalog_resource_resp is different format after adding networks
132 ${vf_module}= Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule
133 #
134 # do allottedresource
135 ${allottedresource_list}= Create List TunnelXConn BRG
136 # Example data
137 #${tunnelxconn_dict}= Create Dictionary invariantUUID=8ac029e7-77aa-40d4-b28a-d17c02d5fd82 UUID=2ddc1b37-d7da-4aab-b645-ed7db34a5d03 node_type=org.openecomp.service.Demovcpevgmux
138 #${brg_dict}= Create Dictionary invariantUUID=ff0337b9-dbe2-4d88-bb74-18bf027ae586 UUID=1b6974f1-4aed-47f4-b962-816aa1261927 node_type=org.openecomp.service.Demovcpevbrgemu
Yang Xu7037e542018-12-28 01:19:26 -0500139 # Create /tmp/vcpe_allotted_resource_data.json with demo vgmux and brgemu CSARs
140 Create Allotted Resource Data File
bdfreeman1421b2a49512018-11-25 07:32:19 -0500141 ${vcpe_ar_data_file} Get File /tmp/vcpe_allotted_resource_data.json
142 ${tunnelxconn_invariant_uuid} Get Json Value ${vcpe_ar_data_file} /tunnelxconn/invariantUUID
143 ${tunnelxconn_uuid} Get Json Value ${vcpe_ar_data_file} /tunnelxconn/UUID
144 ${tunnelxconn_node_type} Get Json Value ${vcpe_ar_data_file} /tunnelxconn/node_type
145 ${brg_invariant_uuid} Get Json Value ${vcpe_ar_data_file} /brg/invariantUUID
146 ${brg_uuid} Get Json Value ${vcpe_ar_data_file} /brg/UUID
147 ${brg_node_type} Get Json Value ${vcpe_ar_data_file} /brg/node_type
148 ${tunnelxconn_dict}= Create Dictionary invariantUUID=${tunnelxconn_invariant_uuid} UUID=${tunnelxconn_uuid} node_type=${tunnelxconn_node_type}
149 ${brg_dict}= Create Dictionary invariantUUID=${brg_invariant_uuid} UUID=${brg_uuid} node_type=${brg_node_type}
150 ${xoffset}= Set Variable ${100}
151 ${allottedresource_uuid}= Get AllottedResource UUID
152 ${random}= Get Current Date
153 :FOR ${allottedresource} in @{allottedresource_list}
154 \ ${loop_catalog_resource_id}= Set Variable ${allottedresource_uuid}
155 \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id}
156 \ ${loop_catalog_resource_id}= Add ASDC Allotted Resource Catalog Resource 00000 ${allottedresource}_${random} ONAP ${loop_catalog_resource_id} ${allottedresource}
157 \ ${loop_catalog_resource_id2}= Add ASDC Resource Instance To Resource ${loop_catalog_resource_id} ${allottedresource_uuid} ${allottedresource} ${xoffset} ${0}
158 \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id}
159 #
160 # Set the properties to relate to the brg and gmux
161 #
162 \ Run Keyword If '${allottedresource}'=='TunnelXConn' Setup SDC Catalog Resource AllottedResource Properties ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} ${tunnelxconn_dict['invariantUUID']} ${tunnelxconn_dict['UUID']} ${tunnelxconn_dict['node_type']}
163 \ Run Keyword If '${allottedresource}'=='BRG' Setup SDC Catalog Resource AllottedResource Properties ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id} ${brg_dict['invariantUUID']} ${brg_dict['UUID']} ${brg_dict['node_type']}
164 #
165 # Set the nf_role nf_type
166 #
167 \ Run Keyword If '${allottedresource}'=='TunnelXConn' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id}
168 \ Run Keyword If '${allottedresource}'=='BRG' Setup SDC Catalog Resource AllottedResource Inputs ${catalog_service_id} ${allottedresource} ${loop_catalog_resource_id}
169
170 \ ${loop_catalog_resource_id}= Certify ASDC Catalog Resource ${loop_catalog_resource_id} ${ASDC_DESIGNER_USER_ID}
171 \ Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']}
172
173
174
175
176
177 \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp}
178 ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id}
179 Checkin ASDC Catalog Service ${catalog_service_id}
180 Request Certify ASDC Catalog Service ${catalog_service_id}
181 Start Certify ASDC Catalog Service ${catalog_service_id}
182 # on certify it gets a new id
183 ${catalog_service_id}= Certify ASDC Catalog Service ${catalog_service_id}
184 Approve ASDC Catalog Service ${catalog_service_id}
185 : FOR ${DIST_INDEX} IN RANGE 1
186 \ Log Distribution Attempt ${DIST_INDEX}
187 \ Distribute ASDC Catalog Service ${catalog_service_id}
188 \ ${catalog_service_resp}= Get ASDC Catalog Service ${catalog_service_id}
189 \ ${status} ${_} = Run Keyword And Ignore Error Loop Over Check Catalog Service Distributed ${catalog_service_resp['uuid']}
190 \ Exit For Loop If '${status}'=='PASS'
191 #\ Exit For Loop If '${dist_status}'=='EXIT'
192 Should Be Equal As Strings ${status} PASS
193 [Return] ${catalog_service_resp['name']} ${loop_catalog_resource_resp['name']} ${vf_module} ${catalog_resource_ids} ${catalog_service_id} ${catalog_resources}
194
195
Yang Xu7037e542018-12-28 01:19:26 -0500196Create Allotted Resource Data File
197 [Documentation] Create alloted resource json data file
198 [Arguments]
199 ${allotted_resource}= Create Dictionary
200 ${allotted_csar_map}= Create Dictionary
201 Set To Dictionary ${allotted_csar_map} tunnelxconn=service-Demovcpevgmux-csar.csar
202 Set To Dictionary ${allotted_csar_map} brg=service-Demovcpevbrgemu-csar.csar
203 ${keys}= Get Dictionary Keys ${allotted_csar_map}
204 :for ${key} in @{keys}
205 \ ${csar}= Get From Dictionary ${allotted_csar_map} ${key}
206 \ ${dir} ${ext}= Split String From Right ${csar} - 1
207 \ Extract Zip File /tmp/csar/${csar} /tmp/csar/${dir}
208 \ ${template}= Catenate /tmp/csar/${dir}/Definitions/${dir}-template.yml
209 \ ${json_str}= Template Yaml To Json ${template}
210 \ ${json_obj}= To Json ${json_str}
211 \ ${attrs}= Create Dictionary
212 \ Set To Dictionary ${attrs} invariantUUID=${json_obj['metadata']['invariantUUID']}
213 \ Set To Dictionary ${attrs} UUID=${json_obj['metadata']['UUID']}
214 \ Set To Dictionary ${attrs} node_type=${json_obj['topology_template']['substitution_mappings']['node_type']}
215 \ Set To Dictionary ${allotted_resource} ${key}=${attrs}
216 ${result_str}= Evaluate json.dumps(${allotted_resource}, indent=2) json
217 Log To Console ${result_str}
218 Create File /tmp/vcpe_allotted_resource_data.json ${result_str}
219
220
bdfreeman14211ad11d92018-11-17 18:47:37 +0000221Download CSAR
222 [Documentation] Download CSAR
223 [Arguments] ${catalog_service_id} ${save_directory}=/tmp/csar
224 # get meta data
225 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/filteredDataByParams?include=toscaArtifacts ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ENDPOINT}
226 ${csar_resource_id}= Set Variable ${resp.json()['toscaArtifacts']['assettoscacsar']['uniqueId']}
227 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}/artifacts/${csar_resource_id}
228 ${csar_file_name}= Set Variable ${resp.json()['artifactName']}
229 ${base64Obj}= Set Variable ${resp.json()['base64Contents']}
230 ${binObj}= Evaluate base64.b64decode("${base64Obj}") modules=base64
231 Create Binary File ${save_directory}/${csar_file_name} ${binObj}
232 Log To Console Downloaded:${csar_file_name}
233 [Return]
234
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500235
236Get Generic NeutronNet UUID
237 [Documentation] Lookoup the UUID of the Generic NeutronNetwork Resource
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500238 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_RESOURCES_QUERY_PATH}/Generic%20NeutronNet/resourceVersion/1.0 ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ENDPOINT}
239 [Return] ${resp.json()['allVersions']['1.0']}
240
bdfreeman1421b2a49512018-11-25 07:32:19 -0500241Get AllottedResource UUID
242 [Documentation] Lookoup the UUID of the Allotted Resource
243 # if this fails then the AllottedResource template got deleted from SDC by mistake
244 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_RESOURCES_QUERY_PATH}/AllottedResource/resourceVersion/1.0 ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ENDPOINT}
245 [Return] ${resp.json()['allVersions']['1.0']}
246
Brian Freeman18df8912018-05-25 13:27:29 -0500247Loop Over Check Catalog Service Distributed
Gary Wu58d58532018-07-27 16:02:51 -0700248 [Arguments] ${catalog_service_id}
Brian Freemanadaa2372018-10-24 12:25:22 -0500249 # SO watchdog timeout is 300 seconds need buffer
bdfreeman1421b2a49512018-11-25 07:32:19 -0500250 ${dist_status}= Set Variable CONTINUE
251 : FOR ${CHECK_INDEX} IN RANGE 20
Brian Freemanadaa2372018-10-24 12:25:22 -0500252 \ ${status} ${_} = Run Keyword And Ignore Error Check Catalog Service Distributed ${catalog_service_id} ${dist_status}
Gary Wu58d58532018-07-27 16:02:51 -0700253 \ Sleep 20s
Brian Freemanf940ee92018-05-25 21:09:05 -0500254 \ Return From Keyword If '${status}'=='PASS'
bdfreeman1421b2a49512018-11-25 07:32:19 -0500255 # need a way to exit the loop early on DISTRIBUTION_COMPLETE_ERROR ${dist_status} doesnt work
256 #\ Exit For Loop If '${dist_status}'=='EXIT'
257 Should Be Equal As Strings ${status} PASS
258 [Return]
Brian Freeman18df8912018-05-25 13:27:29 -0500259
DR695Hccff30b2017-02-17 18:44:24 -0500260Setup ASDC Catalog Resource
261 [Documentation] Creates all the steps a vf needs for an asdc catalog resource and returns the id
Yang Xu2ec80382018-11-01 12:30:37 -0400262 [Arguments] ${model_zip_path} ${cds}=
Brian Freemanb568e5e2018-04-05 21:03:38 -0500263 ${license_model_id} ${license_model_version_id}= Add ASDC License Model
264 ${key_group_id}= Add ASDC License Group ${license_model_id} ${license_model_version_id}
265 ${pool_id}= Add ASDC Entitlement Pool ${license_model_id} ${license_model_version_id}
266 ${feature_group_id}= Add ASDC Feature Group ${license_model_id} ${key_group_id} ${pool_id} ${license_model_version_id}
267 ${license_agreement_id}= Add ASDC License Agreement ${license_model_id} ${feature_group_id} ${license_model_version_id}
268 Submit ASDC License Model ${license_model_id} ${license_model_version_id}
269 ${license_model_resp}= Get ASDC License Model ${license_model_id} ${license_model_version_id}
Brian Freeman9c42ae12018-11-27 14:33:27 -0500270 # /var/opt/OpenECOMP_ETE/demo/heat/temp/vCPE_infra.zip
271 ${matches}= Get Regexp Matches ${model_zip_path} temp/(.*)\.zip 1
272 ${software_product_name_prefix}= Set Variable ${matches[0]}
273 ${software_product_id} ${software_product_version_id}= Add ASDC Software Product ${license_agreement_id} ${feature_group_id} ${license_model_resp['vendorName']} ${license_model_id} ${license_model_version_id} ${software_product_name_prefix}
Brian Freemanb568e5e2018-04-05 21:03:38 -0500274 Upload ASDC Heat Package ${software_product_id} ${model_zip_path} ${software_product_version_id}
275 Validate ASDC Software Product ${software_product_id} ${software_product_version_id}
276 Submit ASDC Software Product ${software_product_id} ${software_product_version_id}
277 Package ASDC Software Product ${software_product_id} ${software_product_version_id}
278 ${software_product_resp}= Get ASDC Software Product ${software_product_id} ${software_product_version_id}
279 ${catalog_resource_id}= Add ASDC Catalog Resource ${license_agreement_id} ${software_product_resp['name']} ${license_model_resp['vendorName']} ${software_product_id}
Yang Xu2ec80382018-11-01 12:30:37 -0400280 # Check if need to set up CDS properties
281 Run Keyword If '${cds}' == 'vfwng' Setup ASDC Catalog Resource CDS Properties ${catalog_resource_id}
282
Brian Freeman391680a2018-08-11 15:20:58 -0500283 ${catalog_resource_id}= Certify ASDC Catalog Resource ${catalog_resource_id} ${ASDC_DESIGNER_USER_ID}
DR695Hccff30b2017-02-17 18:44:24 -0500284 [Return] ${catalog_resource_id}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500285
286Setup SDC Catalog Resource GenericNeutronNet Properties
bdfreeman1421b2a49512018-11-25 07:32:19 -0500287 [Documentation] Set up GenericNeutronNet properties and inputs
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500288 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_parent_service_id}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500289 ${resp}= Get ASDC Catalog Resource Component Instances Properties ${catalog_service_id}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500290 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
291 # componentInstances can have 1 or more than 1 entry
292 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
293 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
294 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
295 ... ELSE Set Variable ${componentInstances}
296 :FOR ${item} IN @{componentInstancesList}
297 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role}
298 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
299 \ ${componentInstance1}= Set Variable ${item}
300 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
301 \ ${name} Set Variable ${comp['name']}
302 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} network_role
303 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
304 \ ${description} Set Variable ${comp['description']}
305 \ ${description}= Replace String ${description} ${\n} \
306 \ ${uniqueId} Set Variable ${comp['uniqueId']}
307 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
308 \ ${ownerId} Set Variable ${comp['ownerId']}
309 \ ${dict}= Create Dictionary parentUniqueId=${parentUniqueId} ownerId=${ownerId} uniqueId=${uniqueId} description=${description}
310 \ Run Keyword If '${name}'=='network_role' Set To Dictionary ${dict} name=${name} value=${nf_role}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500311 \ ${data}= Fill JSON Template File ${SDC_CATALOG_NET_RESOURCE_INPUT_TEMPLATE} ${dict}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500312 \ ${response}= Set ASDC Catalog Resource Component Instance Properties ${catalog_parent_service_id} ${catalog_service_id} ${data}
313 #\ Log To Console resp=${response}
314 [Return]
315
bdfreeman1421b2a49512018-11-25 07:32:19 -0500316
317Setup SDC Catalog Resource AllottedResource Properties
318 [Documentation] Set up Allotted Resource properties and inputs
319 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id} ${invariantUUID} ${UUID} ${node_type}
320 # Set component instances properties
321 ${nf_role_lc}= Convert To Lowercase ${nf_role}
322 ${resp}= Get ASDC Catalog Resource Component Instances Properties For Resource ${catalog_resource_id}
323 ${componentInstances} Set Variable @{resp['componentInstancesProperties']}
324 # componentInstances can have 1 or more than 1 entry
325 ${passed}= Run Keyword And Return Status Evaluate type(${componentInstances})
326 ${type}= Run Keyword If ${passed} Evaluate type(${componentInstances})
327 ${componentInstancesList}= Run Keyword If "${type}"!="<type 'list'>" Create List ${componentInstances}
328 ... ELSE Set Variable ${componentInstances}
329 :FOR ${item} IN @{componentInstancesList}
330 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${item} ${nf_role_lc}
331 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
332 \ ${componentInstance1}= Set Variable ${item}
333 ${dict}= Create Dictionary
334 :FOR ${comp} IN @{resp['componentInstancesProperties']["${componentInstance1}"]}
335 \ ${name} Set Variable ${comp['name']}
336 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain Any ${name} network_role providing_service_invariant_uuid providing_service_uuid providing_service_name uniqueId
337 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
338 \ ${parentUniqueId} Set Variable ${comp['parentUniqueId']}
339 \ ${ownerId} Set Variable ${comp['ownerId']}
340 \ Set To Dictionary ${dict} parentUniqueId=${parentUniqueId} ownerId=${ownerId}
341 \ Run Keyword If '${name}'=='providing_service_invariant_uuid' Set To Dictionary ${dict} providing_service_invariant_uuid=${invariantUUID}
342 \ Run Keyword If '${name}'=='providing_service_uuid' Set To Dictionary ${dict} providing_service_uuid=${UUID}
343 \ Run Keyword If '${name}'=='providing_service_name' Set To Dictionary ${dict} providing_service_name=${node_type}
344 # Sets it for each loop but should be one
345 \ ${uniqueId} Set Variable ${comp['uniqueId']}
346 \ ${uniqueId} Fetch From Left ${uniqueId} .
347 \ Set To Dictionary ${dict} uniqueId=${uniqueId}
348 ${data}= Fill JSON Template File ${SDC_CATALOG_ALLOTTED_RESOURCE_PROPERTIES_TEMPLATE} ${dict}
349 ${response}= Set ASDC Catalog Resource Component Instance Properties For Resource ${catalog_resource_id} ${componentInstance1} ${data}
350 Log To Console resp=${response}
351
352
353Setup SDC Catalog Resource AllottedResource Inputs
354 [Documentation] Set up Allotted Resource inputs
355 [Arguments] ${catalog_service_id} ${nf_role} ${catalog_resource_id}
356 # Set vnf inputs
357 ${resp}= Get ASDC Catalog Resource Inputs ${catalog_resource_id}
358 ${dict}= Create Dictionary
359 :FOR ${comp} in @{resp['inputs']}
360 \ ${name} Set Variable ${comp['name']}
361 \ ${uid} Set Variable ${comp['uniqueId']}
362 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=${nf_role} nf_type_uid=${uid}
363 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=${nf_role} nf_role_uid=${uid}
364 ${data}= Fill JSON Template File ${SDC_CATALOG_ALLOTTED_RESOURCE_INPUTS_TEMPLATE} ${dict}
365 ${response}= Set ASDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
366 [Return] ${response}
367
Yang Xu2ec80382018-11-01 12:30:37 -0400368Setup ASDC Catalog Resource CDS Properties
369 [Documentation] Set up vfwng VNF properties and inputs for CDS
370 [Arguments] ${catalog_resource_id}
371 # Set vnf module properties
372 ${resp}= Get ASDC Catalog Resource Component Instances ${catalog_resource_id}
373 :FOR ${comp} in @{resp['componentInstances']}
374 \ ${name} Set Variable ${comp['name']}
375 \ ${uniqueId} Set Variable ${comp['uniqueId']}
376 \ ${actualComponentUid} Set Variable ${comp['actualComponentUid']}
377 \ ${test} ${v}= Run Keyword and Ignore Error Should Contain ${name} abstract_
378 \ Run Keyword If '${test}' == 'FAIL' Continue For Loop
379 \ ${response}= Get ASDC Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${actualComponentUid}
380 \ ${dict}= Create Dictionary parent_id=${response[6]['parentUniqueId']}
381 \ Run Keyword If '${name}'=='abstract_vfw' Set To Dictionary ${dict} nfc_function=vfw nfc_naming_policy=SDNC_Policy.ONAP_VFW_NAMING_TIMESTAMP
382 \ Run Keyword If '${name}'=='abstract_vpg' Set To Dictionary ${dict} nfc_function=vpg nfc_naming_policy=SDNC_Policy.ONAP_VPG_NAMING_TIMESTAMP
383 \ Run Keyword If '${name}'=='abstract_vsn' Set To Dictionary ${dict} nfc_function=vsn nfc_naming_policy=SDNC_Policy.ONAP_VSN_NAMING_TIMESTAMP
384 \ ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_VNF_PROPERTIES_TEMPLATE} ${dict}
Yang Xu74cfb862018-12-06 21:57:32 -0500385 \ ${response}= Set CDS Catalog Resource Component Instance Properties ${catalog_resource_id} ${uniqueId} ${data}
Yang Xu2ec80382018-11-01 12:30:37 -0400386 \ Log To Console resp=${response}
387
388 # Set vnf inputs
389 ${resp}= Get ASDC Catalog Resource Inputs ${catalog_resource_id}
390 ${dict}= Create Dictionary
391 :FOR ${comp} in @{resp['inputs']}
392 \ ${name} Set Variable ${comp['name']}
393 \ ${uid} Set Variable ${comp['uniqueId']}
394 \ Run Keyword If '${name}'=='nf_function' Set To Dictionary ${dict} nf_function=ONAP-FIREWALL nf_function_uid=${uid}
395 \ Run Keyword If '${name}'=='nf_type' Set To Dictionary ${dict} nf_type=FIREWALL nf_type_uid=${uid}
396 \ Run Keyword If '${name}'=='nf_naming_code' Set To Dictionary ${dict} nf_naming_code=vfw nf_naming_code_uid=${uid}
397 \ Run Keyword If '${name}'=='nf_role' Set To Dictionary ${dict} nf_role=vFW nf_role_uid=${uid}
398 \ Run Keyword If '${name}'=='cloud_env' Set To Dictionary ${dict} cloud_env=openstack cloud_env_uid=${uid}
399 ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_VNF_INPUTS_TEMPLATE} ${dict}
400 ${response}= Set ASDC Catalog Resource VNF Inputs ${catalog_resource_id} ${data}
401
DR695Hccff30b2017-02-17 18:44:24 -0500402Add ASDC License Model
403 [Documentation] Creates an asdc license model and returns its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400404 ${uuid}= Generate UUID
405 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
DR695Hccff30b2017-02-17 18:44:24 -0500406 ${map}= Create Dictionary vendor_name=${shortened_uuid}
407 ${data}= Fill JSON Template File ${ASDC_LICENSE_MODEL_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500408 ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500409 Should Be Equal As Strings ${resp.status_code} 200
Brian Freemanb568e5e2018-04-05 21:03:38 -0500410 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
DR695Hccff30b2017-02-17 18:44:24 -0500411Get ASDC License Model
412 [Documentation] gets an asdc license model by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400413 [Arguments] ${id} ${version_id}=0.1
Brian Freeman44b8bb32018-05-03 21:08:42 -0500414 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
Jerry Floode2a48d72017-06-21 15:06:29 -0400415 [Return] ${resp.json()}
416Get ASDC License Models
417 [Documentation] gets an asdc license model by its id
Brian Freeman44b8bb32018-05-03 21:08:42 -0500418 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_LICENSE_MODEL_PATH} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
419
DR695Hccff30b2017-02-17 18:44:24 -0500420 [Return] ${resp.json()}
421Checkin ASDC License Model
422 [Documentation] checksin an asdc license model by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400423 [Arguments] ${id} ${version_id}=0.1
DR695Hccff30b2017-02-17 18:44:24 -0500424 ${map}= Create Dictionary action=Checkin
425 ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500426 ${resp}= Run ASDC Put Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500427 Should Be Equal As Strings ${resp.status_code} 200
428 [Return] ${resp.json()}
429Submit ASDC License Model
430 [Documentation] submits an asdc license model by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400431 [Arguments] ${id} ${version_id}=0.1
DR695Hccff30b2017-02-17 18:44:24 -0500432 ${map}= Create Dictionary action=Submit
433 ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500434 ${resp}= Run ASDC Put Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500435 Should Be Equal As Strings ${resp.status_code} 200
436 [Return] ${resp.json()}
437Checkin ASDC Software Product
438 [Documentation] checksin an asdc Software Product by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400439 [Arguments] ${id} ${version_id}=0.1
DR695Hccff30b2017-02-17 18:44:24 -0500440 ${map}= Create Dictionary action=Checkin
Jerry Floode2a48d72017-06-21 15:06:29 -0400441 ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500442 ${resp}= Run ASDC Put Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
Jerry Floode2a48d72017-06-21 15:06:29 -0400443 Should Be Equal As Strings ${resp.status_code} 200
444 [Return] ${resp.json()}
445Validate ASDC Software Product
446 [Documentation] checksin an asdc Software Product by its id
447 [Arguments] ${id} ${version_id}=0.1
448 ${data}= Catenate
Brian Freeman44b8bb32018-05-03 21:08:42 -0500449 ${resp}= Run ASDC Put Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}/orchestration-template-candidate/process ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500450 Should Be Equal As Strings ${resp.status_code} 200
451 [Return] ${resp.json()}
452Submit ASDC Software Product
453 [Documentation] submits an asdc Software Product by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400454 [Arguments] ${id} ${version_id}=0.1
DR695Hccff30b2017-02-17 18:44:24 -0500455 ${map}= Create Dictionary action=Submit
Jerry Floode2a48d72017-06-21 15:06:29 -0400456 ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500457 ${resp}= Run ASDC Put Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500458 Should Be Equal As Strings ${resp.status_code} 200
459 [Return] ${resp.json()}
460Package ASDC Software Product
461 [Documentation] creates_package on an asdc Software Product by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400462 [Arguments] ${id} ${version_id}=0.1
DR695Hccff30b2017-02-17 18:44:24 -0500463 ${map}= Create Dictionary action=Create_Package
Jerry Floode2a48d72017-06-21 15:06:29 -0400464 ${data}= Fill JSON Template File ${ASDC_ACTION_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500465 ${resp}= Run ASDC Put Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${id}/versions/${version_id}${ASDC_VENDOR_ACTIONS_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500466 Should Be Equal As Strings ${resp.status_code} 200
Jerry Floode2a48d72017-06-21 15:06:29 -0400467 [Return] ${resp.json()}
DR695Hccff30b2017-02-17 18:44:24 -0500468Add ASDC Entitlement Pool
469 [Documentation] Creates an asdc Entitlement Pool and returns its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400470 [Arguments] ${license_model_id} ${version_id}=0.1
471 ${uuid}= Generate UUID
472 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
DR695Hccff30b2017-02-17 18:44:24 -0500473 ${map}= Create Dictionary entitlement_pool_name=${shortened_uuid}
Jerry Floode2a48d72017-06-21 15:06:29 -0400474 ${data}= Fill JSON Template File ${ASDC_ENTITLEMENT_POOL_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500475 ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_ENTITLEMENT_POOL_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500476 Should Be Equal As Strings ${resp.status_code} 200
477 [Return] ${resp.json()['value']}
478Get ASDC Entitlement Pool
479 [Documentation] gets an asdc Entitlement Pool by its id
480 [Arguments] ${license_model_id} ${pool_id}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500481 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_ENTITLEMENT_POOL_PATH}/${pool_id} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500482 [Return] ${resp.json()}
483Add ASDC License Group
484 [Documentation] Creates an asdc license group and returns its id
Brian Freemanb568e5e2018-04-05 21:03:38 -0500485 [Arguments] ${license_model_id} ${version_id}=1.0
Jerry Floode2a48d72017-06-21 15:06:29 -0400486 ${uuid}= Generate UUID
487 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
DR695Hccff30b2017-02-17 18:44:24 -0500488 ${map}= Create Dictionary key_group_name=${shortened_uuid}
Jerry Floode2a48d72017-06-21 15:06:29 -0400489 ${data}= Fill JSON Template File ${ASDC_KEY_GROUP_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500490 ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_KEY_GROUP_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500491 Should Be Equal As Strings ${resp.status_code} 200
492 [Return] ${resp.json()['value']}
493Get ASDC License Group
494 [Documentation] gets an asdc license group by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400495 [Arguments] ${license_model_id} ${group_id} ${version_id}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500496 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_KEY_GROUP_PATH}/${group_id} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500497 [Return] ${resp.json()}
498Add ASDC Feature Group
499 [Documentation] Creates an asdc Feature Group and returns its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400500 [Arguments] ${license_model_id} ${key_group_id} ${entitlement_pool_id} ${version_id}=0.1
501 ${uuid}= Generate UUID
502 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
Jerry Flood80ff9852017-08-11 06:47:14 -0400503 ${map}= Create Dictionary feature_group_name=${shortened_uuid} key_group_id=${key_group_id} entitlement_pool_id=${entitlement_pool_id} manufacturer_reference_number=mrn${shortened_uuid}
Jerry Floode2a48d72017-06-21 15:06:29 -0400504 ${data}= Fill JSON Template File ${ASDC_FEATURE_GROUP_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500505 ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_FEATURE_GROUP_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500506 Should Be Equal As Strings ${resp.status_code} 200
507 [Return] ${resp.json()['value']}
508Get ASDC Feature Group
509 [Documentation] gets an asdc Feature Group by its id
510 [Arguments] ${license_model_id} ${group_id}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500511 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_FEATURE_GROUP_PATH}/${group_id} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500512 [Return] ${resp.json()}
513Add ASDC License Agreement
514 [Documentation] Creates an asdc License Agreement and returns its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400515 [Arguments] ${license_model_id} ${feature_group_id} ${version_id}=0.1
516 ${uuid}= Generate UUID
517 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
DR695Hccff30b2017-02-17 18:44:24 -0500518 ${map}= Create Dictionary license_agreement_name=${shortened_uuid} feature_group_id=${feature_group_id}
Jerry Floode2a48d72017-06-21 15:06:29 -0400519 ${data}= Fill JSON Template File ${ASDC_LICENSE_AGREEMENT_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500520 ${resp}= Run ASDC Post Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}/versions/${version_id}${ASDC_VENDOR_LICENSE_AGREEMENT_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500521 Should Be Equal As Strings ${resp.status_code} 200
522 [Return] ${resp.json()['value']}
523Get ASDC License Agreement
524 [Documentation] gets an asdc License Agreement by its id
525 [Arguments] ${license_model_id} ${agreement_id}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500526 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_LICENSE_MODEL_PATH}/${license_model_id}${ASDC_VENDOR_LICENSE_AGREEMENT_PATH}/${agreement_id} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500527 [Return] ${resp.json()}
528Add ASDC Software Product
529 [Documentation] Creates an asdc Software Product and returns its id
Brian Freeman9c42ae12018-11-27 14:33:27 -0500530 [Arguments] ${license_agreement_id} ${feature_group_id} ${license_model_name} ${license_model_id} ${license_model_version_id} ${name_prefix}
Jerry Floode2a48d72017-06-21 15:06:29 -0400531 ${uuid}= Generate UUID
Brian Freeman9c42ae12018-11-27 14:33:27 -0500532 ${shortened_uuid}= Evaluate str("${uuid}")[:13]
533 ${software_product_name}= Catenate ${name_prefix} ${shortened_uuid}
534 ${map}= Create Dictionary software_product_name=${software_product_name} feature_group_id=${feature_group_id} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} vendor_id=${license_model_id} version_id=${license_model_version_id}
Jerry Floode2a48d72017-06-21 15:06:29 -0400535 ${data}= Fill JSON Template File ${ASDC_SOFTWARE_PRODUCT_TEMPLATE} ${map}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500536 ${resp}= Run ASDC Post Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH} ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500537 Should Be Equal As Strings ${resp.status_code} 200
Brian Freemanb568e5e2018-04-05 21:03:38 -0500538 [Return] ${resp.json()['itemId']} ${resp.json()['version']['id']}
DR695Hccff30b2017-02-17 18:44:24 -0500539Get ASDC Software Product
540 [Documentation] gets an asdc Software Product by its id
Jerry Floode2a48d72017-06-21 15:06:29 -0400541 [Arguments] ${software_product_id} ${version_id}=0.1
Brian Freeman44b8bb32018-05-03 21:08:42 -0500542 ${resp}= Run ASDC Get Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}/versions/${version_id} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500543 [Return] ${resp.json()}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500544
DR695Hccff30b2017-02-17 18:44:24 -0500545Add ASDC Catalog Resource
546 [Documentation] Creates an asdc Catalog Resource and returns its id
547 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id}
548 ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name}
Jerry Floode2a48d72017-06-21 15:06:29 -0400549 ${data}= Fill JSON Template File ${ASDC_CATALOG_RESOURCE_TEMPLATE} ${map}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500550 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID}
DR695Hccff30b2017-02-17 18:44:24 -0500551 Should Be Equal As Strings ${resp.status_code} 201
552 [Return] ${resp.json()['uniqueId']}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500553
554Add ASDC Allotted Resource Catalog Resource
555 [Documentation] Creates an asdc Allotted Resource Catalog Resource and returns its id
556 [Arguments] ${license_agreement_id} ${software_product_name} ${license_model_name} ${software_product_id} ${subcategory}
557 ${map}= Create Dictionary software_product_id=${software_product_id} software_product_name=${software_product_name} license_agreement_id=${license_agreement_id} vendor_name=${license_model_name} subcategory=${subcategory}
558 ${data}= Fill JSON Template File ${ASDC_ALLOTTED_RESOURCE_CATALOG_RESOURCE_TEMPLATE} ${map}
559 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH} ${data} ${ASDC_DESIGNER_USER_ID}
560 Should Be Equal As Strings ${resp.status_code} 201
561 [Return] ${resp.json()['uniqueId']}
562
DR695Hccff30b2017-02-17 18:44:24 -0500563Mark ASDC Catalog Resource Inactive
564 [Documentation] deletes an asdc Catalog Resource
565 [Arguments] ${catalog_resource_id}
566 ${resp}= Run ASDC Delete Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${ASDC_DESIGNER_USER_ID}
567 Should Be Equal As Strings ${resp.status_code} 204
568 [Return] ${resp}
569Delete Inactive ASDC Catalog Resources
570 [Documentation] delete all asdc Catalog Resources that are inactive
571 ${resp}= Run ASDC Delete Request ${ASDC_CATALOG_INACTIVE_RESOURCES_PATH} ${ASDC_DESIGNER_USER_ID}
572 Should Be Equal As Strings ${resp.status_code} 200
573 [Return] ${resp.json()}
574Get ASDC Catalog Resource
575 [Documentation] gets an asdc Catalog Resource by its id
576 [Arguments] ${catalog_resource_id}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500577 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id} ${ASDC_DESIGNER_USER_ID}
DR695Hccff30b2017-02-17 18:44:24 -0500578 [Return] ${resp.json()}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500579
Yang Xu2ec80382018-11-01 12:30:37 -0400580Get ASDC Catalog Resource Component Instances
581 [Documentation] gets asdc Catalog Resource Component Instances by its id
582 [Arguments] ${catalog_resource_id}
583 ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstances ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
584 [Return] ${resp.json()}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500585
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500586Get ASDC Catalog Resource Component Instances Properties
587 [Documentation] gets asdc Catalog Resource Component Instances Properties by its id
588 [Arguments] ${catalog_resource_id}
589 #${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstancesProperties ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
590 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstancesProperties ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ENDPOINT}
591 [Return] ${resp.json()}
592
bdfreeman1421b2a49512018-11-25 07:32:19 -0500593Get ASDC Catalog Resource Component Instances Properties For Resource
594 [Documentation] gets asdc Catalog Resource Component Instances Properties for a Resource (VF) by its id
595 [Arguments] ${catalog_resource_id}
596 ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=componentInstancesProperties ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
597 [Return] ${resp.json()}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500598
Yang Xu2ec80382018-11-01 12:30:37 -0400599Get ASDC Catalog Resource Inputs
600 [Documentation] gets asdc Catalog Inputs by its id
601 [Arguments] ${catalog_resource_id}
602 ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/filteredDataByParams?include=inputs ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
603 [Return] ${resp.json()}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500604
Yang Xu2ec80382018-11-01 12:30:37 -0400605Get ASDC Catalog Resource Component Instance Properties
606 [Documentation] gets an asdc Catalog Resource properties by its id
607 [Arguments] ${catalog_resource_id} ${component_instance_id} ${component_id}
608 ${resp}= Run ASDC Get Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/componentInstances/${component_instance_id}/${component_id}/inputs ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
609 [Return] ${resp.json()}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500610
Yang Xu2ec80382018-11-01 12:30:37 -0400611Set ASDC Catalog Resource Component Instance Properties
612 [Documentation] sets an asdc Catalog Resource by its id
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500613 [Arguments] ${catalog_resource_id} ${component_parent_service_id} ${data}
614 #${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${component_parent_service_id}/resourceInstance/${catalog_resource_id}/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
615 ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_SERVICES_PATH}/${component_parent_service_id}/resourceInstance/${catalog_resource_id}/properties ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500616 [Return] ${resp.json()}
617
618Set ASDC Catalog Resource Component Instance Properties For Resource
619 [Documentation] sets an asdc Catalog Resource by its id
620 [Arguments] ${catalog_parent_resource_id} ${catalog_resource_id} ${data}
621 #${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_parent_resource_id}/resourceInstance/${catalog_resource_id}/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
622 ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_parent_resource_id}/resourceInstance/${catalog_resource_id}/properties ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
623 [Return] ${resp.json()}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500624
Yang Xu74cfb862018-12-06 21:57:32 -0500625Set CDS Catalog Resource Component Instance Properties
626 [Documentation] sets an asdc Catalog Resource by its id
627 [Arguments] ${catalog_resource_id} ${component_instance_id} ${data}
628 ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/resourceInstance/${component_instance_id}/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
629 [Return] ${resp.json()}
630
Yang Xu2ec80382018-11-01 12:30:37 -0400631Set ASDC Catalog Resource VNF Inputs
632 [Documentation] sets an asdc Catalog Resource by its id
633 [Arguments] ${catalog_resource_id} ${data}
634 ${resp}= Run ASDC Post Request ${ASDC_FE_CATALOG_RESOURCES_PATH}/${catalog_resource_id}/update/inputs ${data} ${ASDC_DESIGNER_USER_ID} ${ASDC_FE_ENDPOINT}
635 [Return] ${resp.json()}
Brian Freeman79b00ce2018-11-01 14:57:53 -0500636Get SDC Demo Vnf Catalog Resource
637 [Documentation] gets resource id's for demonstration VNFs for instantiate
638 [Arguments] ${service_name}
639 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}/serviceName/${service_name}/serviceVersion/1.0
640 @{ITEMS}= Copy List ${resp.json()['componentInstances']}
641 ${demo_catalog_resource}= Create Dictionary
642 :FOR ${ELEMENT} IN @{ITEMS}
643 \ Log ${ELEMENT['name']}
644 \ Log ${ELEMENT['groupInstances'][0]['groupName']}
645 \ ${vnf}= Get VNF From Group Name ${ELEMENT['groupInstances'][0]['groupName']} ${service_name}
646 \ ${vnf_data}= Create Dictionary vnf_type=${ELEMENT['name']} vf_module=${ELEMENT['groupInstances'][0]['groupName']}
647 \ LOG ${vnf_data}
648 \ Set To Dictionary ${demo_catalog_resource} ${vnf}=${vnf_data}
649 \ LOG ${demo_catalog_resource}
650 [Return] ${demo_catalog_resource}
651
652Get VNF From Group Name
653 [Documentation] looks up vnf key from service mapping for a regex on groupName and service_name
654 [Arguments] ${group_name} ${service_name}
655 ${vnf}= Set Variable If
656 ... ('${service_name}'=='demoVFWCL') and ('base_vfw' in '${group_name}') vFWSNK
657 ... ('${service_name}'=='demoVFWCL') and ('base_vpkg' in '${group_name}') vPKG
658 ... ('${service_name}'=='demoVLB') and ('base_vlb' in '${group_name}') vLB
659 [Return] ${vnf}
DR695Hccff30b2017-02-17 18:44:24 -0500660Checkin ASDC Catalog Resource
661 [Documentation] checksin an asdc Catalog Resource by its id
662 [Arguments] ${catalog_resource_id}
663 ${map}= Create Dictionary user_remarks=Robot remarks
Jerry Floode2a48d72017-06-21 15:06:29 -0400664 ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500665 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${ASDC_DESIGNER_USER_ID}
666 Should Be Equal As Strings ${resp.status_code} 200
667 [Return] ${resp.json()}
668Request Certify ASDC Catalog Resource
669 [Documentation] requests certify on an asdc Catalog Resource by its id
670 [Arguments] ${catalog_resource_id}
671 ${map}= Create Dictionary user_remarks=Robot remarks
Jerry Floode2a48d72017-06-21 15:06:29 -0400672 ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500673 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${ASDC_DESIGNER_USER_ID}
674 Should Be Equal As Strings ${resp.status_code} 200
675 [Return] ${resp.json()}
676Start Certify ASDC Catalog Resource
677 [Documentation] start certify an asdc Catalog Resource by its id
678 [Arguments] ${catalog_resource_id}
679 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${ASDC_TESTER_USER_ID}
680 Should Be Equal As Strings ${resp.status_code} 200
681 [Return] ${resp.json()}
682Certify ASDC Catalog Resource
683 [Documentation] start certify an asdc Catalog Resource by its id and returns the new id
Brian Freemandb1e7412018-08-01 12:46:01 -0500684 [Arguments] ${catalog_resource_id} ${user_id}=${ASDC_TESTER_USER_ID}
DR695Hccff30b2017-02-17 18:44:24 -0500685 ${map}= Create Dictionary user_remarks=Robot remarks
Jerry Floode2a48d72017-06-21 15:06:29 -0400686 ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map}
Brian Freemandb1e7412018-08-01 12:46:01 -0500687 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id}
DR695Hccff30b2017-02-17 18:44:24 -0500688 Should Be Equal As Strings ${resp.status_code} 200
689 [Return] ${resp.json()['uniqueId']}
Jerry Flood6bd1afa2017-10-09 09:59:23 -0400690
DR695Hccff30b2017-02-17 18:44:24 -0500691Upload ASDC Heat Package
Brian Freemanf508ab22018-03-15 21:19:41 -0500692 [Documentation] Creates an asdc Software Product and returns its id
693 [Arguments] ${software_product_id} ${file_path} ${version_id}=0.1
Jerry Flood6bd1afa2017-10-09 09:59:23 -0400694 ${files}= Create Dictionary
695 Create Multi Part ${files} upload ${file_path} contentType=application/zip
Brian Freeman44b8bb32018-05-03 21:08:42 -0500696 ${resp}= Run ASDC Post Files Request ${ASDC_VENDOR_SOFTWARE_PRODUCT_PATH}/${software_product_id}/versions/${version_id}${ASDC_VENDOR_SOFTWARE_UPLOAD_PATH} ${files} ${ASDC_DESIGNER_USER_ID} ${ASDC_BE_ONBOARD_ENDPOINT}
Brian Freemanf508ab22018-03-15 21:19:41 -0500697 Should Be Equal As Strings ${resp.status_code} 200
Jerry Flood6bd1afa2017-10-09 09:59:23 -0400698
DR695Hccff30b2017-02-17 18:44:24 -0500699Add ASDC Catalog Service
700 [Documentation] Creates an asdc Catalog Service and returns its id
jf986075010a42017-02-22 16:52:54 -0500701 [Arguments] ${catalog_service_name}
Jerry Floode2a48d72017-06-21 15:06:29 -0400702 ${uuid}= Generate UUID
jf986075010a42017-02-22 16:52:54 -0500703 ${shortened_uuid}= Evaluate str("${uuid}")[:23]
Jerry Floode2a48d72017-06-21 15:06:29 -0400704 ${catalog_service_name}= Set Variable If '${catalog_service_name}' =='' ${shortened_uuid} ${catalog_service_name}
jf986075010a42017-02-22 16:52:54 -0500705 ${map}= Create Dictionary service_name=${catalog_service_name}
Jerry Floode2a48d72017-06-21 15:06:29 -0400706 ${data}= Fill JSON Template File ${ASDC_CATALOG_SERVICE_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500707 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH} ${data} ${ASDC_DESIGNER_USER_ID}
708 Should Be Equal As Strings ${resp.status_code} 201
709 [Return] ${resp.json()['uniqueId']}
710Mark ASDC Catalog Service Inactive
711 [Documentation] Deletes an asdc Catalog Service
712 [Arguments] ${catalog_service_id}
713 ${resp}= Run ASDC Delete Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${ASDC_DESIGNER_USER_ID}
714 Should Be Equal As Strings ${resp.status_code} 204
715 [Return] ${resp}
716Delete Inactive ASDC Catalog Services
717 [Documentation] delete all asdc Catalog Serivces that are inactive
718 ${resp}= Run ASDC Delete Request ${ASDC_CATALOG_INACTIVE_SERVICES_PATH} ${ASDC_DESIGNER_USER_ID}
719 Should Be Equal As Strings ${resp.status_code} 200
720 [Return] ${resp.json()}
721Get ASDC Catalog Service
722 [Documentation] gets an asdc Catalog Service by its id
723 [Arguments] ${catalog_service_id}
724 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id} ${ASDC_DESIGNER_USER_ID}
725 [Return] ${resp.json()}
726Checkin ASDC Catalog Service
727 [Documentation] checksin an asdc Catalog Service by its id
728 [Arguments] ${catalog_service_id}
729 ${map}= Create Dictionary user_remarks=Robot remarks
Jerry Floode2a48d72017-06-21 15:06:29 -0400730 ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500731 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${ASDC_DESIGNER_USER_ID}
732 Should Be Equal As Strings ${resp.status_code} 200
733 [Return] ${resp.json()}
734Request Certify ASDC Catalog Service
735 [Documentation] requests certify on an asdc Catalog Service by its id
736 [Arguments] ${catalog_service_id}
737 ${map}= Create Dictionary user_remarks=Robot remarks
Jerry Floode2a48d72017-06-21 15:06:29 -0400738 ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500739 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${ASDC_DESIGNER_USER_ID}
740 Should Be Equal As Strings ${resp.status_code} 200
741 [Return] ${resp.json()}
742Start Certify ASDC Catalog Service
743 [Documentation] start certify an asdc Catalog Service by its id
744 [Arguments] ${catalog_service_id}
745 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${ASDC_TESTER_USER_ID}
746 Should Be Equal As Strings ${resp.status_code} 200
747 [Return] ${resp.json()}
748Certify ASDC Catalog Service
749 [Documentation] start certify an asdc Catalog Service by its id and returns the new id
750 [Arguments] ${catalog_service_id}
751 ${map}= Create Dictionary user_remarks=Robot remarks
Jerry Floode2a48d72017-06-21 15:06:29 -0400752 ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500753 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${ASDC_TESTER_USER_ID}
754 Should Be Equal As Strings ${resp.status_code} 200
755 [Return] ${resp.json()['uniqueId']}
756Approve ASDC Catalog Service
757 [Documentation] approve an asdc Catalog Service by its id
758 [Arguments] ${catalog_service_id}
759 ${map}= Create Dictionary user_remarks=Robot remarks
Jerry Floode2a48d72017-06-21 15:06:29 -0400760 ${data}= Fill JSON Template File ${ASDC_USER_REMARKS_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500761 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${ASDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${ASDC_GOVERNOR_USER_ID}
762 Should Be Equal As Strings ${resp.status_code} 200
763 [Return] ${resp.json()}
764Distribute ASDC Catalog Service
765 [Documentation] distribute an asdc Catalog Service by its id
766 [Arguments] ${catalog_service_id}
767 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_DISTRIBUTION_ACTIVATE_PATH} ${None} ${ASDC_OPS_USER_ID}
768 Should Be Equal As Strings ${resp.status_code} 200
769 [Return] ${resp.json()}
bdfreeman1421b2a49512018-11-25 07:32:19 -0500770
DR695Hccff30b2017-02-17 18:44:24 -0500771Add ASDC Resource Instance
772 [Documentation] Creates an asdc Resource Instance and returns its id
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500773 [Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0}
DR695Hccff30b2017-02-17 18:44:24 -0500774 ${milli_timestamp}= Generate MilliTimestamp UUID
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500775 ${xoffset}= Set Variable ${xoffset+306}
776 ${yoffset}= Set Variable ${yoffset+248}
777 ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset}
Jerry Floode2a48d72017-06-21 15:06:29 -0400778 ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
DR695Hccff30b2017-02-17 18:44:24 -0500779 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID}
780 Should Be Equal As Strings ${resp.status_code} 201
781 [Return] ${resp.json()['uniqueId']}
Brian Freemaneef7c6f2018-11-16 18:42:21 -0500782
bdfreeman1421b2a49512018-11-25 07:32:19 -0500783Add ASDC Resource Instance To Resource
784 [Documentation] Creates an asdc Resource Instance in a Resource (VF) and returns its id
785 [Arguments] ${parent_catalog_resource_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0}
786 ${milli_timestamp}= Generate MilliTimestamp UUID
787 ${xoffset}= Set Variable ${xoffset+306}
788 ${yoffset}= Set Variable ${yoffset+248}
789 ${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset}
790 ${data}= Fill JSON Template File ${ASDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
791 ${resp}= Run ASDC Post Request ${ASDC_CATALOG_RESOURCES_PATH}/${parent_catalog_resource_id}${ASDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${ASDC_DESIGNER_USER_ID}
792 Should Be Equal As Strings ${resp.status_code} 201
793 [Return] ${resp.json()['uniqueId']}
794
DR695Hccff30b2017-02-17 18:44:24 -0500795Get Catalog Service Distribution
796 [Documentation] gets an asdc catalog Service distrbution
797 [Arguments] ${catalog_service_uuid}
798 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}/${catalog_service_uuid}${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH} ${ASDC_OPS_USER_ID}
799 Should Be Equal As Strings ${resp.status_code} 200
800 [Return] ${resp.json()}
801Check Catalog Service Distributed
802 [Documentation] gets an asdc catalog Service distrbution
Brian Freemanadaa2372018-10-24 12:25:22 -0500803 [Arguments] ${catalog_service_uuid} ${dist_status}
DR695Hccff30b2017-02-17 18:44:24 -0500804 ${dist_resp}= Get Catalog Service Distribution ${catalog_service_uuid}
805 Should Be Equal As Strings ${dist_resp['distributionStatusOfServiceList'][0]['deployementStatus']} Distributed
806 ${det_resp}= Get Catalog Service Distribution Details ${dist_resp['distributionStatusOfServiceList'][0]['distributionID']}
807 @{ITEMS}= Copy List ${det_resp['distributionStatusList']}
Brian Freemanf508ab22018-03-15 21:19:41 -0500808 Should Not Be Empty ${ITEMS}
Brian Freemana62644f2018-05-13 12:47:38 -0500809 ${SO_COMPLETE} Set Variable FALSE
bdfreeman1421b2a49512018-11-25 07:32:19 -0500810 ${dist_status} Set Variable CONTINUE
811 Should Not Be Empty ${ITEMS}
DR695Hccff30b2017-02-17 18:44:24 -0500812 :FOR ${ELEMENT} IN @{ITEMS}
Brian Freemanf508ab22018-03-15 21:19:41 -0500813 \ Log ${ELEMENT['omfComponentID']}
DR695Hccff30b2017-02-17 18:44:24 -0500814 \ Log ${ELEMENT['status']}
Brian Freeman41ab5e52018-08-08 14:24:23 -0500815 \ ${SO_COMPLETE} Set Variable If (('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_OK')) or ('${SO_COMPLETE}'=='TRUE') TRUE
Brian Freemaneca71072018-08-16 14:50:16 -0500816 \ Exit For Loop If ('${SO_COMPLETE}'=='TRUE')
817 \ Exit For Loop If ('${ELEMENT['status']}' == 'DISTRIBUTION_COMPLETE_ERROR')
Brian Freemanadaa2372018-10-24 12:25:22 -0500818 \ ${dist_status}= Set Variable If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml')) EXIT
819 \ Exit For Loop If (('${ELEMENT['status']}' == 'COMPONENT_DONE_ERROR') and ('${ELEMENT['omfComponentID']}' == 'aai-ml'))
Brian Freemana62644f2018-05-13 12:47:38 -0500820 Should Be True ( '${SO_COMPLETE}'=='TRUE') SO Test
bdfreeman1421b2a49512018-11-25 07:32:19 -0500821 [Return]
822
DR695Hccff30b2017-02-17 18:44:24 -0500823Get Catalog Service Distribution Details
824 [Documentation] gets an asdc catalog Service distrbution details
825 [Arguments] ${catalog_service_distribution_id}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500826 ${resp}= Run ASDC Get Request ${ASDC_CATALOG_SERVICES_PATH}${ASDC_CATALOG_SERVICE_DISTRIBUTION_PATH}/${catalog_service_distribution_id} ${ASDC_OPS_USER_ID}
DR695Hccff30b2017-02-17 18:44:24 -0500827 Should Be Equal As Strings ${resp.status_code} 200
828 [Return] ${resp.json()}
829Run ASDC Health Check
830 [Documentation] Runs a ASDC health check
DR695Hbf5a3a32017-06-30 13:09:57 -0400831 ${session}= Create Session asdc ${ASDC_FE_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500832 ${uuid}= Generate UUID
833 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
834 ${resp}= Get Request asdc ${ASDC_HEALTH_CHECK_PATH} headers=${headers}
Brian Freemanadaa2372018-10-24 12:25:22 -0500835 # only test for HTTP 200 to determine SDC Health. SDC_DE_HEALTH is informational
Brian Freeman00f125e2018-09-05 13:03:48 -0500836 Should Be Equal As Strings ${resp.status_code} 200 SDC DOWN
Brian Freeman5cf5fa62018-04-23 20:28:16 -0500837 ${SDC_DE_HEALTH}= Catenate DOWN
DR695Hccff30b2017-02-17 18:44:24 -0500838 @{ITEMS}= Copy List ${resp.json()['componentsInfo']}
839 :FOR ${ELEMENT} IN @{ITEMS}
840 \ Log ${ELEMENT['healthCheckStatus']}
Brian Freemane546f7e2018-04-19 12:17:56 -0500841 \ ${SDC_DE_HEALTH} Set Variable If (('DE' in '${ELEMENT['healthCheckComponent']}') and ('${ELEMENT['healthCheckStatus']}' == 'UP')) or ('${SDC_DE_HEALTH}'=='UP') UP
Brian Freemand5743d52018-11-05 11:05:43 -0500842 Log To Console (DMaaP:${SDC_DE_HEALTH}) no_newline=true
DR695Hccff30b2017-02-17 18:44:24 -0500843Run ASDC Get Request
844 [Documentation] Runs an ASDC get request
Brian Freeman44b8bb32018-05-03 21:08:42 -0500845 [Arguments] ${data_path} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500846 ${auth}= Create List ${GLOBAL_ASDC_BE_USERNAME} ${GLOBAL_ASDC_BE_PASSWORD}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500847 Log Creating session ${MY_ASDC_BE_ENDPOINT}
848 ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -0500849 ${uuid}= Generate UUID
850 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
851 ${resp}= Get Request asdc ${data_path} headers=${headers}
852 Log Received response from asdc ${resp.text}
853 [Return] ${resp}
854Run ASDC Put Request
855 [Documentation] Runs an ASDC put request
Brian Freeman44b8bb32018-05-03 21:08:42 -0500856 [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500857 ${auth}= Create List ${GLOBAL_ASDC_BE_USERNAME} ${GLOBAL_ASDC_BE_PASSWORD}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500858 Log Creating session ${MY_ASDC_BE_ENDPOINT}
859 ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -0500860 ${uuid}= Generate UUID
861 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
862 ${resp}= Put Request asdc ${data_path} data=${data} headers=${headers}
863 Log Received response from asdc ${resp.text}
864 [Return] ${resp}
Jerry Flood6bd1afa2017-10-09 09:59:23 -0400865
DR695Hccff30b2017-02-17 18:44:24 -0500866Run ASDC Post Files Request
867 [Documentation] Runs an ASDC post request
Brian Freeman44b8bb32018-05-03 21:08:42 -0500868 [Arguments] ${data_path} ${files} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500869 ${auth}= Create List ${GLOBAL_ASDC_BE_USERNAME} ${GLOBAL_ASDC_BE_PASSWORD}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500870 Log Creating session ${MY_ASDC_BE_ENDPOINT}
871 ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -0500872 ${uuid}= Generate UUID
873 ${headers}= Create Dictionary Accept=application/json Content-Type=multipart/form-data USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
874 ${resp}= Post Request asdc ${data_path} files=${files} headers=${headers}
875 Log Received response from asdc ${resp.text}
Jerry Floode2a48d72017-06-21 15:06:29 -0400876 [Return] ${resp}
Jerry Flood6bd1afa2017-10-09 09:59:23 -0400877
DR695Hccff30b2017-02-17 18:44:24 -0500878Run ASDC Post Request
879 [Documentation] Runs an ASDC post request
Brian Freeman44b8bb32018-05-03 21:08:42 -0500880 [Arguments] ${data_path} ${data} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT}
DR695Hccff30b2017-02-17 18:44:24 -0500881 ${auth}= Create List ${GLOBAL_ASDC_BE_USERNAME} ${GLOBAL_ASDC_BE_PASSWORD}
Brian Freeman44b8bb32018-05-03 21:08:42 -0500882 Log Creating session ${MY_ASDC_BE_ENDPOINT}
883 ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -0500884 ${uuid}= Generate UUID
885 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
886 ${resp}= Post Request asdc ${data_path} data=${data} headers=${headers}
887 Log Received response from asdc ${resp.text}
Jerry Floode2a48d72017-06-21 15:06:29 -0400888 [Return] ${resp}
DR695Hccff30b2017-02-17 18:44:24 -0500889Run ASDC Delete Request
890 [Documentation] Runs an ASDC delete request
Brian Freeman44b8bb32018-05-03 21:08:42 -0500891 [Arguments] ${data_path} ${user}=${ASDC_DESIGNER_USER_ID} ${MY_ASDC_BE_ENDPOINT}=${ASDC_BE_ENDPOINT}
892 ${auth}= Create List ${GLOBAL_ASDC_BE_USERNAME} ${GLOBAL_ASDC_BE_PASSWORD}
893 Log Creating session ${MY_ASDC_BE_ENDPOINT}
894 ${session}= Create Session asdc ${MY_ASDC_BE_ENDPOINT} auth=${auth}
DR695Hccff30b2017-02-17 18:44:24 -0500895 ${uuid}= Generate UUID
896 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${user} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
897 ${resp}= Delete Request asdc ${data_path} headers=${headers}
898 Log Received response from asdc ${resp.text}
Jerry Floode2a48d72017-06-21 15:06:29 -0400899 [Return] ${resp}
DR695Hccff30b2017-02-17 18:44:24 -0500900Open ASDC GUI
901 [Documentation] Logs in to ASDC GUI
902 [Arguments] ${PATH}
903 ## Setup Browever now being managed by the test case
904 ##Setup Browser
DR695Hbf5a3a32017-06-30 13:09:57 -0400905 Go To ${ASDC_FE_ENDPOINT}${PATH}
DR695Hccff30b2017-02-17 18:44:24 -0500906 Maximize Browser Window
Jerry Flood6bd1afa2017-10-09 09:59:23 -0400907
DR695Hccff30b2017-02-17 18:44:24 -0500908 Set Browser Implicit Wait ${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT}
DR695Hbf5a3a32017-06-30 13:09:57 -0400909 Log Logging in to ${ASDC_FE_ENDPOINT}${PATH}
DR695Hccff30b2017-02-17 18:44:24 -0500910 Title Should Be ASDC
Jerry Floode2a48d72017-06-21 15:06:29 -0400911 Wait Until Page Contains Element xpath=//div/a[text()='SDC'] ${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT}
DR695Hbf5a3a32017-06-30 13:09:57 -0400912 Log Logged in to ${ASDC_FE_ENDPOINT}${PATH}
Jerry Flood6bd1afa2017-10-09 09:59:23 -0400913
914
915Create Multi Part
916 [Arguments] ${addTo} ${partName} ${filePath} ${contentType}=${None}
917 ${fileData}= Get Binary File ${filePath}
918 ${fileDir} ${fileName}= Split Path ${filePath}
919 ${partData}= Create List ${fileName} ${fileData} ${contentType}
920 Set To Dictionary ${addTo} ${partName}=${partData}
Brian Freemanf940ee92018-05-25 21:09:05 -0500921