Fix dynamic service_mappin 26/78426/1
authorBrian Freeman <bf1936@att.com>
Wed, 13 Feb 2019 18:54:48 +0000 (13:54 -0500)
committerBrian Freeman <bf1936@att.com>
Wed, 13 Feb 2019 18:54:55 +0000 (13:54 -0500)
Issue-ID: INT-883
Change-Id: Ia29b4468eaf68f0352f8dd6c84c382c5431beab2
Signed-off-by: Brian Freeman <bf1936@att.com>
robot/assets/service_mappings.py
robot/resources/asdc_interface.robot
robot/resources/sdngc_interface.robot

index 1aa9ca5..977d216 100644 (file)
@@ -27,7 +27,7 @@ GLOBAL_SERVICE_VNF_MAPPING = {
     "vLB"  : ['vLB'],
     "vVG"  : ['vVG'],
     "vCPE" : ['vCPE'],
-    "vFWCL"  : ['vFWSNK', 'vPKG'],
+    "vFWCL"  : ['vFWCLvFWSNK', 'vFWCLvPKG'],
     "vFWNG"  : ['vFWNG'],
     "vCPEInfra" : ['vCPEInfra'],
     "vCPEvBNG" : ['vCPEvBNG'],
@@ -92,6 +92,8 @@ GLOBAL_SERVICE_TEMPLATE_MAPPING = {
     "vPKG"   : [{"isBase" : "true",  "template" : "vpkg_preload.template", "name_pattern": "base_vpkg"}],
     "vFWCL"   : [{"isBase" : "true",   "template" : "vfwsnk_preload.template", "name_pattern": "base_vfw"},
                  {"isBase" : "true",  "template" : "vpkg_preload.template", "name_pattern": "base_vpkg"}],
+    "vFWCLvFWSNK"   : [{"isBase" : "true",   "template" : "vfwsnk_preload.template", "vnf_index": "0", "name_pattern": "base_vfw"}],
+    "vFWCLvPKG"   : [{"isBase" : "true",  "template" : "vpkg_preload.template", "vnf_index": "1" , "name_pattern": "base_vpkg"}],
     "vCPEInfra" : [{"isBase" : "true",  "template" : "vcpe_infra_preload.template", "name_pattern": "base_infra"}],
     "vCPEvBNG" : [{"isBase" : "true",  "template" : "vcpe_vbng_preload.template", "name_pattern": "base_vbng"}],
     "vCPEvBRGEMU" : [{"isBase" : "true",  "template" : "vcpe_vbrgemu_preload.template", "name_pattern": "base_vbrgemu"}],
@@ -116,6 +118,8 @@ GLOBAL_VALIDATE_NAME_MAPPING = {"vFW" : 'vfw_name_0',
                                  "vCPEvGMUX" : 'vgmux_name_0',
                                  "vFWSNK" : 'vfw_name_0',
                                  "vPKG" : 'vpg_name_0',
+                                 "vFWCLvFWSNK" : 'vfw_name_0',
+                                 "vFWCLvPKG" : 'vpg_name_0',
                                  }
 
 
@@ -145,11 +149,17 @@ for service in subfolders:
         if mapping == 'GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING':
            GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2[service]=service_mappings[mapping][service]
         if mapping == 'GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING':
-           GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2[service]=service_mappings[mapping][service] 
+           GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2[service]=service_mappings[mapping][service]
         if mapping == 'GLOBAL_SERVICE_TEMPLATE_MAPPING':
-           GLOBAL_SERVICE_TEMPLATE_MAPPING2[service]=service_mappings[mapping][service] 
+        #  service changes for complex vnf
+           #GLOBAL_SERVICE_TEMPLATE_MAPPING2[service]=service_mappings[mapping][service]
+           for vnftype   in service_mappings[mapping]:
+               GLOBAL_SERVICE_TEMPLATE_MAPPING2[vnftype]=service_mappings[mapping][vnftype]
         if mapping == 'GLOBAL_VALIDATE_NAME_MAPPING':
-           GLOBAL_VALIDATE_NAME_MAPPING2[service]=service_mappings[mapping][service]  
+        #  service changes for complex vnf
+           #GLOBAL_VALIDATE_NAME_MAPPING2[service]=service_mappings[mapping][service]
+           for vnftype   in service_mappings[mapping]:
+               GLOBAL_VALIDATE_NAME_MAPPING2[vnftype]=service_mappings[mapping][vnftype]
 
 # Merge dictionaries
 GLOBAL_SERVICE_FOLDER_MAPPING =  dict(GLOBAL_SERVICE_FOLDER_MAPPING.items() + GLOBAL_SERVICE_FOLDER_MAPPING2.items())
index f09ddf7..a044dab 100644 (file)
@@ -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}
index b311e9b..7be6e15 100644 (file)
@@ -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}