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 asdc_interface.robot
8 Resource so_interface.robot
9 Resource vid/vid_interface.robot
10 Resource consul_interface.robot
11 Resource policy_interface.robot
12 Resource aai/create_availability_zone.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
24 ${ADD_DEMO_CUSTOMER_BODY} aai/add_demo_customer.jinja
25 ${AAI_INDEX_PATH} /aai/v8
26 ${VF_MODULES_NAME} _Demo_VFModules.json
29 ${VPKG_MODULE_LABEL} base_vpkg
33 Load Customer And Models
34 [Documentation] Use openECOMP to Orchestrate a service.
35 [Arguments] ${customer_name}
36 Load OwningEntity lineOfBusiness LOB-${customer_name}
37 Load OwningEntity platform Platform-${customer_name}
38 Load OwningEntity project Project-${customer_name}
39 Load OwningEntity owningEntity OE-${customer_name}
40 Load Customer ${customer_name}
41 Load Models ${customer_name}
44 [Documentation] Use openECOMP to Orchestrate a service.
45 [Arguments] ${parameter} ${name}
46 ${data_path}= Set Variable /maintenance/category_parameter/${parameter}
47 ${vid_data}= Set Variable {"options":["${name}"]}
48 ${auth}= Create List ${GLOBAL_VID_USERNAME} ${GLOBAL_VID_PASSWORD}
49 Log Creating session ${data_path}
50 ${session}= Create Session vid ${VID_ENDPOINT}${VID_ENV} auth=${auth}
51 ${uuid}= Generate UUID4
52 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json USER_ID=${GLOBAL_VID_USERNAME} X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID}
53 ${resp}= Post Request vid ${data_path} data=${vid_data} headers=${headers}
56 [Documentation] Use openECOMP to Orchestrate a service.
57 [Arguments] ${customer_name}
58 ${tenant_id} ${tenant_name}= Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone
59 ${region}= Get Openstack Region
60 Create Customer For VNF Demo ${customer_name} ${customer_name} INFRA ${GLOBAL_AAI_CLOUD_OWNER} ${region} ${tenant_id}
61 Create Customer For VNF Demo ${customer_name} ${customer_name} INFRA ${GLOBAL_AAI_CLOUD_OWNER} RegionTlab 50b190410b2a4c229d8a6044a80ab7c1
62 Create Availability Zone If Not Exists ${GLOBAL_AAI_CLOUD_OWNER} ${region} ${GLOBAL_AAI_AVAILABILITY_ZONE_NAME}
65 [Documentation] Use openECOMP to Orchestrate a service.
66 [Arguments] ${customer_name}
67 Log ${\n}Distributing vFWCL
68 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vFWCL ${DEMO_PREFIX}VFWCL
70 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vLB ${DEMO_PREFIX}VLB
71 ##${status} ${value}= Run Keyword And Ignore Error Distribute Model vCPE ${DEMO_PREFIX}VCPE
72 ##${status} ${value}= Run Keyword And Ignore Error Distribute Model vIMS ${DEMO_PREFIX}VIMS
73 Log Distibuting vCPEInfra
74 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vCPEInfra ${DEMO_PREFIX}VCPEInfra
75 Log Distibuting vCPEvBNG
76 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vCPEvBNG ${DEMO_PREFIX}VCPEvBNG
77 Log Distibuting vCPEvBRGEMU
78 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vCPEvBRGEMU ${DEMO_PREFIX}VCPEvBRGEMU
79 Log Distibuting vCPEvGMUX
80 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vCPEvGMUX ${DEMO_PREFIX}VCPEvGMUX
81 Log Distibuting vCPEvGW (this is not vCPEResCust service)
82 ${status} ${value}= Run Keyword And Ignore Error Distribute Model vCPEvGW ${DEMO_PREFIX}VCPEvGW
85 [Arguments] ${service} ${modelName}
86 Model Distribution For Directory ${service} ${modelName}
88 Distribute vCPEResCust Model
89 [Arguments] ${service} ${modelName}
90 Model Distribution For vCPEResCust Directory ${service} ${modelName}
92 Create Customer For VNF Demo
93 [Documentation] Create demo customer for the demo
94 [Arguments] ${customer_name} ${customer_id} ${customer_type} ${clouder_owner} ${cloud_region_id} ${tenant_id}
95 Create Service If Not Exists vFW
96 Create Service If Not Exists vFWCL
97 Create Service If Not Exists vLB
98 Create Service If Not Exists vCPE
99 Create Service If Not Exists vIMS
100 Create Service If Not Exists gNB
101 ${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}
102 Set To Dictionary ${arguments} service1=vFWCL service2=vLB service3=vCPE service4=vIMS service5=gNB service6=vFW
103 Templating.Create Environment aai ${GLOBAL_TEMPLATE_FOLDER}
104 ${data}= Templating.Apply Template aai ${ADD_DEMO_CUSTOMER_BODY} ${arguments}
105 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
106 ${put_resp}= AAI.Run Put Request ${AAI_FRONTEND_ENDPOINT} ${INDEX PATH}${ROOT_CUSTOMER_PATH}${customer_id} ${data} auth=${auth}
107 ${status_string}= Convert To String ${put_resp.status_code}
108 Should Match Regexp ${status_string} ^(200|201|412)$
111 [Documentation] Preload the demo data for the passed VNF with the passed module name
112 [Arguments] ${vnf_name} ${vf_module_name} ${service} ${service_instance_id}
113 # Go to A&AI and get information about the VNF we need to preload
114 ${status} ${generic_vnf}= Run Keyword And Ignore Error Get Service Instance ${vnf_name}
115 Run Keyword If '${status}' == 'FAIL' FAIL VNF Name: ${vnf_name} is not found.
116 ${vnf_type}= Set Variable ${generic_vnf['vnf-type']}
117 ${relationships}= Set Variable ${generic_vnf['relationship-list']['relationship']}
118 ${relationship_data}= Get Relationship Data ${relationships}
119 ${customer_id}= Catenate
120 :FOR ${r} IN @{relationship_data}
121 \ ${service}= Set Variable If '${r['relationship-key']}' == 'service-subscription.service-type' ${r['relationship-value']} ${service}
122 \ ${service_instance_id}= Set Variable If '${r['relationship-key']}' == 'service-instance.service-instance-id' ${r['relationship-value']} ${service_instance_id}
123 \ ${customer_id}= Set Variable If '${r['relationship-key']}' == 'customer.global-customer-id' ${r['relationship-value']} ${customer_id}
124 ${invariantUUID}= Get Persona Model Id ${service_instance_id} ${service} ${customer_id}
126 # We still need the vf module names. We can get them from VID using the persona_model_id (invariantUUID) from A&AI
129 ${vf_modules}= Get Module Names from VID ${invariantUUID}
131 Log ${service_instance_id},${vnf_name},${vnf_type},${vf_module_name},${vf_modules},${service}
132 Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${service} demo
133 [Teardown] Close All Browsers
136 Get Relationship Data
137 [Arguments] ${relationships}
138 :FOR ${r} IN @{relationships}
139 \ ${status} ${relationship_data} Run Keyword And Ignore Error Set Variable ${r['relationship-data']}
140 \ Return From Keyword If '${status}' == 'PASS' ${relationship_data}
143 Get Generic VNF By ID
144 [Arguments] ${vnf_id}
145 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
146 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-id=${vnf_id} auth=${auth}
147 Should Be Equal As Strings ${resp.status_code} 200
148 [Return] ${resp.json()}
151 [Arguments] ${vnf_name}
152 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
153 ${resp}= AAI.Run Get Request ${AAI_FRONTEND_ENDPOINT} ${AAI_INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name} auth=${auth}
154 Should Be Equal As Strings ${resp.status_code} 200
155 [Return] ${resp.json()}
158 [Documentation] Query and Validates A&AI Service Instance
159 [Arguments] ${service_instance_id} ${service_type} ${customer_id}
160 ${auth}= Create List ${GLOBAL_AAI_USERNAME} ${GLOBAL_AAI_PASSWORD}
161 ${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=${auth}
162 ${persona_model_id}= Get From DIctionary ${resp.json()['service-instance'][0]} model-invariant-id
163 [Return] ${persona_model_id}
166 [Arguments] ${vf_module_name}
167 Run Openstack Auth Request auth
168 ${status} ${stack_info}= Run Keyword and Ignore Error Wait for Stack to Be Deployed auth ${vf_module_name} timeout=120s
169 Run Keyword if '${status}' == 'FAIL' FAIL ${vf_module_name} Stack is not found
170 ${stack_id}= Get From Dictionary ${stack_info} id
171 ${server_list}= Get Openstack Servers auth
172 ${vpg_name_0}= Get From Dictionary ${stack_info} vpg_name_0
173 ${vnf_id}= Get From Dictionary ${stack_info} vnf_id
174 ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=${GLOBAL_INJECTED_OPENSTACK_PUBLIC_NETWORK}
175 ${appc}= Create Mount Point In APPC ${vnf_id} ${vpg_public_ip}
178 [Arguments] ${service} ${vf_module_label}=NULL
179 ${tenant_id} ${tenant_name}= Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone
180 ${uuid}= Generate UUID4
181 ${vf_module_name_list} ${generic_vnfs} ${server_id} ${service_instance_id} ${catalog_resource_ids} ${catalog_service_id}= Orchestrate VNF DemoCust_${uuid} ${service} ${service} ${tenant_id} ${tenant_name}
182 ${stack_name} = Get From List ${vf_module_name_list} -1
183 Save For Delete ${tenant_id} ${tenant_name} ${server_id} DemoCust_${uuid} ${service_instance_id} ${stack_name} ${catalog_service_id} ${catalog_resource_ids}
184 :FOR ${vf_module_name} IN @{vf_module_name_list}
185 \ Log VNF Module Name=${vf_module_name}
186 # Don't get from MSO for now due to SO-1186
187 # ${model_invariant_id}= Run MSO Get ModelInvariantId ${suite_service_model_name} ${vf_module_label}
188 ${model_invariant_id}= Set Variable ${EMPTY}
189 :FOR ${vf_module} IN @{generic_vnfs}
190 \ ${generic_vnf}= Get From Dictionary ${generic_vnfs} ${vf_module}
191 \ ${model_invariant_id}= Set Variable If '${vf_module_label}' in '${vf_module}' ${generic_vnf['model-invariant-id']} ${model_invariant_id}
192 Log Update old vFWCL Policy for ModelInvariantID=${model_invariant_id}
193 ${status} ${value}= Run Keyword And Ignore Error Update vVFWCL Policy ${model_invariant_id}
194 :FOR ${vf_module_name} IN @{vf_module_name_list}
195 \ Log APPC Mount Point for VNF Module Name=${vf_module_name}
196 \ ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name}
197 Log Update Tca ControlLoopName
198 Update Tca ControlLoopName ${model_invariant_id}
201 [Arguments] ${service} ${vf_module_label}=NULL
202 ${tenant_id} ${tenant_name}= Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} SharedNode OwnerType v1 CloudZone
203 ${vf_module_name} ${service} ${generic_vnfs}= Orchestrate Demo VNF Demonstration ${service} ${service} ${tenant_id} ${tenant_name}
204 Log VNF Module Name=${vf_module_name}
205 # Don't get from MSO for now due to SO-1186
206 # ${model_invariant_id}= Run MSO Get ModelInvariantId ${suite_service_model_name} ${vf_module_label}
207 ${model_invariant_id}= Set Variable ${EMPTY}
208 :FOR ${vf_module} IN @{generic_vnfs}
209 \ ${generic_vnf}= Get From Dictionary ${generic_vnfs} ${vf_module}
210 \ ${model_invariant_id}= Set Variable If '${vf_module_label}' in '${vf_module}' ${generic_vnf['model-invariant-id']} ${model_invariant_id}
211 Log ModelInvariantID=${model_invariant_id}
212 ${status} ${value}= Run Keyword And Ignore Error Update vVFWCL Policy ${model_invariant_id}
213 ${status} ${value}= Run Keyword And Ignore Error APPC Mount Point ${vf_module_name}
217 [Documentation] Create a variable file to be loaded for save for delete
218 [Arguments] ${tenant_id} ${tenant_name} ${vvg_server_id} ${customer_name} ${service_instance_id} ${stack_name} ${catalog_service_id} ${catalog_resource_ids}
219 ${dict}= Create Dictionary
220 Set To Dictionary ${dict} TENANT_NAME=${tenant_name}
221 Set To Dictionary ${dict} TENANT_ID=${tenant_id}
222 Set To Dictionary ${dict} CUSTOMER_NAME=${customer_name}
223 Set To Dictionary ${dict} STACK_NAME=${stack_name}
224 Set To Dictionary ${dict} VVG_SERVER_ID=${vvg_server_id}
225 Set To Dictionary ${dict} SERVICE_INSTANCE_ID=${service_instance_id}
226 Set To Dictionary ${dict} CATALOG_SERVICE_ID=${catalog_service_id}
229 ${keys}= Get Dictionary Keys ${dict}
230 :FOR ${key} IN @{keys}
231 \ ${value}= Get From Dictionary ${dict} ${key}
232 \ ${vars}= Catenate ${vars}${key} = "${value}"\n
235 ${vars}= Catenate ${vars}CATALOG_RESOURCE_IDS = [
236 :FOR ${id} IN @{catalog_resource_ids}
237 \ ${vars}= Catenate ${vars}${comma} "${id}"
238 \ ${comma}= Catenate ,
239 ${vars}= Catenate ${vars}]\n
240 OperatingSystem.Create File ${FILE_CACHE}/${stack_name}.py ${vars}
241 OperatingSystem.Create File ${FILE_CACHE}/lastVNF4HEATBRIGE.py ${vars}