lib/sles4sap.pm

SYNOPSIS

Package with common methods and default values for tests on SLES for SAP Applications.

This package inherits from opensusebasetest and should be used as a class.

ensure_serialdev_permissions_for_sap

Derived from 'ensure_serialdev_permissions' function available in 'utils'.

Grant user permission to access serial port immediately as well as persisting over reboots. Used to ensure that testapi calls like script_run work for the test user as well as root.

fix_path

 $self->fix_path( $uri );

Given the path to a CIFS or NFS share in $uri, this method will format the path so it can be used directly by mount(8). Returns an array with the protocol name (cifs or nfs) as the first element, and the formatted path as the second element. Croaks if an unsupported protocol is passed in $uri or if it cannot be parsed.

set_ps_cmd

 $self->set_ps_cmd( $procname );

Sets in the class instance the ps command to be used to check for the presence of SAP processes in the SUT. Returns the value of the internal variable $ps_cmd.

set_sap_info

 $self->set_sap_info( $SID, $instance_number );

SAP software relies on 2 identifiers, the system id (SID) which is a 3-character identifier, and the instance number. This method receives both via positional arguments, and sets the internal variables for $sid, $instance and $sapadmin accordingly. Returns the value of $sapadmin.

user_change

 $self->user_change();

Switch user in SUT to the SAP admin account, and grant serialdev permissions to the SAP admin user.

reset_user_change

 $self->reset_user_change();

Exit from the SAP admin account in SUT and change serialdev permissions accordingly.

get_total_mem

 $self->get_total_mem();

Returns the total memory configured in SUT.

is_saptune_installed

 is_saptune_installed();

Checks if the saptune package is installed in SUT. Returns true or false.

prepare_profile

 $self->prepare_profile( $profile );

Configures with saptune (if available in SUT) or sapconf the SUT according to a profile passed as argument. $profile must be either HANA or NETWEAVER. Croaks on failure.

copy_media

 $self->copy_media( $proto, $path, $timeout, $target );

Copies installation media in SUT from the share identified by $proto and $path into the target directory $target. $timeout specifies how long to wait for the copy to complete.

After installation files are copied, this method will also verify the existence of a checksum.md5sum file in the target directory and use it to check for the integrity of the copied files. This test can be skipped by setting to a true value the DISABLE_CHECKSUM setting in the test.

The method will croak if any of the commands sent to SUT fail.

add_hostname_to_hosts

 $self->add_hostname_to_hosts();

Adds the IP address and the hostname of SUT to /etc/hosts. Croaks on failure.

test_pids_max

 $self->test_pids_max();

Checks in SUT that the SAP admin user has no limits in the number of processes and threads that it can create.

test_forkbomb

 $self->test_forkbomb();

Runs a script in SUT to create as many processes as possible, both as the SAP administrator and as root, and verifies that the SAP admin can create as many as 99% of the amount of processes that root can. Croaks if any of the commands sent to SUT fail, and record a soft failure if the SAP admin user cannot create as many processes as root.

test_version_info

 $self->test_version_info();

Runs a sapcontrol command with function GetVersionInfo in SUT. Croaks on failure.

test_instance_properties

 $self->test_instance_properties();

Runs a sapcontrol command with function GetInstanceProperties and verifies that the reported properties match with the SID stored in the class instance. Croaks on failure.

test_stop

 $self->test_stop();

Tests with sapcontrol and functions Stop and StopService that the instance and services are succesfully stopped. Croaks on failure.

test_start

 $self->test_start();

Tests with sapcontrol and functions Start and StartService that the instance and services are succesfully started. Croaks on failure.

check_service_state

 $self->check_service_state( $state );

Checks in the process table of SUT for sapstartsrv up to the number of seconds specified in the WAIT_INSTANCE_STOP_TIME setting (defaults to 300, with a maximum permitted value of 600). The $state argument can be either start or stop, and it controls whether this method waits for the process to appear in the process table after service was started, or disappear from the process table after service was stopped. Croaks on failure.

check_instance_state

 $self->check_instance_state( $state );

Uses sapcontrol functions GetSystemInstanceList and GetProcessList to check for up to the number of seconds defined in the WAIT_INSTANCE_STOP_TIME setting (defaults to 300, with a maximum permitted value of 600), whether the instance is in the state specified by the $state argument. This argument can be either green or gray, and it controls whether this method waits for the instance to turn to green status after a start or to turn to gray status after a stop. Croaks on failure.

check_replication_state

 $self->check_replication_state();

Check status of the HANA System Replication by running the systemReplicationStatus.py script in SUT. Waits for 5 minutes for HANA System Replication to be in Active state or croaks on timeout.

Note: can only be run on active node in the cluster.

systemReplicationStatus.py return codes are: 10: No System Replication 11: Error 12: Unknown 13: Initializing 14: Syncing 15: Active

reboot

 $self->reboot();

Restart the SUT and reconnect to the console right after.

do_hana_takeover

 $self->do_hana_takeover( node => $node [, manual_takeover => $manual_takeover] [, cluster => $cluster] );

Do a takeover/takeback on a HANA cluster.

Set $node to the node where HANA is/should be the primary server.

Set $manual_takeover to true, so the method performs a manual rather than an automatic takeover. Defaults to false.

Set $cluster to true so the method runs also a crm resource cleanup. Defaults to false.

install_libopenssl_legacy

 $self->install_libopenssl_legacy( $hana_path );

Install libopenssl1_0_0 for older (<SPS03) HANA versions on SLE15+

Set $hana_path to the path where the HANA installation media is located; this path should contain information on the HANA version to install, so prepare it thinking on this. For example: nfs://sap.sources.host.local/HANA2-SPS5rev52/. This method will then determine the HANA version from $hana_path and decide based on the SLES and HANA versions whether libopenssl1_0_0 must be installed.

upload_hana_install_log

 $self->upload_hana_install_log();

Package and upload HANA installation logs from SUT.

upload_nw_install_log

 $self->upload_nw_install_log();

Upload NetWeaver installation logs from SUT.