2 Documentation This test template encapsulates the VNF Orchestration use case.
4 Resource test_templates/model_test_template.robot
5 Resource test_templates/model_test_template_vcperescust.robot
6 Resource test_templates/vnf_orchestration_test_template.robot
7 Resource sdc_interface.robot
8 Resource vid/vid_interface.robot
9 Resource consul_interface.robot
10 Resource policy_interface.robot
11 Resource aai/create_availability_zone.robot
12 Resource so/direct_instantiate.robot
14 Library ONAPLibrary.Utilities
16 Library OperatingSystem
17 Library SeleniumLibrary
18 Library RequestsLibrary
19 Library ONAPLibrary.Templating WITH NAME Templating
20 Library ONAPLibrary.AAI WITH NAME AAI
21 Library ONAPLibrary.SO WITH NAME SO
25 ${ADD_DEMO_CUSTOMER_BODY} aai/add_demo_customer.jinja
26 ${AAI_INDEX_PATH} /aai/v8
27 ${VF_MODULES_NAME} _Demo_VFModules.json
30 ${VPKG_MODULE_LABEL} base_vpkg
34 Load Customer And Models
35 [Documentation] Use ONAP to Orchestrate a service.
36 [Arguments] ${customer_name}
37 Load Customer ${customer_name}
38 Load Models ${customer_name}
41 [Documentation] Use ONAP to Orchestrate a service.
42 [Arguments] ${customer_name}
43 ${tenant_id} ${tenant_name}= Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone
44 ${region}= Get Openstack Region
45 Create Customer For VNF Demo ${customer_name} ${customer_name} INFRA ${GLOBAL_AAI_CLOUD_OWNER} ${region} ${tenant_id}
46 Create Customer For VNF Demo ${customer_name} ${customer_name} INFRA ${GLOBAL_AAI_CLOUD_OWNER} RegionTlab 50b190410b2a4c229d8a6044a80ab7c1
47 Create Availability Zone If Not Exists ${GLOBAL_AAI_CLOUD_OWNER} ${region} ${GLOBAL_AAI_AVAILABILITY_ZONE_NAME}
50 [Documentation] Load Basic Test VNF Models
51 [Arguments] ${customer_name}
52 Log ${\n}Distributing vFWCL
53 Distribute Model vFWCL ${DEMO_PREFIX}VFWCL
55 Distribute Model vLB ${DEMO_PREFIX}VLB
56 Log Distibuting vLB_CDS
57 Distribute Model vLB_CDS ${DEMO_PREFIX}VLB_CDS True
60 [Documentation] Load vCPE Models
61 [Arguments] ${customer_name}
62 Log Distibuting vCPEInfra
63 Distribute Model vCPEInfra ${DEMO_PREFIX}VCPEInfra
64 Log Distibuting vCPEvBNG
65 Distribute Model vCPEvBNG ${DEMO_PREFIX}VCPEvBNG
66 Log Distibuting vCPEvBRGEMU
67 Distribute Model vCPEvBRGEMU ${DEMO_PREFIX}VCPEvBRGEMU
68 Log Distibuting vCPEvGMUX
69 Distribute Model vCPEvGMUX ${DEMO_PREFIX}VCPEvGMUX
70 Log Distibuting vCPEvGW (this is not vCPEResCust service)
71 Distribute Model vCPEvGW ${DEMO_PREFIX}VCPEvGW
74 [Arguments] ${service} ${modelName} ${cds}=False ${instantiationType}=A-la-carte ${resourceType}=VF
75 Model Distribution For Directory ${service} ${modelName} ${cds} ${instantiationType} ${resourceType}
77 Create Customer For VNF Demo
78 [Documentation] Create demo customer for the demo
79 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${clouder_owner} ${cloud_region_id} ${tenant_id}
80 Create Service If Not Exists vFW
81 Create Service If Not Exists vFWCL
82 Create Service If Not Exists vLB
83 Create Service If Not Exists vCPE
84 Create Service If Not Exists vIMS
85 Create Service If Not Exists gNB
86 ${arguments}= Create Dictionary subscriber_name=${customer_name} global_customer_id=${customer_id} subscriber_type=${customer_type} cloud_owner=${clouder_owner} cloud_region_id=${cloud_region_id} tenant_id=${tenant_id}
87 Set To Dictionary ${arguments} service1=vFWCL service2=vLB service3=vCPE service4=vIMS service5=gNB service6=vFW
88 Templating.Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
89 ${data}= Templating.Apply Template aai ${ADD_DEMO_CUSTOMER_BODY} ${arguments}
90 ${put_resp}= AAI.Run Put Request ${AAI_FRONTEND_ENDPOINT} ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} auth=${GLOBAL_AAI_AUTHENTICATION}
91 ${status_string}= Convert To String ${put_resp.status_code}
92 Should Match Regexp ${status_string} ^(200|201|412)$
95 [Documentation] Preload the demo data for the passed VNF with the passed module name
96 [Arguments] ${vnf_name} ${vf_module_name} ${service} ${service_instance_id} ${vnf}=${service}
97 # Go to A&AI and get information about the VNF we need to preload
98 ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Service Instance ${vnf_name}
99 Run Keyword If '${status}' == 'FAIL' FAIL VNF Name: ${vnf_name} is not found.
100 ${vnf_type}= Set Variable ${generic_vnf['vnf-type']}
101 ${relationships}= Set Variable ${generic_vnf['relationship-list']['relationship']}
102 ${relationship_data}= Get Relationship Data ${relationships}
103 ${customer_id}= Catenate
104 :FOR ${r} IN @{relationship_data}
105 \ ${service}= Set Variable If '${r['relationship-key']}' == 'service-subscription.service-type' ${r['relationship-value']} ${service}
106 \ ${service_instance_id}= Set Variable If '${r['relationship-key']}' == 'service-instance.service-instance-id' ${r['relationship-value']} ${service_instance_id}
107 \ ${customer_id}= Set Variable If '${r['relationship-key']}' == 'customer.global-customer-id' ${r['relationship-value']} ${customer_id}
108 ${invariantUUID}= Get Persona Model Id ${service_instance_id} ${service} ${customer_id}
110 # We still need the vf module names. We can get them from VID using the persona_model_id (invariantUUID) from A&AI
113 ${vf_modules}= Get Module Names from VID ${invariantUUID}
115 Log ${service_instance_id},${vnf_name},${vnf_type},${vf_module_name},${vf_modules},${service}
116 Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${vnf} demo ${service}
117 [Teardown] Close All Browsers
119 Preload User Model GRA
120 [Documentation] Preload the demo data for the passed VNF with the passed module name via GRA
121 [Arguments] ${vnf_name} ${vf_module_name} ${service} ${service_instance_id} ${vnf}=${service}
122 # Go to A&AI and get information about the VNF we need to preload
123 ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Service Instance ${vnf_name}
124 Run Keyword If '${status}' == 'FAIL' FAIL VNF Name: ${vnf_name} is not found.
125 ${vnf_type}= Set Variable ${generic_vnf['vnf-type']}
126 ${relationships}= Set Variable ${generic_vnf['relationship-list']['relationship']}
127 ${relationship_data}= Get Relationship Data ${relationships}
128 ${customer_id}= Catenate
129 :FOR ${r} IN @{relationship_data}
130 \ ${service}= Set Variable If '${r['relationship-key']}' == 'service-subscription.service-type' ${r['relationship-value']} ${service}
131 \ ${service_instance_id}= Set Variable If '${r['relationship-key']}' == 'service-instance.service-instance-id' ${r['relationship-value']} ${service_instance_id}
132 \ ${customer_id}= Set Variable If '${r['relationship-key']}' == 'customer.global-customer-id' ${r['relationship-value']} ${customer_id}
133 ${invariantUUID}= Get Persona Model Id ${service_instance_id} ${service} ${customer_id}
135 # We still need the vf module names. We can get them from VID using the persona_model_id (invariantUUID) from A&AI
138 ${vf_modules}= Get Module Names from VID ${invariantUUID}
140 Log ${service_instance_id},${vnf_name},${vnf_type},${vf_module_name},${vf_modules},${service}
141 Preload Gra ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${vnf} demo ${service}
142 [Teardown] Close All Browsers
145 Get Relationship Data
146 [Arguments] ${relationships}
147 :FOR ${r} IN @{relationships}
148 \ ${status} ${relationship_data} Run Keyword And Ignore Error Set Variable ${r['relationship-data']}
149 \ Return From Keyword If '${status}' == 'PASS' ${relationship_data}
152 Get Generic VNF By ID
153 [Arguments] ${vnf_id}
154 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-id=${vnf_id} auth=${GLOBAL_AAI_AUTHENTICATION}
155 Should Be Equal As Strings ${resp.status_code} 200
156 [Return] ${resp.json()}
159 [Arguments] ${vnf_name}
160 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name} auth=${GLOBAL_AAI_AUTHENTICATION}
161 Should Be Equal As Strings ${resp.status_code} 200
162 [Return] ${resp.json()}
165 [Documentation] Query and Validates A&AI Service Instance
166 [Arguments] ${service_instance_id} ${service_type} ${customer_id}
167 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${INDEX PATH}${CUSTOMER SPEC PATH}${customer_id}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE INSTANCE}${service_instance_id} auth=${GLOBAL_AAI_AUTHENTICATION}
168 ${persona_model_id}= Get From DIctionary ${resp.json()['service-instance'][0]} model-invariant-id
169 [Return] ${persona_model_id}
172 [Arguments] ${vf_module_name}
173 Run Openstack Auth Request auth
174 ${status} ${stack_info}= Run Keyword and Ignore Error Wait for Stack to Be Deployed auth ${vf_module_name} timeout=120s
175 Run Keyword if '${status}' == 'FAIL' FAIL ${vf_module_name} Stack is not found
176 ${stack_id}= Get From Dictionary ${stack_info} id
177 ${server_list}= Get Openstack Servers auth
178 ${vpg_name_0}= Get From Dictionary ${stack_info} vpg_name_0
179 ${vnf_id}= Get From Dictionary ${stack_info} vnf_id
180 ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=${GLOBAL_INJECTED_OPENSTACK_PUBLIC_NETWORK}
181 ${appc}= Create Mount Point In APPC ${vnf_id} ${vpg_public_ip}
184 [Arguments] ${service} ${vf_module_label}=NULL
185 ${tenant_id} ${tenant_name}= Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone
186 ${uuid}= Generate UUID4
187 ${vf_module_name_list} ${generic_vnfs} ${server_id} ${service_instance_id} ${catalog_resource_ids} ${catalog_service_id} ${uris_to_delete}= Orchestrate VNF DemoCust_${uuid} ${service} ${service} ${tenant_id} ${tenant_name}
188 ${stack_name} = Get From List ${vf_module_name_list} -1
189 Save For Delete ${tenant_id} ${tenant_name} ${server_id} DemoCust_${uuid} ${service_instance_id} ${stack_name} ${catalog_service_id} ${catalog_resource_ids}
190 :FOR ${vf_module_name} IN @{vf_module_name_list}
191 \ Log VNF Module Name=${vf_module_name}
192 # Don't get from SO for now due to SO-1186
193 # ${model_invariant_id}= Run SO Get ModelInvariantId ${suite_service_model_name} ${vf_module_label}
194 ${model_invariant_id}= Set Variable ${EMPTY}
195 :FOR ${vf_module} IN @{generic_vnfs}
196 \ ${generic_vnf}= Get From Dictionary ${generic_vnfs} ${vf_module}
197 \ ${model_invariant_id}= Set Variable If '${vf_module_label}' in '${vf_module}' ${generic_vnf['model-invariant-id']} ${model_invariant_id}
198 Log Update old vFWCL Policy for ModelInvariantID=${model_invariant_id}
199 ${status} ${value}= Run Keyword And Ignore Error Update vFWCL Operational and Monitoring Policies ${model_invariant_id}
200 :FOR ${vf_module_name} IN @{vf_module_name_list}
201 \ Log APPC Mount Point for VNF Module Name=${vf_module_name}
202 \ ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name}
203 Log Update Tca ControlLoopName
204 Update Tca ControlLoopName ${model_invariant_id}
207 [Arguments] ${service} ${vf_module_label}=NULL
208 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vLB_CDS demoVLB_CDS True
209 ${resp}= Get Service Catalog demoVLB_CDS
210 ${service-uuid}= Set Variable ${resp['uuid']}
211 ${service-invariantUUID}= Set Variable ${resp['invariantUUID']}
212 ${requestid}= CDS Service Instantiate demoVLB_CDS ${service-uuid} ${service-invariantUUID}
213 ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME } ${GLOBAL_SO_PASSWORD}
214 SO.Run Polling Get Request ${GLOBAL_SO_APIHAND_ENDPOINT} ${GLOBAL_SO_ORCHESTRATION_REQUESTS_PATH}/${requestid} tries=30 interval=60 auth=${auth}
217 [Arguments] ${service} ${vf_module_label}=NULL
218 ${tenant_id} ${tenant_name}= Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone
219 ${vf_module_name} ${service} ${generic_vnfs}= Orchestrate Demo VNF Demonstration ${service} ${service} ${tenant_id} ${tenant_name}
220 Log VNF Module Name=${vf_module_name}
221 # Don't get from SO for now due to SO-1186
222 # ${model_invariant_id}= Run SO Get ModelInvariantId ${suite_service_model_name} ${vf_module_label}
223 ${model_invariant_id}= Set Variable ${EMPTY}
224 :FOR ${vf_module} IN @{generic_vnfs}
225 \ ${generic_vnf}= Get From Dictionary ${generic_vnfs} ${vf_module}
226 \ ${model_invariant_id}= Set Variable If '${vf_module_label}' in '${vf_module}' ${generic_vnf['model-invariant-id']} ${model_invariant_id}
227 Log ModelInvariantID=${model_invariant_id}
228 ${status} ${value}= Run Keyword And Ignore Error Update vFWCL Operational and Monitoring Policies ${model_invariant_id}
229 ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name}
232 [Documentation] Create a variable file to be loaded for save for delete
233 [Arguments] ${tenant_id} ${tenant_name} ${vvg_server_id} ${customer_name} ${service_instance_id} ${stack_name} ${catalog_service_id} ${catalog_resource_ids}
234 ${dict}= Create Dictionary
235 Set To Dictionary ${dict} TENANT_NAME=${tenant_name}
236 Set To Dictionary ${dict} TENANT_ID=${tenant_id}
237 Set To Dictionary ${dict} CUSTOMER_NAME=${customer_name}
238 Set To Dictionary ${dict} STACK_NAME=${stack_name}
239 Set To Dictionary ${dict} VVG_SERVER_ID=${vvg_server_id}
240 Set To Dictionary ${dict} SERVICE_INSTANCE_ID=${service_instance_id}
241 Set To Dictionary ${dict} CATALOG_SERVICE_ID=${catalog_service_id}
244 ${keys}= Get Dictionary Keys ${dict}
245 :FOR ${key} IN @{keys}
246 \ ${value}= Get From Dictionary ${dict} ${key}
247 \ ${vars}= Catenate ${vars}${key} = "${value}"\n
250 ${vars}= Catenate ${vars}CATALOG_RESOURCE_IDS = [
251 :FOR ${id} IN @{catalog_resource_ids}
252 \ ${vars}= Catenate ${vars}${comma} "${id}"
253 \ ${comma}= Catenate ,
254 ${vars}= Catenate ${vars}]\n
255 OperatingSystem.Create File ${FILE_CACHE}/${stack_name}.py ${vars}
256 OperatingSystem.Create File ${FILE_CACHE}/lastVNF4HEATBRIGE.py ${vars}