lib/sles4sap/ibsm.pm

NAME

IBS Mirror utilities lib

COPYRIGHT

Copyright 2025 SUSE LLC
SPDX-License-Identifier: FSFAP

AUTHORS

QE SAP <qe-sap@suse.de>

DESCRIPTION

Package with common methods allowing the SUT to interact with IBSm

Methods

ibsm_calculate_address_range

Calculate a main range that can be used in Azure for vnet or in AWS for vpc. Also calculate a secondary range within the main one for Azure subnet address ranges. The format is 10.ip2.ip3.0/21 and /24 respectively. ip2 and ip3 are calculated using the slot number as seed.

slot - integer to be used as seed in calculating addresses

ibsm_network_peering_azure_create

ibsm_network_peering_azure_create(
    ibsm_rg => 'IBSmRg',
    sut_rg => 'SUTRg',
    name_prefix => 'something');

Create two peering in Azure. Given two resource group names, this function first calculate two peering names. The caller can provide a prefix but name also contain the vnet names from the two resource groups.

ibsm_rg - Azure resource group of the IBSm
sut_rg - Azure resource group of the SUT
name_prefix - prefix to be applied at the beginning of each peering name

ibsm_network_peering_azure_delete

ibsm_network_peering_azure_delete(
    ibsm_rg => 'IBSmRg',
    sut_rg => 'SUTRg',
    name_prefix => 'something');

Delete the two network peerings between the two provided deployments. This function is symmetrical to ibsm_network_peering_azure_create.

ibsm_rg - Azure resource group of the IBSm
sut_rg - Azure resource group of the SUT
sut_vnet - substring in the SUT vnet. Optional and only needed if only one specific VNET has to be considered. Most of the time it is get_current_job_id()
timeout - default is 5 mins
name_prefix - allow the user to prepend name prefix to the peering name to be deleted

ibsm_network_peering_gcp_create

ibsm_network_peering_gcp_create(
    ibsm_ncc_hub => 'projects/ibsm-project/locations/global/hubs/ibsm-hub',
    sut_network  => 'my-network',
    sut_project  => 'my-project',
    spoke_name   => 'my-spoke');

Create a GCP NCC VPC spoke in the SUT project connecting to the IBSm NCC hub. Die if some commands return with error or if the spoke does not turn in ACTIVE state within timeout.

ibsm_ncc_hub - full resource URI of the IBSm NCC hub
sut_network - name of the SUT VPC network to attach
sut_project - GCP project ID of the SUT
spoke_name - name for the new spoke
spoke_group - name of the hub group to join (e.g., 'default')
timeout - optional, timeout waiting for ACTIVE state (default 300)

ibsm_network_peering_gcp_delete

ibsm_network_peering_gcp_delete(spoke_name => 'my-spoke' [, timeout => 600]);

Delete the GCP NCC spoke connecting the SUT to the IBSm hub.

spoke_name - name of the spoke to delete
timeout - optional, timeout for the delete operation (default 600)

ibsm_network_peering_aws_create

ibsm_network_peering_aws_create(
    region       => 'us-west-1',
    job_id       => 'job-123',
    ibsm_ip_range => '10.0.0.0/8',
    ibsm_prj_tag => 'tag');

Create a network peering on AWS using Transit Gateway.

region - AWS region where the resources are located
job_id - OpenQA job identifier used to identify VPC and tag attachment
ibsm_ip_range - CIDR block of the IBS Mirror to be routed
ibsm_prj_tag - Value of the 'Project' tag to identify the Transit Gateway

ibsm_network_peering_aws_delete

ibsm_network_peering_aws_delete(region => 'us-west-1', job_id => 'job-123');

Delete AWS TGW attachment for the SUT.