blob: 0c74d5f676f7b898517dceffdf9c4513f556ab04 [file] [log] [blame]
Brian Freemane12b6262019-04-16 14:24:29 -05001*** Settings ***
2Documentation Instantiate VNF
3
4Library OperatingSystem
5Library Collections
6Library String
7Library DateTime
8Library SoUtils
DR695Hf6948fa2019-07-11 18:03:00 -04009Library ONAPLibrary.PreloadData
DR695H910097e2019-05-08 13:55:32 -040010Resource ../global_properties.robot
Brian Freemane12b6262019-04-16 14:24:29 -050011
12*** Keywords ***
13Instantiate Service Direct To SO
14 [Documentation] Creates an entire service from a CSAR
15 [Arguments] ${service} ${csar_file} ${vnf_template_file}
16 # Example: ${csar_file}= Set Variable /tmp/csar/service-Vfw20190413133734-csar.csar
DR695Hffe5abf2019-06-20 16:58:49 -040017 # Example: ${vnf_template_file}= Set Variable /var/opt/ONAP/testsuite/vcpeutils/preload_templates/template.vfw_vfmodule.json
DR695Hf6948fa2019-07-11 18:03:00 -040018 Set Directory preload ./demo/preload_data
19 ${preload_dict}= Get Default Preload Data preload
Brian Freemane12b6262019-04-16 14:24:29 -050020 ${template}= Create Dictionary
21 @{keys}= Get Dictionary Keys ${preload_dict}
DR695H910097e2019-05-08 13:55:32 -040022 :FOR ${key} IN @{keys}
Brian Freemane12b6262019-04-16 14:24:29 -050023 \ ${value}= Get From Dictionary ${preload_dict} ${key}
24 \ ${tmp_value}= Set Variable If 'GLOBAL_' in $value ${value}
25 \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} \$ ${EMPTY}
26 \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} { ${EMPTY}
27 \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} } ${EMPTY}
28 \ ${value}= Set Variable If 'GLOBAL_' in $value ${GLOBAL_INJECTED_PROPERTIES["${tmp_value}"]} ${value}
29 \ ${new_key}= Catenate \$ { ${key} }
30 \ ${new_key}= Evaluate '${new_key}'.replace(' ','')
31 \ Set To Dictionary ${template} ${new_key} ${value}
32
33 ${tmp_key1}= Catenate \$ { ecompnet }
34 ${tmp_key1}= Evaluate '${tmp_key1}'.replace(' ','')
35 ${tmp_key2}= Catenate \$ { GLOBAL_INJECTED_UBUNTU_1404_IMAGE }
36 ${tmp_key2}= Evaluate '${tmp_key2}'.replace(' ','')
37 # ecompnet 13 , 14, 15
Brian Freeman9d85d0b2019-04-17 13:46:53 -050038 # use same method as sdnc preload robot script
39 ${ecompnet}= Evaluate str((${GLOBAL_BUILD_NUMBER}%128)+128)
40
41 Set To Dictionary ${template} ${tmp_key1} ${ecompnet} ${tmp_key2} ${GLOBAL_INJECTED_UBUNTU_1404_IMAGE}
Brian Freemane12b6262019-04-16 14:24:29 -050042
43 Log ${preload_dict}
44 Log ${template}
DR695Hc1103fb2019-07-22 12:37:45 -040045 ${service_instance_id}= Create Entire Service ${csar_file} ${vnf_template_file} ${template} ${GLOBAL_INJECTED_REGION} ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID} ${GLOBAL_INJECTED_PUBLIC_KEY}
DR695H8e7028b2019-07-10 10:13:58 -040046 Log ServiceInstanceId:${service_instance_id}
DR695Hc1103fb2019-07-22 12:37:45 -040047 Should Not Be Equal As Strings ${service_instance_id} None