lib/sles4sap/qesap/qesap_aws.pm

NAME

AWS related functions for the qe-sap-deployment test lib

COPYRIGHT

Copyright 2025 SUSE LLC
SPDX-License-Identifier: FSFAP

AUTHORS

QE SAP <qe-sap@suse.de>

DESCRIPTION

Package with AWS related methods for qe-sap-deployment

Methods

qesap_aws_get_region_subnets

Return a list of subnets. Return a single subnet for each region.

VPC_ID - VPC ID of resource to filter list of subnets

qesap_aws_create_credentials

Creates a AWS credentials file as required by QE-SAP Terraform deployment code.
KEY - value for the aws_access_key_id
SECRET - value for the aws_secret_access_key
CONF_TRGT - qesap_conf_trgt value in the output of qesap_get_file_paths

qesap_aws_create_config

Creates a AWS configuration file in ~/.aws/config
as required by the QE-SAP Terraform & Ansible deployment code.
Content is mostly (only) about region.
REGION - cloud region as usually provided by PUBLIC_CLOUD_REGION

qesap_aws_get_vpc_id

Get the vpc_id of a given instance in the cluster.
This function looks for the cluster using the aws describe-instances
and filtering by terraform deployment_name value, that qe-sap-deployment
is kind to use as tag for each resource.
RESOURCE_GROUP - value of the workspace tag configured in qe-sap-deployment, usually it is the deployment name

qesap_aws_get_transit_gateway_vpc_attachment Ged a description of one or more transit-gateway-attachments Function support optional arguments that are translated to filters: - transit_gateway_attach_id - name

Example:
  qesap_aws_get_transit_gateway_vpc_attachment(name => 'SOMETHING')

  Result internally in aws cli to be called like

  aws ec2 describe-transit-gateway-attachments --filter='Name=tag:Name,Values=SOMETHING

Only one filter mode is supported at any time.

Returns a HASH reference to the decoded JSON returned by the AWS command or undef on failure.

qesap_aws_create_transit_gateway_vpc_attachment

Call create-transit-gateway-vpc-attachment and
wait until Transit Gateway Attachment is available.

Return 1 (true) if properly managed to create the transit-gateway-vpc-attachment
Return 0 (false) if create-transit-gateway-vpc-attachment fails or
              the gateway does not become active before the timeout
TRANSIT_GATEWAY_ID - ID of the target Transit gateway (IBS Mirror)
VPC_ID - VPC ID of resource to be attached (SUT HANA cluster)
SUBNET_ID_LIST - List of subnet to connect (SUT HANA cluster)
NAME - Prefix for the Tag Name of transit-gateway-vpc-attachment
TIMEOUT - default is 5 mins

qesap_aws_delete_transit_gateway_vpc_attachment

Call delete-transit-gateway-vpc-attachment and
wait until Transit Gateway Attachment is deleted.

Return 1 (true) if properly managed to delete the transit-gateway-vpc-attachment
Return 0 (false) if delete-transit-gateway-vpc-attachment fails or
     the gateway does not become inactive before the timeout
NAME - Prefix for the Tag Name of transit-gateway-vpc-attachment
TIMEOUT - default is 5 mins

qesap_aws_add_route_to_tgw Adding the route to the transit gateway to the routing table in refhost VPC

RTABLE_ID - Routing table ID
TARGET_IP_NET - Target IP network to be added to the Routing table eg. 192.168.11.0/16
TRANSIT_GATEWAY_ID - ID of the target Transit gateway (IBS Mirror)

qesap_aws_filter_query

Generic function to compose a aws cli command with:
  - `aws ec2` something
  - use both `filter` and `query`
  - has text output

qesap_aws_get_mirror_tg

Return the Transient Gateway ID of the IBS Mirror
MIRROR_TAG - Value of Project tag applied to the IBS Mirror

qesap_aws_get_vpc_workspace

Get the VPC tag workspace defined in
https://github.com/SUSE/qe-sap-deployment/blob/main/terraform/aws/infrastructure.tf
VPC_ID - VPC ID of resource to be attached (SUT HANA cluster)

qesap_aws_get_routing

Get the Routing table: searching Routing Table with external connection
and get the RouteTableId
VPC_ID - VPC ID of resource to be attached (SUT HANA cluster)

qesap_aws_vnet_peering

Create a pair of network peering between
the two provided deployments.

Return 1 (true) if the overall peering procedure completes successfully
TARGET_IP - Target IP network to be added to the Routing table eg. 192.168.11.0/16
VPC_ID - VPC ID of resource to be attached (SUT HANA cluster)
MIRROR_TAG - Value of Project tag applied to the IBS Mirror