Library contains functions that handle SDAF naming conventions used in various strings. Mostly used for generating resource names, file names or file paths. Please try not to add here complex functions that do much beyond returning a string.
SDAF uses own internal 4 character abbreviations for Public Cloud region names.
This is an internal matrix used for translation. It contains only commonly used regions, if you need to extend the list you can find definitions in the function get_region_code located in sdaf shell script at: https://github.com/Azure/sap-automation/blob/3c5d0d882f5892ae2159e262062e29c2b3fe59d9/deploy/scripts/deploy_utils.sh#L403
convert_region_to_long($sdaf_region_code);
Performs region name conversion from 4 letter SDAF abbreviation to full region name. You can find definitions in the function get_region_code located in sdaf shell script:
$sdaf_region_code: Region name abbreviation containing 4 uppercase alphanumeric characters
convert_region_to_short($region);
Performs region name conversion from full region name to 4 letter SDAF abbreviation. You can find definitions in the function get_region_code located in sdaf shell script:
$region: Full region name. Can contain only lowercase alphanumeric characters.
homedir();
Returns home directory path for current user from env variable $HOME.
deployment_dir([create=>1]);
Returns deployment directory path with job ID appended as unique identifier. Optionally it can create directory if it does not exists.
create: Create directory if it does not exist.
log_dir([create=>1]);
Returns logging directory path with job ID appended as unique identifier. Optionally creates the directory.
create: Create directory if it does not exist.
sdaf_scripts_dir();
Returns directory containing SDAF scripts.
env_variable_file();
Returns full path to a file containing all required SDAF OS env variables. Sourcing this file is essential for running SDAF.
get_sdaf_config_path(
deployment_type=>$deployment_type,
env_code=>$env_code,
sdaf_region_code=>$sdaf_region_code,
[vnet_code=>$vnet_code,
sap_sid=>$sap_sid,
job_id=>$job_id]);
Returns path to config root directory for deployment type specified. Root config directory is deployment type specific and usually contains tfvar file, inventory file, SUT ssh keys, etc...
deployment_type: Type of the deployment (workload_zone, sap_system, library... etc)
env_code: SDAF parameter for environment code (for our purpose we can use 'LAB')
sdaf_region_code: SDAF parameter to choose PC region. Note SDAF is using internal abbreviations (SECE = swedencentral)
vnet_code: SDAF parameter for virtual network code. Library and deployer use different vnet than SUT env
sap_sid: SDAF parameter for sap system ID
job_id: Specify job id instead of using current one. Default: current job id
get_tfvars_path(
deployment_type=>$deployment_type,
env_code=>$env_code,
sdaf_region_code=>$sdaf_region_code,
[vnet_code=>$vnet_code,
sap_sid=>$sap_sid]);
Returns full tfvars filepath respective to deployment type.
deployment_type: Type of the deployment (workload_zone, sap_system, library... etc)
env_code: SDAF parameter for environment code (for our purpose we can use 'LAB')
sdaf_region_code: SDAF parameter to choose PC region. Note SDAF is using internal abbreviations (SECE = swedencentral)
vnet_code: SDAF parameter for virtual network code. Library and deployer use different vnet than SUT env
sap_sid: SDAF parameter for sap system ID. Required only for 'sap_system' deployment type
generate_resource_group_name(deployment_type=>$deployment_type);
Returns name of the resource group for the deployment type specified by $deployment_type . Resource group pattern: SDAF-OpenQA-[deployment type]-[deployment id]-[OpenQA job id]
$deployment_type: Type of the deployment (workload_zone, sap_system, library... etc)
generate_deployer_name([job_id=>$job_id]);
Generates resource name for deployer VM in format test_id-OpenQA_Deployer_VM.
$job_id: Specify job id to be used. Default: current job ID
get_workload_vnet_code([job_id=>$job_id]);
Returns VNET code used for workload zone and sap systems resources. VNET code must be unique for each landscape, therefore it contains test ID as an identifier.
$job_id: Specify job id to be used. Default: current job ID
get_sdaf_inventory_path();
Returns full Ansible inventory filepath respective to deployment type.
env_code: SDAF parameter for environment code (for our purpose we can use 'LAB')
sdaf_region_code: SDAF parameter to choose PC region. Note SDAF is using internal abbreviations (SECE = swedencentral)
vnet_code: SDAF parameter for virtual network code. Library and deployer use different vnet than SUT env
sap_sid: SDAF parameter for sap system ID.