diff options
author | Brian Freeman <bf1936@att.com> | 2019-02-04 20:36:08 -0500 |
---|---|---|
committer | Brian Freeman <bf1936@att.com> | 2019-02-04 20:36:17 -0500 |
commit | ee02b31d7cf9f52b09b78095f26f2f05241cc6b0 (patch) | |
tree | 742aa617c8cf0dd55850a02ff4ca2e6890042ba7 | |
parent | 4dda2603994b846e5d697210f53138a274ab142d (diff) |
Dynamic Service Mapping & vFW ip port references
Issue-ID: INT-829
Change-Id: I10f229996cdeb049840fdefe78b35187186a5517
Signed-off-by: Brian Freeman <bf1936@att.com>
-rw-r--r-- | robot/assets/service_mappings.py | 44 | ||||
-rw-r--r-- | robot/resources/asdc_interface.robot | 31 | ||||
-rw-r--r-- | robot/resources/stack_validation/policy_check_vfw.robot | 4 | ||||
-rw-r--r-- | robot/resources/stack_validation/validate_vfw.robot | 17 | ||||
-rw-r--r-- | robot/resources/test_templates/vnf_orchestration_test_template.robot | 6 | ||||
-rw-r--r-- | robot/testsuites/demo.robot | 10 | ||||
-rw-r--r-- | robot/testsuites/model-distribution.robot | 2 |
7 files changed, 98 insertions, 16 deletions
diff --git a/robot/assets/service_mappings.py b/robot/assets/service_mappings.py index fb06b448..1aa9ca58 100644 --- a/robot/assets/service_mappings.py +++ b/robot/assets/service_mappings.py @@ -1,3 +1,7 @@ +import json +import os.path + + ''' This metadata identifies the folders to be zipped and uploaded to SDC for model distribution for a given VNF ''' @@ -114,3 +118,43 @@ GLOBAL_VALIDATE_NAME_MAPPING = {"vFW" : 'vfw_name_0', "vPKG" : 'vpg_name_0', } + + +# Create dictionaries for new MAPPING data to join to original MAPPING data +GLOBAL_SERVICE_FOLDER_MAPPING2 = {} +GLOBAL_SERVICE_VNF_MAPPING2 = {} +GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2 = {} +GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2 = {} +GLOBAL_SERVICE_TEMPLATE_MAPPING2 = {} +GLOBAL_VALIDATE_NAME_MAPPING2 = {} + + + +folder=os.path.join('./demo/service_mapping') +subfolders = [d for d in os.listdir(folder) if os.path.isdir(os.path.join(folder, d))] + +for service in subfolders: + filepath=os.path.join('./demo/service_mapping', service, 'service_mapping.json') + with open(filepath, 'r') as f: + service_mappings = json.load(f) + for mapping in service_mappings: + if mapping == 'GLOBAL_SERVICE_FOLDER_MAPPING': + GLOBAL_SERVICE_FOLDER_MAPPING2[service]=service_mappings[mapping][service] + if mapping == 'GLOBAL_SERVICE_VNF_MAPPING': + GLOBAL_SERVICE_VNF_MAPPING2[service]=service_mappings[mapping][service] + 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] + if mapping == 'GLOBAL_SERVICE_TEMPLATE_MAPPING': + GLOBAL_SERVICE_TEMPLATE_MAPPING2[service]=service_mappings[mapping][service] + if mapping == 'GLOBAL_VALIDATE_NAME_MAPPING': + GLOBAL_VALIDATE_NAME_MAPPING2[service]=service_mappings[mapping][service] + +# Merge dictionaries +GLOBAL_SERVICE_FOLDER_MAPPING = dict(GLOBAL_SERVICE_FOLDER_MAPPING.items() + GLOBAL_SERVICE_FOLDER_MAPPING2.items()) +GLOBAL_SERVICE_VNF_MAPPING = dict(GLOBAL_SERVICE_VNF_MAPPING.items() + GLOBAL_SERVICE_VNF_MAPPING2.items()) +GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING = dict(GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING.items() + GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING2.items()) +GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING = dict(GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING.items() + GLOBAL_SERVICE_DEPLOYMENT_ARTIFACT_MAPPING2.items()) +GLOBAL_SERVICE_TEMPLATE_MAPPING = dict(GLOBAL_SERVICE_TEMPLATE_MAPPING.items() + GLOBAL_SERVICE_TEMPLATE_MAPPING2.items()) +GLOBAL_VALIDATE_NAME_MAPPING = dict(GLOBAL_VALIDATE_NAME_MAPPING.items() + GLOBAL_VALIDATE_NAME_MAPPING2.items()) diff --git a/robot/resources/asdc_interface.robot b/robot/resources/asdc_interface.robot index 6a820aef..f2957763 100644 --- a/robot/resources/asdc_interface.robot +++ b/robot/resources/asdc_interface.robot @@ -76,19 +76,42 @@ Distribute Model From ASDC ${catalog_service_id}= Add ASDC Catalog Service ${catalog_service_name} ${catalog_resource_ids}= Create List ${catalog_resources}= Create Dictionary + ##### TODO: Support for Multiple resources of one type in a service ###### + # The zip list is the resources - no mechanism to indicate more than 1 of the items in the zip list + # GLOBAL_SERVICE_VNF_MAPPING has the logical mapping but its not the same key as model_zip_path + # ${vnflist}= Get From Dictionary ${GLOBAL_SERVICE_VNF_MAPPING} ${service} + # Save the resource_id in a dictionary keyed byt the resource NAme in the zipfile name (vFWDT_vFWSNK.zip or vFWDT_vPKG.zip) + # Create the resources but dont immediately add resource + # Add Resource to Service in a separate FOR loop + # TODO: CHECK vCPE models to make sure they aren't broken with the split + ${resource_types}= Create Dictionary + : FOR ${zip} IN @{model_zip_path} \ ${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 '${resource_type_match}' is '[]' ${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} - \ ${loop_catalog_resource_resp}= Get ASDC Catalog Resource ${loop_catalog_resource_id} - \ ${catalog_resource_unique_name}= Add ASDC Resource Instance ${catalog_service_id} ${loop_catalog_resource_id} ${loop_catalog_resource_resp['name']} - \ Set To Dictionary ${catalog_resources} ${loop_catalog_resource_id}=${loop_catalog_resource_resp} + + + ${vnflist}= Get From Dictionary ${GLOBAL_SERVICE_VNF_MAPPING} ${service} + + # Spread the icons on the pallette starting on the left + ${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} + \ ${xoffset}= Set Variable ${xoffset+100} # # do this here because the loop_catalog_resource_resp is different format after adding networks ${vf_module}= Find Element In Array ${loop_catalog_resource_resp['groups']} type org.openecomp.groups.VfModule # # do network ${networklist}= Get From Dictionary ${GLOBAL_SERVICE_GEN_NEUTRON_NETWORK_MAPPING} ${service} - ${xoffset}= Set Variable ${100} ${generic_neutron_net_uuid}= Get Generic NeutronNet UUID :FOR ${network} in @{networklist} \ ${loop_catalog_resource_id}= Set Variable ${generic_neutron_net_uuid} diff --git a/robot/resources/stack_validation/policy_check_vfw.robot b/robot/resources/stack_validation/policy_check_vfw.robot index a4c343eb..6876748c 100644 --- a/robot/resources/stack_validation/policy_check_vfw.robot +++ b/robot/resources/stack_validation/policy_check_vfw.robot @@ -39,8 +39,8 @@ Policy Check FirewallCL Stack ${invariantUUID} Get From Dictionary ${generic_vnf} persona-model-id Update vVFWCL Policy ${invariantUUID} - ${vpg_unprotected_ip}= Get From Dictionary ${vpkg_stack_info} vpg_private_ip_0 - ${vsn_protected_ip}= Get From Dictionary ${vsnk_stack_info} vsn_private_ip_0 + ${vpg_unprotected_ip}= Get From Dictionary ${vpkg_stack_info} vpg_int_unprotected_private_ip_0 + ${vsn_protected_ip}= Get From Dictionary ${vsnk_stack_info} vsn_int_protected_private_ip_0 ${vpg_public_ip}= Get Server Ip ${server_list} ${vpkg_stack_info} vpg_name_0 network_name=public ${vsn_public_ip}= Get Server Ip ${server_list} ${vsnk_stack_info} vsn_name_0 network_name=public ${upper_bound}= Evaluate ${policy_rate}*2 diff --git a/robot/resources/stack_validation/validate_vfw.robot b/robot/resources/stack_validation/validate_vfw.robot index e1627202..3314c7e6 100644 --- a/robot/resources/stack_validation/validate_vfw.robot +++ b/robot/resources/stack_validation/validate_vfw.robot @@ -28,8 +28,8 @@ Validate Firewall Stack ${stack_id}= Get From Dictionary ${stack_info} id ${server_list}= Get Openstack Servers auth - ${vpg_unprotected_ip}= Get From Dictionary ${stack_info} vpg_private_ip_0 - ${vsn_protected_ip}= Get From Dictionary ${stack_info} vsn_private_ip_0 + ${vpg_unprotected_ip}= Get From Dictionary ${stack_info} vpg_int_unprotected_private_ip_0 + ${vsn_protected_ip}= Get From Dictionary ${stack_info} vsn_int_protected_private_ip_0 ${vpg_name_0}= Get From Dictionary ${stack_info} vpg_name_0 ${vfw_public_ip}= Get Server Ip ${server_list} ${stack_info} vfw_name_0 network_name=public ${vpg_public_ip}= Get Server Ip ${server_list} ${stack_info} vpg_name_0 network_name=public @@ -39,13 +39,14 @@ Validate Firewall Stack Wait For Server ${vpg_public_ip} Wait For Server ${vsn_public_ip} Log Accessed all servers - Wait For Firewall ${vfw_public_ip} - Wait For Packet Generator ${vpg_public_ip} - Wait For Packet Sink ${vsn_public_ip} - Log All server processes up - ${vpg_oam_ip}= Get From Dictionary ${stack_info} vpg_private_ip_1 + # TODO: Stop here in validation until resolving ssh login + #Wait For Firewall ${vfw_public_ip} + #Wait For Packet Generator ${vpg_public_ip} + #Wait For Packet Sink ${vsn_public_ip} + #Log All server processes up + ${vpg_oam_ip}= Get From Dictionary ${stack_info} vpg_onap_private_ip_0 ${appc}= Create Mount Point In APPC ${vpg_name_0} ${vpg_oam_ip} - Wait For Packets ${vpg_public_ip} ${vpg_unprotected_ip} ${vsn_protected_ip} ${vsn_public_ip} + #Wait For Packets ${vpg_public_ip} ${vpg_unprotected_ip} ${vsn_protected_ip} ${vsn_public_ip} Wait For Packets [Documentation] Final vfw validation that packets are flowing from the pgn VM to the snk VM diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot index e670dac2..86af5833 100644 --- a/robot/resources/test_templates/vnf_orchestration_test_template.robot +++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot @@ -68,9 +68,11 @@ Orchestrate VNF Validate Service Instance ${service_instance_id} ${service} ${customer_name} ${vnflist}= Get From Dictionary ${GLOBAL_SERVICE_VNF_MAPPING} ${service} ${generic_vnfs}= Create Dictionary + ${vnf_name_index}= Set Variable 0 :for ${vnf} in @{vnflist} - \ ${vnf_name}= Catenate Ete_${vnf}_${uuid} - \ ${vf_module_name}= Catenate Vfmodule_Ete_${vnf}_${uuid} + \ ${vnf_name}= Catenate Ete_${vnf}_${uuid}_${vnf_name_index} + \ ${vf_module_name}= Catenate Vfmodule_Ete_${vnf}_${uuid}_${vnf_name_index} + \ ${vnf_name_index}= Evaluate ${vnf_name_index} + 1 \ ${vnf_type}= Get VNF Type ${catalog_resources} ${vnf} \ ${vf_module}= Get VF Module ${catalog_resources} ${vnf} \ Append To List ${STACK_NAMES} ${vf_module_name} diff --git a/robot/testsuites/demo.robot b/robot/testsuites/demo.robot index e270c631..a4ab0997 100644 --- a/robot/testsuites/demo.robot +++ b/robot/testsuites/demo.robot @@ -49,6 +49,10 @@ Instantiate VFWCL [Tags] instantiateVFWCL Instantiate VNF vFWCL base_vpkg +Instantiate VFWDT + [Tags] instantiateVFWDT + Instantiate VNF vFWDT base_vpkg + Delete Instantiated VNF [Documentation] This test assumes all necessary variables are loaded via the variable file create in Save For Delete @@ -79,3 +83,9 @@ Distribute vFWNG CDS Model [Timeout] 600 Model Distribution For Directory service=vFWNG cds=vfwng +Distribute Demo vFWDT Model + [Documentation] Distribute Demo vFWDT (does not delete model after distribution) + [Tags] DistributeDemoVFWDT + [Timeout] 600 + Model Distribution For Directory service=vFWDT + diff --git a/robot/testsuites/model-distribution.robot b/robot/testsuites/model-distribution.robot index 0b8cc35a..53b52c1b 100644 --- a/robot/testsuites/model-distribution.robot +++ b/robot/testsuites/model-distribution.robot @@ -18,3 +18,5 @@ Distribute vFW Model vFW [Tags] ete distribute Distribute vVG Model vVG [Tags] ete distribute +Distribute vFWDT Model vFWDT + [Tags] distributeVFWDT |