diff options
Diffstat (limited to 'robot/resources/test_templates')
3 files changed, 450 insertions, 0 deletions
diff --git a/robot/resources/test_templates/closedloop_test_template.robot b/robot/resources/test_templates/closedloop_test_template.robot new file mode 100644 index 00000000..67bf0cb1 --- /dev/null +++ b/robot/resources/test_templates/closedloop_test_template.robot @@ -0,0 +1,210 @@ +*** Settings *** +Documentation Policy Closed Loop Test cases + +Resource ../policy_interface.robot +Resource ../stack_validation/policy_check_vfw.robot +Resource vnf_orchestration_test_template.robot +Library String +Library HttpLibrary.HTTP +LIbrary Process + +*** Variables *** +${RESOURCE_PATH_CREATE} /PyPDPServer/createPolicy +${RESOURCE_PATH_CREATE_PUSH} /PyPDPServer/pushPolicy +${RESOURCE_PATH_CREATE_DELETE} /PyPDPServer/deletePolicy +${RESOURCE_PATH_GET_CONFIG} /PyPDPServer/getConfig +${CREATE_CONFIG_TEMPLATE} robot/assets/templates/policy/closedloop_configpolicy.template +${CREATE_OPS_TEMPLATE} robot/assets/templates/policy/closedloop_opspolicy.template +${PUSH_POLICY_TEMPLATE} robot/assets/templates/policy/closedloop_pushpolicy.template +${DEL_POLICY_TEMPLATE} robot/assets/templates/policy/closedloop_deletepolicy.template +${GECONFIG_VFW_TEMPLATE} robot/assets/templates/policy/closedloop_getconfigpolicy.template + +# 'Normal' number of pg streams that will be set when policy is triggered +${VFWPOLICYRATE} 5 + +# Max nslookup requests per second before triggering event. +${VLBPOLICYRATE} 20 + +${CONFIG_POLICY_NAME} vFirewall +${CONFIG_POLICY_TYPE} Unknown +${OPS_POLICY_NAME} +${OPS_POLICY_TYPE} BRMS_PARAM + +# VFW low threshold +${Expected_Severity_1} MAJOR +${Expected_Threshold_1} 300 +${Expected_Direction_1} LESS_OR_EQUAL + +# VFW high threshold +${Expected_Severity_2} CRITICAL +${Expected_Threshold_2} 700 +${Expected_Direction_2} GREATER_OR_EQUAL + +# VDNS High threshold +${Expected_Severity_3} MAJOR +${Expected_Threshold_3} 200 +${Expected_Direction_3} GREATER_OR_EQUAL + +${DNSSCALINGSTACK} + +*** Keywords *** +VFW Policy + Log Suite name ${SUITE NAME} ${TEST NAME} ${PREV TEST NAME} + Initialize VFW Policy + ${stackname}= Orchestrate VNF vFW closedloop + Policy Check Firewall Stack ${stackname} ${VFWPOLICYRATE} + + +VDNS Policy + Initialize VDNS Policy + ${stackname}= Orchestrate VNF vDNS closedloop + ${dnsscaling}= Policy Check vLB Stack ${stackname} ${VLBPOLICYRATE} + Set Test Variable ${DNSSCALINGSTACK} ${dnsscaling} + +Initialize VFW Policy +# Create Config Policy +# Push Config Policy ${CONFIG_POLICY_NAME} ${CONFIG_POLICY_TYPE} +# Create Ops Policy +# Push Ops Policy ${OPS_POLICY_NAME} ${OPS_POLICY_TYPE} + Get Configs VFW Policy + +Initialize VDNS Policy + Get Configs VDNS Policy + +Get Configs VFW Policy + [Documentation] Get Config Policy for VFW + ${getconfigpolicy}= Catenate .*${CONFIG_POLICY_NAME}* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} + ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} + Should Be Equal As Strings ${get_resp.status_code} 200 + + ${json}= Parse Json ${get_resp.content} + ${config}= Parse Json ${json[0]["config"]} + + # Extract object1 from Array + ${severity}= Get Variable Value ${config["content"]["thresholds"][0]["severity"]} + Should Be Equal ${severity} ${Expected_Severity_1} + ${Thresold_Value}= Get Variable Value ${config["content"]["thresholds"][0]["thresholdValue"]} + Should Be Equal ${Thresold_Value} ${Expected_Threshold_1} + ${direction}= Get Variable Value ${config["content"]["thresholds"][0]["direction"]} + Should Be Equal ${direction} ${Expected_Direction_1} + + # Extract object2 from Array + ${severity_1}= Get Variable Value ${config["content"]["thresholds"][1]["severity"]} + Should Be Equal ${severity_1} ${Expected_Severity_2} + ${Thresold_Value_1}= Get Variable Value ${config["content"]["thresholds"][1]["thresholdValue"]} + Should Be Equal ${Thresold_Value_1} ${Expected_Threshold_2} + ${direction_1}= Get Variable Value ${config["content"]["thresholds"][1]["direction"]} + Should Be Equal ${direction_1} ${Expected_Direction_2} + +Get Configs VDNS Policy + [Documentation] Get Config Policy for VDNS + ${getconfigpolicy}= Catenate .*vLoadBalancer* + ${configpolicy_name}= Create Dictionary config_policy_name=${getconfigpolicy} + ${output} = Fill JSON Template File ${GECONFIG_VFW_TEMPLATE} ${configpolicy_name} + ${get_resp} = Run Policy Get Configs Request ${RESOURCE_PATH_GET_CONFIG} ${output} + Should Be Equal As Strings ${get_resp.status_code} 200 + ${json}= Parse Json ${get_resp.content} + ${config}= Parse Json ${json[0]["config"]} + + # Extract object1 from Array + ${severity}= Get Variable Value ${config["content"]["thresholds"][0]["severity"]} + Should Be Equal ${severity} ${Expected_Severity_3} + ${Thresold_Value}= Get Variable Value ${config["content"]["thresholds"][0]["thresholdValue"]} + Should Be Equal ${Thresold_Value} ${Expected_Threshold_3} + ${direction}= Get Variable Value ${config["content"]["thresholds"][0]["direction"]} + Should Be Equal ${direction} ${Expected_Direction_3} + +Teardown Closed Loop + [Documentation] Tear down a closed loop test case + Terminate All Processes + Teardown VDNS + Teardown VNF + #Clean A&AI Inventory VFWPolicy_Customer Rackspece vFW +# Delete Config Policy ${CONFIG_POLICY_NAME} +# Delete Ops Policy ${OPS_POLICY_NAME} + Log Teardown complete + +Teardown VDNS + Return From Keyword if '${DNSSCALINGSTACK}' == '' + # This needs to be done via VID + Teardown Stack ${DNSSCALINGSTACK} + +Create Config Policy + [Documentation] Create Config Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname} + ${CONFIG_POLICY_NAME}= Set Test Variable ${policyname1} + ${configpolicy}= Create Dictionary policy_name=${CONFIG_POLICY_NAME} + ${output} = Fill JSON Template File ${CREATE_CONFIG_TEMPLATE} ${configpolicy} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + + Create Policy Name + [Documentation] Generate Policy Name + [Arguments] ${prefix}=ETE_ + ${random}= Generate Random String 15 [LOWER][NUMBERS] + ${policyname}= Catenate ${prefix}${random} + [Return] ${policyname} + +Create Ops Policy + [Documentation] Create Opertional Policy + ${randompolicyname} = Create Policy Name + ${policyname1}= Catenate com.${randompolicyname} + ${OPS_POLICY_NAME}= Set Test Variable ${policyname1} + ${dict}= Create Dictionary policy_name=${OPS_POLICY_NAME} + #${NEWPOLICY1}= Create Dictionary policy_name=com.${OPS_POLICY_NAME} + ${output} = Fill JSON Template File ${CREATE_OPS_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE} ${output} + Log ${put_resp} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Push Ops Policy + [Documentation] Push Ops Policy + [Arguments] ${policyname} ${policytype} + ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} + ${output} = Fill JSON Template ${PUSH_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Push Config Policy + [Documentation] Push Config Policy + [Arguments] ${policyname} ${policytype} + ${dict}= Create Dictionary policy_name=${policyname} policy_type=${policytype} + ${output} = Fill JSON Template ${PUSH_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Put Request ${RESOURCE_PATH_CREATE_PUSH} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + + +Delete Config Policy + [Documentation] Delete Config Policy + [Arguments] ${policy_name} + ${policyname3}= Catenate com.Config_BRMS_Param_${policyname}.1.xml + ${dict}= Create Dictionary policy_name=${policyname3} + ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Delete Ops Policy + [Documentation] Delete Ops Policy + [Arguments] ${policy_name} + ${policyname3}= Catenate com.Config_MS_com.vFirewall.1.xml + ${dict}= Create Dictionary policy_name=${policyname3} + ${output} = Fill JSON Template ${DEL_POLICY_TEMPLATE} ${dict} + ${put_resp} = Run Policy Delete Request ${RESOURCE_PATH_CREATE_DELETE} ${output} + Should Be Equal As Strings ${put_resp.status_code} 200 + +Orchestrate VNF vFW closedloop + [Documentation] VNF Orchestration for vFW + Log VNF Orchestration flow TEST NAME=${TEST NAME} + Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} ${GLOBAL_OPENSTACK_SERVICE_REGION} SharedNode OwnerType v1 CloudZone + ${stack_name} ${service}= Orchestrate VNF ETE_CLP vFW vFW ${GLOBAL_OPENSTACK_SERVICE_REGION} ${TENANT_NAME} + [Return] ${stack_name} + + Orchestrate VNF vDNS closedloop + [Documentation] VNF Orchestration for vLB + Log VNF Orchestration flow TEST NAME=${TEST NAME} + Setup Orchestrate VNF ${GLOBAL_AAI_CLOUD_OWNER} ${GLOBAL_OPENSTACK_SERVICE_REGION} SharedNode OwnerType v1 CloudZone + ${stack_name} ${service}= Orchestrate VNF ETE_CLP vLB vLB ${GLOBAL_OPENSTACK_SERVICE_REGION} ${TENANT_NAME} + [Return] ${stack_name} diff --git a/robot/resources/test_templates/model_test_template.robot b/robot/resources/test_templates/model_test_template.robot new file mode 100644 index 00000000..263c5929 --- /dev/null +++ b/robot/resources/test_templates/model_test_template.robot @@ -0,0 +1,57 @@ +*** Settings *** +Documentation The main interface for interacting with ASDC. It handles low level stuff like managing the http request library and DCAE required fields +Library OperatingSystem +Library ArchiveLibrary +Library Collections +Resource ../asdc_interface.robot + +Variables ../../assets/service_mappings.py + +*** Variables *** +${ASDC_BASE_PATH} /sdc1 +${ASDC_DESIGNER_PATH} /proxy-designer1#/dashboard +${ASDC_ASSETS_DIRECTORY} robot/assets/asdc +${VFW_DIRECTORY} base_vfw +${VLB_DIRECTORY} base_vlb +${VVG_DIRECTORY} base_vvg +${SCALING_DIRECTORY} dns_scaling +${ASDC_ZIP_DIRECTORY} ${ASDC_ASSETS_DIRECTORY}/temp + +${CATALOG_RESOURCE_IDS} +${CATALOG_SERVICE_ID} + +*** Keywords *** + +Model Distribution For Directory + [Arguments] ${service} + ${directory_list}= Get From Dictionary ${GLOBAL_SERVICE_FOLDER_MAPPING} ${service} + ${ziplist}= Create List + :for ${directory} in @{directory_list} + \ ${zip}= Catenate ${ASDC_ZIP_DIRECTORY}/${directory}.zip + \ ${folder}= Catenate ${ASDC_ASSETS_DIRECTORY}/${directory} + \ OperatingSystem.Create Directory ${ASDC_ASSETS_DIRECTORY}/temp + \ Create Zip From Files In Directory ${folder} ${zip} + \ Append To List ${ziplist} ${zip} + ${catalog_service_name} ${catalog_resource_name} ${vf_modules} ${catalog_resource_ids} ${catalog_service_id} Distribute Model From ASDC ${ziplist} + Set Test Variable ${CATALOG_RESOURCE_IDS} ${catalog_resource_ids} + Set Test Variable ${CATALOG_SERVICE_ID} ${catalog_service_id} + [Return] ${catalog_service_name} ${catalog_resource_name} ${vf_modules} + + + + +Teardown Model Distribution + [Documentation] Clean up at the end of the test + Log ${CATALOG_SERVICE_ID} ${CATALOG_RESOURCE_IDS} + Teardown Models ${CATALOG_SERVICE_ID} ${CATALOG_RESOURCE_IDS} + +Teardown Models + [Documentation] Clean up at the end of the test + [Arguments] ${catalog_service_id} ${catalog_resource_ids} + Return From Keyword If '${catalog_service_id}' == '' + :for ${catalog_resource_id} in @{catalog_resource_ids} + \ ${resourece_json}= Mark ASDC Catalog Resource Inactive ${catalog_resource_id} + ${service_json}= Mark ASDC Catalog Service Inactive ${catalog_service_id} + ${services_json}= Delete Inactive ASDC Catalog Services + ${resources_json}= Delete Inactive ASDC Catalog Resources +
\ No newline at end of file diff --git a/robot/resources/test_templates/vnf_orchestration_test_template.robot b/robot/resources/test_templates/vnf_orchestration_test_template.robot new file mode 100644 index 00000000..00f15cf8 --- /dev/null +++ b/robot/resources/test_templates/vnf_orchestration_test_template.robot @@ -0,0 +1,183 @@ +*** Settings *** +Documentation This test template encapsulates the VNF Orchestration use case. + +Resource ../vid/create_service_instance.robot +Resource ../vid/vid_interface.robot +Resource ../aai/service_instance.robot +Resource ../vid/create_vid_vnf.robot +Resource ../sdngc_interface.robot +Resource model_test_template.robot + +Resource ../aai/create_customer.robot +Resource ../aai/create_tenant.robot +Resource ../aai/create_service.robot +Resource ../openstack/neutron_interface.robot +Resource ../heatbridge.robot + + +Library OpenstackLibrary +Library ExtendedSelenium2Library +Library UUID +Library Collections + + + +*** Variables *** + +${TENANT_NAME} +${TENANT_ID} +${REGIONS} +${CUSTOMER_NAME} +${STACK_NAME} +${SERVICE} +${VVG_SERVER_ID} + +*** Keywords *** + +Orchestrate VNF + [Arguments] ${customer_name} ${service} ${product_family} ${lcp_region} ${tenant} + ${uuid}= Generate UUID + Set Test Variable ${CUSTOMER_NAME} ${customer_name}_${uuid} + Set Test Variable ${SERVICE} ${service} + ${vnf_name}= Catenate Vnf_Ete_Name${uuid} + ${service_name}= Catenate Service_Ete_Name${uuid} + ${service_type}= Set Variable ${service} + ${vf_module_name}= Catenate Vfmodule_Ete_Name${uuid} + ${service_model_type} ${vnf_type} ${vf_modules} = Model Distribution For Directory ${service} + ## MSO polling is 60 second intervals + Sleep 70s + Run Keyword If '${service}' == 'vVG' Create VVG Server ${uuid} + Create Customer For VNF ${CUSTOMER_NAME} ${CUSTOMER_NAME} INFRA ${service_type} ${GLOBAL_AAI_CLOUD_OWNER} ${GLOBAL_OPENSTACK_SERVICE_REGION} + Setup Browser + Login To VID GUI + ${service_instance_id}= Create VID Service Instance ${customer_name} ${service_model_type} ${service} ${service_name} + Validate Service Instance ${service_instance_id} ${service} ${customer_name} + Create VID VNF ${service_instance_id} ${vnf_name} ${product_family} ${lcp_region} ${tenant} ${vnf_type} + ${vf_module_type} ${closedloop_vf_module}= Preload Vnf ${service_instance_id} ${vnf_name} ${vnf_type} ${vf_module_name} ${vf_modules} ${service} ${uuid} + ${vf_module_id}= Create VID VNF module ${service_instance_id} ${vf_module_name} ${lcp_region} ${tenant} ${vf_module_type} + ${generic_vnf}= Validate Generic VNF ${vnf_name} ${vnf_type} ${service_instance_id} + VLB Closed Loop Hack ${service} ${generic_vnf} ${closedloop_vf_module} + Set Test Variable ${STACK_NAME} ${vf_module_name} + Execute Heatbridge ${vf_module_name} ${service_instance_id} ${service} + Validate VF Module ${vf_module_name} ${service} + [Return] ${vf_module_name} ${service} + [Teardown] Close All Browsers + + +Create Customer For VNF + [Documentation] VNF Orchestration Test setup.... + ... Create Tenant if not exists, Create Customer, Create Service and related relationships + [Arguments] ${customer_name} ${customer_id} ${customer_type} ${service_type} ${cloud_owner} ${cloud_region_id} + ${resp}= Create Customer ${customer_name} ${customer_id} ${customer_type} ${service_type} ${cloud_owner} ${cloud_region_id} ${TENANT_ID} + Should Be Equal As Strings ${resp} 201 + Create Service If Not Exists ${service_type} + +Setup Orchestrate VNF + [Documentation] Called before each test case to ensure data required by the Orchstrate VNF exists + [Arguments] ${cloud_owner} ${cloud_region_id} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} + Initialize Tenant From Openstack + Initialize Regions From Openstack + :FOR ${region} IN @{REGIONS} + \ Inventory Tenant If Not Exists ${cloud_owner} ${region} ${cloud_type} ${owner_defined_type} ${cloud_region_version} ${cloud_zone} ${TENANT_NAME} ${TENANT_ID} + Log Orchestrate VNF setup complete + +Initialize Tenant From Openstack + Run Openstack Auth Request auth + ${tenants}= Get Current Openstack Tenant auth + ${tenant_name}= Evaluate $tenants.get("name") + ${tenant_id}= Evaluate $tenants.get("id") + Set Suite Variable ${TENANT_NAME} ${tenant_name} + Set Suite Variable ${TENANT_ID} ${tenant_id} + +Initialize Regions From Openstack + Run Openstack Auth Request auth + ${regs}= Get Openstack Regions auth + Set Suite Variable ${REGIONS} ${regs} + +Create VVG Server + [Arguments] ${uuid} + Run Openstack Auth Request auth + ${vvg_server_name}= Catenate vVG_${uuid} + ${server}= Add Server For Image Name auth ${vvg_server_name} ${GLOBAL_VVGSERVER_IMAGE} ${GLOBAL_VVGSERVER_FLAVOR} + ${server}= Get From Dictionary ${server} server + ${server_id}= Get From Dictionary ${server} id + Set Test Variable ${VVG_SERVER_ID} ${server_id} + ${vvg_params}= Get VVG Preload Parameters + Set To Dictionary ${vvg_params} nova_instance ${server_id} + Wait for Server to Be Active auth ${server_id} + +Get VVG Preload Parameters + ${test_dict}= Get From Dictionary ${GLOBAL_PRELOAD_PARAMETERS} Vnf-Orchestration + ${vvg_params} Get From Dictionary ${test_dict} vvg_preload.template + [Return] ${vvg_params} + +Teardown VNF + [Documentation] Called at the end of a test case to tear down the VNF created by Orchestrate VNF + Teardown VVG Server + # Free up rackspace resources until true teardown is implemented + Run Keyword If '${TEST STATUS}' == 'PASS' Teardown Stack ${STACK_NAME} + Set Test Variable ${VVG_SERVER_ID} '' + + ## Conditional remove so as to enable manual teardown testing of failed stacks + Run Keyword If '${TEST STATUS}' == 'PASS' Teardown Model Distribution + Log Teardown VNF not completely implemented + +Teardown VVG Server + Return From Keyword if '${VVG_SERVER_ID}' == '' + Delete Server auth ${VVG_SERVER_ID} + Wait for Server To Be Deleted auth ${VVG_SERVER_ID} + ${vvg_params}= Get VVG Preload Parameters + Remove from Dictionary ${vvg_params} nova_instance + Log Teardown VVG Server Completed + +Teardown Stack + [Documentation] Called at the end of a test case to tear down the Stack created by Orchestrate VNF + [Arguments] ${stack} + Run Openstack Auth Request auth + ${stack_info}= Get Stack Details auth ${stack} + Log ${stack_info} + ${stack_id}= Get From Dictionary ${stack_info} id + ${key_pair_status} ${keypair_name}= Run Keyword And Ignore Error Get From Dictionary ${stack_info} key_name + Delete Openstack Stack auth ${stack} ${stack_id} + Log Deleted ${stack} ${stack_id} + Run Keyword If '${key_pair_status}' == 'PASS' Delete Openstack Keypair auth ${keypair_name} + ## Removed code to remove all of the IPs from the oam network - didn't help + + +Get Ecomp Private Net Ports + [Arguments] ${alias} ${stack_info} ${service} + ${list}= Create List + ${netid}= Get From Dictionary ${stack_info} ecomp_private_net_id + ${cidr}= Get From Dictionary ${stack_info} ecomp_private_net_cidr + ${ip_addresses}= Get Ecomp Ip Addresses ${stack_info} ${service} + ${net_ports}= Get Openstack Ports For Subnet ${alias} ${netid} ${cidr} + :for ${ip_address} in @{ip_addresses} + \ ${port}= Find Ecomp Port ${net_ports} ${ip_address} + \ Run Keyword If ${port} is not None Append To List ${list} ${port} + [Return] ${list} + +Get Ecomp Ip Addresses + [Arguments] ${stack_info} ${service} + ${ip_addresses}= Create List + ${names}= Get From Dictionary ${GLOBAL_SERVICE_ECOMP_IP_MAPPING} ${service} + :for ${name} in @{names} + \ ${ip}= Get From Dictionary ${stack_info} ${name} + \ Append To List ${ip_addresses} ${ip} + [Return] ${ip_addresses} + +Find Ecomp Port + [Arguments] ${ports} ${ip_address} + :for ${port} in @{ports} + \ Return From Keyword If '${port['fixed_ips'][0]['ip_address']}' == '${ip_address}' ${port} + [Return] None + + +Clean A&AI Inventory + [Documentation] Clean up Tenant in A&AI, Create Customer, Create Service and related relationships + [Arguments] ${customer_id} ${cloud_owner} ${service_type} + :FOR ${region} IN @{REGIONS} + \ Delete Tenant ${TENANT_ID} ${cloud_owner} ${region} + \ Delete Cloud Region ${TENANT_ID} ${cloud_owner} ${region} + Delete Customer ${customer_id} + Delete Service If Exists ${service_type} + |