From 12ff1844383b99b7b7efa8aae5bef8361bd163b1 Mon Sep 17 00:00:00 2001 From: Brian Freeman Date: Wed, 13 Feb 2019 13:54:48 -0500 Subject: Fix dynamic service_mappin Issue-ID: INT-883 Change-Id: Ia29b4468eaf68f0352f8dd6c84c382c5431beab2 Signed-off-by: Brian Freeman --- robot/resources/asdc_interface.robot | 4 ++-- robot/resources/sdngc_interface.robot | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'robot/resources') diff --git a/robot/resources/asdc_interface.robot b/robot/resources/asdc_interface.robot index f09ddf7b..a044dabd 100644 --- a/robot/resources/asdc_interface.robot +++ b/robot/resources/asdc_interface.robot @@ -90,7 +90,8 @@ Distribute Model From ASDC \ ${loop_catalog_resource_id}= Setup ASDC Catalog Resource ${zip} ${cds} # zip can be vFW.zip or vFWDT_VFWSNK.zip \ ${resource_type_match}= Get Regexp Matches ${zip} ${service}_(.*)\.zip 1 - \ ${resource_type_string}= Set Variable If len(${resource_type_match})==0 ${service} ${resource_type_match[0]} + # Need to be able to distribute preload for vFWCL vFWSNK and vFWDT vFWSNK to prepend service to vnf_type + \ ${resource_type_string}= Set Variable If len(${resource_type_match})==0 ${service} ${service}${resource_type_match[0]} \ Set To Dictionary ${resource_types} ${resource_type_string} ${loop_catalog_resource_id} \ Append To List ${catalog_resource_ids} ${loop_catalog_resource_id} @@ -101,7 +102,6 @@ Distribute Model From ASDC ${xoffset}= Set Variable ${0} : FOR ${vnf} IN @{vnflist} - #\ ${catalog_resource_unique_name}= Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']} \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${resource_types['${vnf}']} \ Set To Dictionary ${catalog_resources} ${resource_types['${vnf}']}=${loop_catalog_resource_resp} \ ${catalog_resource_unique_name}= Add ASDC Resource Instance ${catalog_service_id} ${resource_types['${vnf}']} ${loop_catalog_resource_resp['name']} ${xoffset} diff --git a/robot/resources/sdngc_interface.robot b/robot/resources/sdngc_interface.robot index b311e9bd..7be6e153 100644 --- a/robot/resources/sdngc_interface.robot +++ b/robot/resources/sdngc_interface.robot @@ -88,7 +88,11 @@ Preload Vnf ${templates}= Get From Dictionary ${GLOBAL_SERVICE_TEMPLATE_MAPPING} ${service} :for ${vf_module} in @{vf_modules} \ ${vf_module_type}= Get From Dictionary ${vf_module} name - \ ${dict} Get From Mapping ${templates} ${vf_module} + # need to pass in vnf_index if non-zero + \ ${dict} Run Keyword If "${generic_vnf_name}".endswith('0') Get From Mapping With Index ${templates} ${vf_module} 0 + \ ... ELSE IF "${generic_vnf_name}".endswith('1') Get From Mapping With Index ${templates} ${vf_module} 1 + \ ... ELSE IF "${generic_vnf_name}".endswith('2') Get From Mapping With Index ${templates} ${vf_module} 2 + \ ... ELSE Get From Mapping ${templates} ${vf_module} \ ${filename}= Get From Dictionary ${dict} template \ ${base_vf_module_type}= Set Variable If '${dict['isBase']}' == 'true' ${vf_module_type} ${base_vf_module_type} \ ${closedloop_vf_module}= Set Variable If '${dict['isBase']}' == 'false' ${vf_module} ${closedloop_vf_module} @@ -105,6 +109,14 @@ Update Module Name ${name}= Replace String ${vf_module_name} Vfmodule_ ${dict['prefix']} [Return] ${name} +Get From Mapping With Index + [Documentation] Retrieve the appropriate prelad template entry for the passed vf_module + [Arguments] ${templates} ${vf_module} ${vnf_index}=0 + ${vf_module_name}= Get From DIctionary ${vf_module} name + :for ${template} in @{templates} + \ Return From Keyword If '${template['name_pattern']}' in '${vf_module_name}' and ('${template['vnf_index']}' == '${vnf_index}') ${template} + [Return] None + Get From Mapping [Documentation] Retrieve the appropriate prelad template entry for the passed vf_module [Arguments] ${templates} ${vf_module} @@ -237,4 +249,4 @@ Login To SDNGC Admin GUI Input Password xpath=//input[@id='password'] ${shortened_uuid} Click Button xpath=//button[@type='submit'] Title Should Be SDN-C AdminPortal - Log Logged in to ${SDNGC_ADMIN_LOGIN_URL} \ No newline at end of file + Log Logged in to ${SDNGC_ADMIN_LOGIN_URL} -- cgit 1.2.3-korg