blob: 72a92df0660b514b5872cdab53b404badb58112a [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
DR695H910097e2019-05-08 13:55:32 -04009Resource ../global_properties.robot
Brian Freemane12b6262019-04-16 14:24:29 -050010
11*** Keywords ***
12Instantiate Service Direct To SO
13 [Documentation] Creates an entire service from a CSAR
14 [Arguments] ${service} ${csar_file} ${vnf_template_file}
15 # Example: ${csar_file}= Set Variable /tmp/csar/service-Vfw20190413133734-csar.csar
16 # Example: ${vnf_template_file}= Set Variable /var/opt/ONAP/testsuite/eteutils/vcpeutils/preload_templates/template.vfw_vfmodule.json
17 ${name_suffix}= Get Current Date exclude_millis=True
18 ${name_suffix}= Evaluate '${name_suffix}'.replace(' ','')
19 ${name_suffix}= Evaluate '${name_suffix}'.replace(':','')
Brian Freemane12b6262019-04-16 14:24:29 -050020 ${preload_dict}= Copy Dictionary ${GLOBAL_PRELOAD_PARAMETERS['defaults']}
21 ${template}= Create Dictionary
22 @{keys}= Get Dictionary Keys ${preload_dict}
DR695H910097e2019-05-08 13:55:32 -040023 :FOR ${key} IN @{keys}
Brian Freemane12b6262019-04-16 14:24:29 -050024 \ ${value}= Get From Dictionary ${preload_dict} ${key}
25 \ ${tmp_value}= Set Variable If 'GLOBAL_' in $value ${value}
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 \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} } ${EMPTY}
29 \ ${value}= Set Variable If 'GLOBAL_' in $value ${GLOBAL_INJECTED_PROPERTIES["${tmp_value}"]} ${value}
30 \ ${new_key}= Catenate \$ { ${key} }
31 \ ${new_key}= Evaluate '${new_key}'.replace(' ','')
32 \ Set To Dictionary ${template} ${new_key} ${value}
33
34 ${tmp_key1}= Catenate \$ { ecompnet }
35 ${tmp_key1}= Evaluate '${tmp_key1}'.replace(' ','')
36 ${tmp_key2}= Catenate \$ { GLOBAL_INJECTED_UBUNTU_1404_IMAGE }
37 ${tmp_key2}= Evaluate '${tmp_key2}'.replace(' ','')
38 # ecompnet 13 , 14, 15
Brian Freeman9d85d0b2019-04-17 13:46:53 -050039 # use same method as sdnc preload robot script
40 ${ecompnet}= Evaluate str((${GLOBAL_BUILD_NUMBER}%128)+128)
41
42 Set To Dictionary ${template} ${tmp_key1} ${ecompnet} ${tmp_key2} ${GLOBAL_INJECTED_UBUNTU_1404_IMAGE}
Brian Freemane12b6262019-04-16 14:24:29 -050043
44 Log ${preload_dict}
45 Log ${template}
Brian Freemanecd38602019-05-06 09:48:01 -050046 ${service_instance_id}= Create Entire Service ${csar_file} ${vnf_template_file} ${template} ${name_suffix} ${GLOBAL_INJECTED_REGION} ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID}
Brian Freeman9d85d0b2019-04-17 13:46:53 -050047 Log To Console ServiceInstanceId:${service_instance_id}
48 Should Not Be Equal As Strings ${service_instance_id} None
Brian Freemane12b6262019-04-16 14:24:29 -050049