blob: 6853fccaf3474b80703c633495ad55170ad7ddb8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
*** Settings ***
Library Collections
Library OperatingSystem
Library RequestsLibrary
Library ONAPLibrary.Utilities
Library ONAPLibrary.Templating WITH NAME Templating
Library ONAPLibrary.SDC WITH NAME SDC
Resource common.robot
***Variables ***
${SDC_CATALOG_SERVICES_PATH} /sdc2/rest/v1/catalog/services
${SDC_CATALOG_RESOURCES_PATH} /sdc2/rest/v1/catalog/resources
${SDC_CATALOG_LIFECYCLE_PATH} /lifecycleState
${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} /resourceInstance
${SDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH} /distribution-state
${SDC_DISTRIBUTION_STATE_APPROVE_PATH} /approve
${SDC_DCAE_COMPONENT_MICROSERVICE_TEMPLATE} dcae_component_microservice.jinja
${SDC_CATALOG_SERVICE_MONITORING_TEMPLATE} catalog_service_monitoring.jinja
${SDC_ARTIFACT_UPLOAD_TEMPLATE} artifact_upload.jinja
${SDC_USER_REMARKS_TEMPLATE} user_remarks.jinja
${SDC_RESOURCE_INSTANCE_TEMPLATE} resource_instance.jinja
${SDC_BE_ENDPOINT} ${SDC_BE_PROTOCOL}://localhost:${SDC_BE_PORT}
*** Keywords ***
Onboard DCAE Microservice
[Documentation] Create DCAE Microservice with a given name, add Tosca artifacts to it and certify it
... Return the unique_id and uuid of the certified VF
[Arguments] ${test_vf_name}
${data}= Create SDC Catalog Resource For DCAE Component MicroService Data ${test_vf_name} TestVendor
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH} ${data} ${SDC_DESIGNER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 201
${vf_unique_id}= Set Variable ${resp.json()['uniqueId']}
Add Tosca Artifact to Resource template ${vf_unique_id}
Add Tosca Artifact to Resource translate ${vf_unique_id}
Add Tosca Artifact to Resource schema ${vf_unique_id}
${cert_vf_unique_id} ${cert_vf_uuid} Certify SDC Catalog Resource ${vf_unique_id} ${SDC_DESIGNER_USER_ID}
[return] ${cert_vf_unique_id} ${cert_vf_uuid}
Create SDC Catalog Resource For DCAE Component MicroService Data
[Documentation] Creates and returns data for DCAE Component MicroService SDC Catalog Resource
[Arguments] ${resource_name} ${vendor_name}
${map}= Create Dictionary resource_name=${resource_name} vendor_name=${vendor_name}
Templating.Create Environment sdc_dcaed ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_dcaed ${SDC_DCAE_COMPONENT_MICROSERVICE_TEMPLATE} ${map}
[Return] ${data}
# Based on testsuite/robot/resources/sdc_interface.robot's 'Setup SDC Catalog Resource Deployment Artifact Properties' keyword
Add Tosca Artifact To Resource
[Documentation] Add Tosca artifacts to given resource id
[Arguments] ${artifact} ${vf_id}
${blueprint_data} OperatingSystem.Get File ${ASSETS_DIR}${artifact}.yaml
${payloadData}= Base64 Encode ${blueprint_data}
${dict}= Create Dictionary artifactLabel=${artifact} artifactName=${artifact}.yaml artifactType=DCAE_TOSCA artifactGroupType=DEPLOYMENT description=${artifact}.yaml payloadData=${payloadData}
Templating.Create Environment sdc_artifact_upload ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_artifact_upload ${SDC_ARTIFACT_UPLOAD_TEMPLATE} ${dict}
# POST artifactUpload to resource
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${vf_id}/artifacts ${data} ${SDC_DESIGNER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp}
Add Catalog Service For Monitoring Template
[Documentation] Creates SDC Catalog Service for Monitoring Template with given name
[Arguments] ${service_name}
${map}= Create Dictionary service_name=${service_name}
Templating.Create Environment sdc_catalog_service ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_catalog_service ${SDC_CATALOG_SERVICE_MONITORING_TEMPLATE} ${map}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH} ${data} ${SDC_DESIGNER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 201
[Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']}
Generate Unique Postfix
[Documentation] Create and return unique postfix to be used in various unique names
${tmp_id} = Generate Timestamp
${tmp_str} = Convert To String ${tmp_id}
[return] ${tmp_str}
# Directly copied from testsuite/robot/resources/sdc_interface.robot
Certify SDC Catalog Resource
[Documentation] Certifies an SDC Catalog Resource by its id and returns the new id
[Arguments] ${catalog_resource_id} ${user_id}=${SDC_TESTER_USER_ID}
${map}= Create Dictionary user_remarks=Robot remarks
Templating.Create Environment sdc_user_remarks ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_RESOURCES_PATH}/${catalog_resource_id}${SDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${user_id}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.json()['uniqueId']} ${resp.json()['uuid']}
# Based on testsuite/robot/resources/sdc_interface.robot's 'Add SDC Resource Instance' keyword
Add SDC Resource Instance
[Documentation] Creates an SDC Resource Instance and returns its id
[Arguments] ${catalog_service_id} ${catalog_resource_id} ${catalog_resource_name} ${xoffset}=${0} ${yoffset}=${0} ${resourceType}=VF
${milli_timestamp}= Generate Timestamp
${xoffset}= Set Variable ${xoffset+306}
${yoffset}= Set Variable ${yoffset+248}
${map}= Create Dictionary catalog_resource_id=${catalog_resource_id} catalog_resource_name=${catalog_resource_name} milli_timestamp=${milli_timestamp} posX=${xoffset} posY=${yoffset} originType=${resourceType}
Templating.Create Environment sdc_resource_instance ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_resource_instance ${SDC_RESOURCE_INSTANCE_TEMPLATE} ${map}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_RESOURCE_INSTANCE_PATH} ${data} ${SDC_DESIGNER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 201
[Return] ${resp.json()['uniqueId']} ${resp.json()['name']}
Create Monitoring Configuration
[Documentation] Create a monitoring configuration for a given service based on a previously created VFCMT
... Return the unique_id and uuid of the created catalog service for the monitoring configuration
... and the name of the related VFCMT instance
[Arguments] ${service_name} ${vf_unique_id} ${vf_name}
${cs_unique_id} ${cs_uuid} Add Catalog Service For Monitoring Template ${service_name}
${vfi_uuid} ${vfi_name} Add SDC Resource Instance ${cs_unique_id} ${vf_unique_id} ${vf_name}
[return] ${cs_unique_id} ${cs_uuid} ${vfi_name}
Certify And Approve SDC Catalog Service
[Documentation] Perform the required steps to certify and approve the given SDC catalog service
[Arguments] ${cs_unique_id}
Checkin SDC Catalog Service ${cs_unique_id}
Request Certify SDC Catalog Service ${cs_unique_id}
Start Certify SDC Catalog Service ${cs_unique_id}
${cert_cs_unique_id}= Certify SDC Catalog Service ${cs_unique_id}
Approve SDC Catalog Service ${cert_cs_unique_id}
# All the following methods are adjusted from sdc_interface.robot
Checkin SDC Catalog Service
[Documentation] Checks in an SDC Catalog Service by its id
[Arguments] ${catalog_service_id}
${map}= Create Dictionary user_remarks=Robot remarks
Templating.Create Environment sdc_user_remarks ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/checkin ${data} ${SDC_DESIGNER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.json()}
Request Certify SDC Catalog Service
[Documentation] Requests certification of an SDC Catalog Service by its id
[Arguments] ${catalog_service_id}
${map}= Create Dictionary user_remarks=Robot remarks
Templating.Create Environment sdc_user_remarks ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/certificationRequest ${data} ${SDC_DESIGNER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.json()}
Start Certify SDC Catalog Service
[Documentation] Start certification of an SDC Catalog Service by its id
[Arguments] ${catalog_service_id}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/startCertification ${None} ${SDC_TESTER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.json()}
Certify SDC Catalog Service
[Documentation] Certifies an SDC Catalog Service by its id and returns the new id
[Arguments] ${catalog_service_id}
${map}= Create Dictionary user_remarks=Robot remarks
Templating.Create Environment sdc_user_remarks ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_LIFECYCLE_PATH}/certify ${data} ${SDC_TESTER_USER_ID}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.json()['uniqueId']}
Approve SDC Catalog Service
[Documentation] Approves an SDC Catalog Service by its id
[Arguments] ${catalog_service_id}
${map}= Create Dictionary user_remarks=Robot remarks
Templating.Create Environment sdc_user_remarks ${ASSETS_DIR}
${data}= Templating.Apply Template sdc_user_remarks ${SDC_USER_REMARKS_TEMPLATE} ${map}
${resp}= SDC.Run Post Request ${SDC_BE_ENDPOINT} ${SDC_CATALOG_SERVICES_PATH}/${catalog_service_id}${SDC_CATALOG_SERVICE_DISTRIBUTION_STATE_PATH}${SDC_DISTRIBUTION_STATE_APPROVE_PATH} ${data} ${SDC_GOVERNOR_USER_ID}
Should Be Equal As Strings ${resp.status_code} 200
[Return] ${resp.json()}
|