Brian Freeman | e12b626 | 2019-04-16 14:24:29 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Instantiate VNF |
| 3 | |
| 4 | Library OperatingSystem |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library DateTime |
| 8 | Library SoUtils |
| 9 | |
| 10 | |
| 11 | *** Variables *** |
| 12 | |
| 13 | |
| 14 | *** Keywords *** |
| 15 | Instantiate Service Direct To SO |
| 16 | [Documentation] Creates an entire service from a CSAR |
| 17 | [Arguments] ${service} ${csar_file} ${vnf_template_file} |
| 18 | # Example: ${csar_file}= Set Variable /tmp/csar/service-Vfw20190413133734-csar.csar |
| 19 | # Example: ${vnf_template_file}= Set Variable /var/opt/ONAP/testsuite/eteutils/vcpeutils/preload_templates/template.vfw_vfmodule.json |
| 20 | ${name_suffix}= Get Current Date exclude_millis=True |
| 21 | ${name_suffix}= Evaluate '${name_suffix}'.replace(' ','') |
| 22 | ${name_suffix}= Evaluate '${name_suffix}'.replace(':','') |
| 23 | ${heatbridge}= Set Variable false |
| 24 | ${preload_dict}= Copy Dictionary ${GLOBAL_PRELOAD_PARAMETERS['defaults']} |
| 25 | ${template}= Create Dictionary |
| 26 | @{keys}= Get Dictionary Keys ${preload_dict} |
| 27 | :for ${key} in @{keys} |
| 28 | \ ${value}= Get From Dictionary ${preload_dict} ${key} |
| 29 | \ ${tmp_value}= Set Variable If 'GLOBAL_' in $value ${value} |
| 30 | \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} \$ ${EMPTY} |
| 31 | \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} { ${EMPTY} |
| 32 | \ ${tmp_value}= Run Keyword If 'GLOBAL_' in $value Replace String ${tmp_value} } ${EMPTY} |
| 33 | \ ${value}= Set Variable If 'GLOBAL_' in $value ${GLOBAL_INJECTED_PROPERTIES["${tmp_value}"]} ${value} |
| 34 | \ ${new_key}= Catenate \$ { ${key} } |
| 35 | \ ${new_key}= Evaluate '${new_key}'.replace(' ','') |
| 36 | \ Set To Dictionary ${template} ${new_key} ${value} |
| 37 | |
| 38 | ${tmp_key1}= Catenate \$ { ecompnet } |
| 39 | ${tmp_key1}= Evaluate '${tmp_key1}'.replace(' ','') |
| 40 | ${tmp_key2}= Catenate \$ { GLOBAL_INJECTED_UBUNTU_1404_IMAGE } |
| 41 | ${tmp_key2}= Evaluate '${tmp_key2}'.replace(' ','') |
| 42 | # ecompnet 13 , 14, 15 |
Brian Freeman | 9d85d0b | 2019-04-17 13:46:53 -0500 | [diff] [blame^] | 43 | # use same method as sdnc preload robot script |
| 44 | ${ecompnet}= Evaluate str((${GLOBAL_BUILD_NUMBER}%128)+128) |
| 45 | |
| 46 | Set To Dictionary ${template} ${tmp_key1} ${ecompnet} ${tmp_key2} ${GLOBAL_INJECTED_UBUNTU_1404_IMAGE} |
Brian Freeman | e12b626 | 2019-04-16 14:24:29 -0500 | [diff] [blame] | 47 | |
| 48 | Log ${preload_dict} |
| 49 | Log ${template} |
Brian Freeman | 9d85d0b | 2019-04-17 13:46:53 -0500 | [diff] [blame^] | 50 | ${service_instance_id}= Create Entire Service ${csar_file} ${vnf_template_file} ${template} ${name_suffix} ${GLOBAL_INJECTED_REGION} ${GLOBAL_INJECTED_OPENSTACK_TENANT_ID} ${heatbridge} |
| 51 | Log To Console ServiceInstanceId:${service_instance_id} |
| 52 | Should Not Be Equal As Strings ${service_instance_id} None |
Brian Freeman | e12b626 | 2019-04-16 14:24:29 -0500 | [diff] [blame] | 53 | |