2 Documentation Instantiate VNF
4 Library OperatingSystem
9 Library ONAPLibrary.PreloadData WITH NAME PreloadData
10 Library ONAPLibrary.Utilities
11 Library ONAPLibrary.JSON
12 Library ONAPLibrary.ServiceMapping WITH NAME ServiceMapping
13 Library ONAPLibrary.Templating WITH NAME Templating
14 Library ONAPLibrary.SO WITH NAME SO
15 Resource ../global_properties.robot
19 ${SO_TEMPLATE_PATH} so
20 ${SO_CATALOGDB_PATH} /ecomp/mso/catalog/v2/serviceVnfs?serviceModelName
21 ${SO_APIHANDLER_PATH} /onap/so/infra/serviceInstantiation/v7/serviceInstances
24 Instantiate Service Direct To SO
25 [Documentation] Creates an entire service from a CSAR
26 [Arguments] ${service} ${csar_file} ${vnf_template_file}
27 # Example: ${csar_file}= Set Variable /tmp/csar/service-Vfw20190413133734-csar.csar
28 # Example: ${vnf_template_file}= Set Variable /var/opt/ONAP/testsuite/vcpeutils/preload_templates/template.vfw_vfmodule.json
29 PreloadData.Set Directory preload ./demo/preload_data
30 ${preload_dict}= Get Default Preload Data preload
31 ${template}= Create Dictionary
32 @{keys}= Get Dictionary Keys ${preload_dict}
33 ${parameters}= Get Globally Injected Parameters
34 :FOR ${key} IN @{keys}
35 \ ${value}= Get From Dictionary ${preload_dict} ${key}
36 \ ${tmp_value}= Set Variable If 'GLOBAL_' in $value ${value}
37 \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} \$ ${EMPTY}
38 \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} { ${EMPTY}
39 \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} } ${EMPTY}
40 \ ${value}= Set Variable If 'GLOBAL_' in $value ${parameters["${tmp_value}"]} ${value}
41 \ ${new_key}= Catenate \$ { ${key} }
42 \ ${new_key}= Evaluate '${new_key}'.replace(' ','')
43 \ Set To Dictionary ${template} ${new_key} ${value}
45 ${tmp_key1}= Catenate \$ { ecompnet }
46 ${tmp_key1}= Evaluate '${tmp_key1}'.replace(' ','')
47 ${tmp_key2}= Catenate \$ { GLOBAL_INJECTED_UBUNTU_1404_IMAGE }
48 ${tmp_key2}= Evaluate '${tmp_key2}'.replace(' ','')
49 # ecompnet 13 , 14, 15
50 # use same method as sdnc preload robot script
51 ${ecompnet}= Evaluate str((${GLOBAL_BUILD_NUMBER}%128)+128)
53 Set To Dictionary ${template} ${tmp_key1} ${ecompnet} ${tmp_key2} ${GLOBAL_INJECTED_UBUNTU_1404_IMAGE}
57 ${service_instance_id}= Create Entire Service ${csar_file} ${vnf_template_file} ${template} ${GLOBAL_INJECTED_REGION} ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID} ${GLOBAL_INJECTED_PUBLIC_KEY}
58 Log ServiceInstanceId:${service_instance_id}
59 Should Not Be Equal As Strings ${service_instance_id} None
62 CDS Service Instantiate
63 [Arguments] ${cds_service_model} ${service_uuid} ${service_invariantUUID}
64 ${auth}= Create List ${GLOBAL_SO_CATDB_USERNAME} ${GLOBAL_SO_PASSWORD}
65 ${resp}= SO.Run Get Request ${GLOBAL_SO_CATDB_ENDPOINT} ${SO_CATALOGDB_PATH}=${cds_service_model} auth=${auth}
66 Should Be Equal As Strings ${resp.status_code} 200
68 @{date_time}= Split String ${time_now}
69 ${time_stamp}= Catenate SEPARATOR=_ @{date_time}[0] @{date_time}[1]
70 ${customized_time_stamp}= Remove String ${time_stamp} :
71 ${cds_instance_name}= Set Variable cds_vlb_svc_${customized_time_stamp}
72 ${global_parameters}= Get Globally Injected Parameters
73 ${dict}= Set To Dictionary ${global_parameters} service_instance_name=${cds_instance_name} owning_entity=OE-Demonstration homing_solution=none owning_entity_id=67f2e84c-734d-4e90-a1e4-d2ffa2e75849 subscriber_id=Demonstration cloud_owner=${GLOBAL_AAI_CLOUD_OWNER} subscription_service_type=vLB service_model_name=${cds_service_model} service_model_uuid=${service_uuid} service_model_invariantuuid=${service_invariantUUID} resp=${resp.json()}
74 Templating.Create Environment cds ${GLOBAL_TEMPLATE_FOLDER}
75 ${data}= Templating.Apply Template cds ${SO_TEMPLATE_PATH}/cds_service_template.jinja ${dict}
77 ${auth}= Create List ${GLOBAL_SO_USERNAME} ${GLOBAL_SO_PASSWORD}
78 ${resp}= SO.Run Post Request ${GLOBAL_SO_APIHAND_ENDPOINT} ${SO_APIHANDLER_PATH} ${data} auth=${auth}
79 Should Be Equal As Strings ${resp.status_code} 202
80 [Return] ${resp.json()['requestReferences']['requestId']}