blob: 70d897918665bbaae0c48a5af540246cf98088f1 [file] [log] [blame]
stark, stevenea4af0c2019-08-28 16:11:53 -07001*** Settings ***
2Documentation The main driver for instantiating a generic VNF
3Test Teardown Teardown Test
4
5Library OperatingSystem
6Library Process
7Library ArchiveLibrary
8Library Collections
9Library String
10Library DateTime
11Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping
12Library ONAPLibrary.Utilities
13Resource ../resources/test_templates/vnf_orchestration_test_template.robot
14Resource ../resources/test_templates/vnf_instantiation_ovp.robot
15Resource ../resources/global_properties.robot
16Resource ../resources/vvp_validation.robot
17
18*** Variables ***
19${OVP_BUILD_TAG} vnf-validation-${GLOBAL_BUILD_NUMBER}
20${OVP_VERSION} 2019.09
21${VNF_CHKSUM}
22${SDC_ASSETS_DIRECTORY} ${GLOBAL_HEAT_TEMPLATES_FOLDER}
23
24${BUILD_DIR}= /tmp/vnfdata.${GLOBAL_BUILD_NUMBER}
25
26*** Test Cases ***
27VNF Instantiation
28 [Documentation] Instantiate Generic VNF
29 [Tags] instantiate_vnf_ovp
30 [Timeout] 3000
31
32 #### Executing VVP Validation Scripts ####
33 Run VVP Validation Scripts ${BUILD_DIR} ${BUILD_DIR}/templates/ ${OUTPUTDIR}/summary
34
35 #### Creating Runtime Service Mapping Data From Manifest ####
36 ${new_vnf_name}= Add Service Mapping
37
38 #### Runtime Service Name ####
39 ${new_vnf_service_name}= Set Variable ${new_vnf_name}_${GLOBAL_BUILD_NUMBER}
40
41 #### Getting Manifest Data ####
42 ${subscriber}= Retrieve Manifest Data subscriber
43 ${service_type}= Retrieve Manifest Data service_type
44 ${tenant_name}= Retrieve Manifest Data tenant_name
45 ${region_id}= Retrieve Manifest Data region_id
46 ${cloud_owner}= Retrieve Manifest Data cloud_owner
47 ${project_name}= Retrieve Manifest Data project_name
48 ${owning_entity}= Retrieve Manifest Data owning_entity
49 ${platform}= Retrieve Manifest Data platform
50 ${line_of_business}= Retrieve Manifest Data line_of_business
51 ${api_type}= Retrieve Manifest Data api_type
52 ${os_password}= Retrieve Manifest Data os_password
53
54 #### Copying Heat Templates To Assett Directory ####
55 Copy Files ${BUILD_DIR}/templates/* ${SDC_ASSETS_DIRECTORY}/${new_vnf_name}/
56
57 Log Modeling Service ${new_vnf_service_name} console=yes
58 ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${catalog_resource_ids} ${catalog_service_id}= Model Distribution For Directory ${new_vnf_name} ${new_vnf_service_name}
59
60 #### VID Stuff ####
61 Log Instantiating Service ${new_vnf_service_name} console=yes
62 ${vnf_details}= Instantiate VNF ${subscriber} ${new_vnf_name} ${service_type} ${new_vnf_service_name} ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resources} ${service_type} ${tenant_name} ${region_id} ${cloud_owner} ${project_name} ${owning_entity} ${api_type} platform=${platform} line_of_business=${line_of_business}
63
64 # sleeping after instantiation, seems to occasionally have some issues if running validation immediately
65 Sleep 30
66
67 Run VNF Instantiation Report ${region_id} ${vnf_details} ${os_password} ${new_vnf_name}
68
69*** Keywords ***
70Add Service Mapping
71 [Documentation] Adding service mapping for this VNF at runtime. This replicates service_mapping.json.
72 ${json}= OperatingSystem.Get File ${BUILD_DIR}/vnf-details.json
73 ${object}= Evaluate json.loads('''${json}''') json
74
75 ${vnf_name}= Set Variable ${object["vnf_name"]}
76
77 ${module_list}= Set Variable ${object["modules"]}
78
79 ${template_mapping_list} Create List
80 ${module_index}= Set Variable 0
81
82 :FOR ${module} IN @{module_list}
83 \ ${empty_dict} Create Dictionary
84 \ ${base}= Set Variable ${module["isBase"]}
85 \ ${filename}= Set Variable ${module["filename"]}
86 \ ${index}= Set Variable If '${base}'=='true' 0 ${module_index} + 1
87 \ ${name}= Remove String ${filename} .yaml .yml
88 \ ${preload}= Set Variable ${module["preload"]}
89 \ set to dictionary ${empty_dict} isBase=${base} template="" vnf_index=${index} name_pattern=${name} preload_file=${preload}
90 \ Append To List ${template_mapping_list} ${empty_dict}
91
92 ${GLOBAL_SERVICE_TEMPLATE_MAPPING} Create Dictionary
93 ${GLOBAL_SERVICE_FOLDER_MAPPING} Create Dictionary
94 ${GLOBAL_SERVICE_VNF_MAPPING} Create Dictionary
95 ${GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING} Create Dictionary
96 ${GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING} Create Dictionary
97 ${SERVICE_MAPPING} Create Dictionary
98
99 set to dictionary ${GLOBAL_SERVICE_TEMPLATE_MAPPING} ${vnf_name}=${template_mapping_list}
100
101 ${folder_mapping_list} Create List
102 Append To List ${folder_mapping_list} ${vnf_name}
103 set to dictionary ${GLOBAL_SERVICE_FOLDER_MAPPING} ${vnf_name}=${folder_mapping_list}
104
105 ${service_mapping_list} Create List
106 Append To List ${service_mapping_list} ${vnf_name}
107 set to dictionary ${GLOBAL_SERVICE_VNF_MAPPING} ${vnf_name}=${service_mapping_list}
108
109 ${neutron_mapping_list} Create List
110 set to dictionary ${GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING} ${vnf_name}=${neutron_mapping_list}
111
112 ${deployment_mapping_list} Create List
113 set to dictionary ${GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING} ${vnf_name}=${deployment_mapping_list}
114
115 set to dictionary ${SERVICE_MAPPING} GLOBAL_SERVICE_FOLDER_MAPPING=${GLOBAL_SERVICE_FOLDER_MAPPING} GLOBAL_SERVICE_VNF_MAPPING=${GLOBAL_SERVICE_VNF_MAPPING} GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING=${GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING} GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING=${GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING} GLOBAL_SERVICE_TEMPLATE_MAPPING=${GLOBAL_SERVICE_TEMPLATE_MAPPING} GLOBAL_VALIDATE_NAME_MAPPING=
116
117 ${json_string}= evaluate json.dumps(${SERVICE_MAPPING}) json
118 OperatingSystem.Create File ${GLOBAL_SERVICE_MAPPING_DIRECTORY}/${vnf_name}/service_mapping.json ${json_string}
119 [Return] ${vnf_name}
120
121Retrieve Manifest Data
122 [Arguments] ${required_key}
123 ${json}= OperatingSystem.Get File ${BUILD_DIR}/vnf-details.json
124 ${object}= Evaluate json.loads('''${json}''') json
125 Dictionary Should Contain Key ${object} ${required_key} msg=ERROR: key "${required_key}" not found in the manifest.
126 [Return] ${object["${required_key}"]}
127
128Teardown Test
129 Remove Directory ${BUILD_DIR} recursive=True