lib/saputils.pm

SYNOPSIS

Package with utility functionality for tests on SLES for SAP Applications.

This package is a stateless library. To keep this library as generic as possible avoid as much as possible any other dependency usage, like other baseclass or testapi. Avoid using get_var/set_var at this level.

calculate_hana_topology calculate_hana_topology(input => $saphanasr_showAttr_format_script_output);

Expect `SAPHanaSR-showAttr --format=script` as input.
Parses this input, returns a hash of hashes containing values for each host.

Output like:
        Hosts/vmhana01/remoteHost="vmhana02"
        Hosts/vmhana01/sync_state="PRIM"
        Hosts/vmhana01/vhost="vmhana01"
        Hosts/vmhana02/remoteHost="vmhana01"
        Hosts/vmhana02/sync_state="SOK"
        Hosts/vmhana02/vhost="vmhana02"
result in
{
    vmhana01 => {
        remoteHost => 'vmhana02',
        sync_state => 'PRIM',
        vhost => 'vmhana01',
    },
    vmhana02 => {
        remoteHost => 'vmhana01',
        sync_state => 'SOK',
        vhost => 'vmhana02',
    },
}
input - stdout of 'SAPHanaSR-showAttr --format=script'

check_hana_topology check_hana_topology(input => calculate_hana_topology($saphanasr_showAttr_format_script_output) [, online_str => '12345678']]);

Expect the output of saputils::calculate_hana_topology as input.
Uses calculate_hana_topology to get a hash of hashes, and then
checks the output to make sure that the cluster is working and ready.

The checks performed are:
- All node_states are online
- All sync_states are either SOK or PRIM
input - return value of calculate_hana_topology
node_state_match - string used to match the online state in field node_state. Default 'online'

check_crm_output check_crm_output(input => $crm_mon_output);

input: the output of the command 'crm_mon -r -R -n -N -1'
output: whether the conditions are met (return 1) or not (return 0)

Conditions:
- No resources are in 'Starting' state
- No 'Failed Resource Actions' present
input - stdout of 'crm_mon -R -r -n -N -1'