Skip to content

Commit d4d727c

Browse files
Add SAP Configuration Checks to STAF (#129)
1 parent b9b61ad commit d4d727c

37 files changed

+9957
-312
lines changed

.ansible-lint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ exclude_paths:
44
- .github
55
- src/roles/ha_db_hana/tasks/files/
66
- src/roles/ha_scs/tasks/files/
7+
- src/roles/configuration_checks/tasks/files/
78

89
skip_list:
910
- no-handler

docs/CONFIGURATION_CHECKS.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# SAP Configuration Checks
2+
3+
## Overview
4+
5+
SAP Configuration Checks is an integral part of the SAP Testing Automation framework, providing comprehensive validation of SAP system configurations on Azure infrastructure. This module ensures that SAP Database and SAP Central Services deployments meet enterprise requirements for compliance before entering production. This tool is designed to identify misconfigurations, deviations from best practices, and potential issues that could impact system's stability and performance.
6+
7+
This tool is a new version of the existing [Quality Checks scripts](https://github.com/Azure/SAP-on-Azure-Scripts-and-Utilities/tree/main/QualityCheck), re-architected to provide a extensible, and maintainable solution. It leverages Python for core logic and Ansible for orchestration.
8+
9+
## Purpose
10+
11+
Configuration validation serves as a critical quality gate in the SAP deployment lifecycle by:
12+
13+
- **Validating Azure Infrastructure**: Ensuring compute, storage, and network configurations align with SAP best practices
14+
- **Verifying SAP Parameters**: Checking critical SAP HANA and application server settings
15+
- **Assessing Cluster Health**: Validating Pacemaker configurations and resource constraints
16+
- **Ensuring Compliance**: Confirming adherence to organizational and SAP security standards
17+
18+
## Configuration Check Categories
19+
20+
**Azure Compute**
21+
- VM SKU appropriateness for SAP workloads
22+
- Accelerated Networking enablement
23+
- Availability Set/Zone configuration
24+
- Proximity Placement Group setup
25+
26+
**Storage Configuration**
27+
- Premium SSD/Ultra Disk usage for critical paths
28+
- Write Accelerator for log volumes
29+
- Storage account redundancy settings
30+
- Disk caching policies
31+
32+
**SAP HANA Configuration**
33+
- Memory allocation
34+
- System replication parameters
35+
36+
**Pacemaker Cluster**
37+
- Resource agent versions and parameters
38+
- Fencing (STONITH) configuration
39+
- Resource constraints and colocation rules
40+
- Cluster communication settings
41+
42+
**SAP HA Resources**
43+
- Virtual hostname configuration
44+
- File system mount options
45+
- Service startup ordering
46+
- Failover timeout values
47+
48+
49+
### 1. Setup Configuration
50+
51+
Follow the steps (1.1 - 1.5) in [Setup Guide for SAP Testing Automation Framework](./SETUP.MD) to set up the framework on a management server.
52+
53+
### 2. System Configuration
54+
55+
Update the `TEST_TYPE` parameter in [`vars.yaml`](./../vars.yaml) file to `ConfigurationChecks` to enable the Configuration Checks test scenarios.
56+
57+
Follow the steps (2.1 - 2.2) in [Setup Guide for SAP Testing Automation Framework](./SETUP.MD#2-system-configuration) to configure your system details.
58+
59+
60+
### 3. Test Execution
61+
62+
To execute the script, run following command:
63+
64+
```bash
65+
# Help option
66+
./scripts/sap_automation_qa.sh --help
67+
68+
# Run all the configuration checks with default parameters
69+
./scripts/sap_automation_qa.sh
70+
71+
# Run checks with verbose logging
72+
./scripts/sap_automation_qa.sh -vv
73+
74+
# Run only Database (HANA) configuration checks
75+
./scripts/sap_automation_qa.sh --extra-vars='{"configuration_test_type":"Database"}'
76+
77+
# Run only ASCS/ERS configuration checks
78+
./scripts/sap_automation_qa.sh --extra-vars='{"configuration_test_type":"CentralServiceInstances"}'
79+
80+
# Run only Application Server configuration checks
81+
./scripts/sap_automation_qa.sh --extra-vars='{"configuration_test_type":"ApplicationInstances"}'
82+
```
83+
84+
### 4. Viewing Test Results
85+
86+
After the test execution completes, a detailed HTML report is generated that summarizes the PASS/FAIL status of each test case and includes detailed execution logs for every step of the automation run.
87+
88+
**To locate and view your test report:**
89+
90+
1. **Navigate to your SAP system’s workspace directory:**
91+
92+
Replace `<SYSTEM_CONFIG_NAME>` with the name of your SAP system configuration (for example, `DEV-WEEU-SAP01-X00`):
93+
94+
```bash
95+
cd WORKSPACES/SYSTEM/<SYSTEM_CONFIG_NAME>/quality_assurance/
96+
```
97+
2. **Find your report file:**
98+
99+
The report file is named using the following format:
100+
101+
```
102+
HA_{SAP_TIER}_{DATABASE_TYPE}_{OS_DISTRO_NAME}_{INVOCATION_ID}.html
103+
```
104+
105+
- `SAP_TIER`: The SAP tier tested (e.g., DB, SCS)
106+
- `DATABASE_TYPE`: The database type (e.g., HANA)
107+
- `OS_DISTRO_NAME`: The operating system distribution (e.g., SLES15SP4)
108+
- `INVOCATION_ID`: A unique identifier (Group invocation ID) for the test run which is logged at the end of test execution. Find example screenshot below:
109+
110+
![Test Execution Completion Screenshot](./images/execution_screenshot.png)
111+
112+
3. **View the report**
113+
114+
You can open the HTML report in any web browser to review the results and logs.

docs/HIGH_AVAILABILITY.md

Lines changed: 4 additions & 234 deletions
Original file line numberDiff line numberDiff line change
@@ -40,194 +40,13 @@ pcs cluster enable --all # for RedHat virtual machine
4040

4141
### 1. Setup Configuration
4242

43-
Follow the steps in [Setup Guide for SAP Testing Automation Framework](./SETUP.MD) to set up the framework on a management server.
43+
Follow the steps (1.1 - 1.5) in [Setup Guide for SAP Testing Automation Framework](./SETUP.MD) to set up the framework on a management server.
4444

45-
### 2. Configuration
45+
### 2. System Configuration
4646

47-
#### 2.1. Test Environment Configuration
47+
Update the `TEST_TYPE` parameter in [`vars.yaml`](./../vars.yaml) file to `SAPFunctionalTests` to enable the High Availability test scenarios.
4848

49-
2.1.1. Navigate to the root directory
50-
51-
```bash
52-
cd sap-automation-qa
53-
```
54-
55-
2.1.2. Update `vars.yaml` with your test parameters. This file contains the variables used in the test cases:
56-
57-
```yaml
58-
# The type of test to be executed. Supported values are:
59-
# - SAPFunctionalTests
60-
TEST_TYPE: "SAPFunctionalTests"
61-
62-
# The type of SAP functional test to be executed. Supported values are:
63-
# - DatabaseHighAvailability
64-
# - CentralServicesHighAvailability
65-
sap_functional_test_type: "DatabaseHighAvailability" # or "CentralServicesHighAvailability"
66-
67-
# The name of the SAP system configuration for which you want to execute the test cases.
68-
# It would be the name of the folder under 'WORKSPACE/SYSTEM/' where it could find hosts.yaml, sap-parameters.yaml files of the SAP system configuration
69-
SYSTEM_CONFIG_NAME: "DEV-WEEU-SAP01-X00"
70-
71-
# The type of authentication to be used for the telemetry data destination. Supported values are: VMPASSWORD and SSHKEY
72-
AUTHENTICATION_TYPE:
73-
74-
# The destination of the telemetry data. Supported values are:
75-
# - azureloganalytics
76-
# - azuredataexplorer (only recommended for long-term storage)
77-
telemetry_data_destination: "azureloganalytics"
78-
79-
# The name of the telemetry table in the telemetry data destination.
80-
telemetry_table_name: "your-telemetry-table-name"
81-
82-
# The workspace id, shared key of the Log Analytics workspace.
83-
laws_shared_key: "your-log-analytics-shared-key"
84-
laws_workspace_id: "your-log-analytics-workspace-id"
85-
86-
# The cluster name, data ingestion URI, and client ID of the Azure Data Explorer.
87-
adx_cluster_fqdn: "your-adx-cluster-fqdn"
88-
adx_database_name: "your-adx-database-name"
89-
ade_client_id: "your-adx-client-id"
90-
```
91-
92-
#### 2.2. System Configuration (WORKSPACES)
93-
94-
Create your system workspace. This directory contains the configuration files specific to your SAP system, necessary for connecting to the system and executing test scenarios. The `WORKSPACE/SYSTEM/` directory holds sub-directories, each representing a different [SAP system](./WORKSPACES/SYSTEM/DEV-WEEU-SAP01-X00).
95-
96-
```bash
97-
cd WORKSPACES/SYSTEM
98-
mkdir ENV-REGION-VNET-SID
99-
cd ENV-REGION-VNET-SID
100-
```
101-
102-
The system workspace should include the following files, containing all necessary details about the SAP system.
103-
104-
2.2.1. **hosts.yaml** - System [Inventory file](https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html) (required)
105-
106-
This file contains the connection details for the SAP system hosts and is used as an inventory file by the Ansible framework to connect to the SAP system. You can find the inventory file in the path [hosts.yaml](../WORKSPACES/SYSTEM/DEV-WEEU-SAP01-X00/hosts.yaml).
107-
108-
Here is an example of the hosts.yaml file format:
109-
110-
```yaml
111-
X00_DB:
112-
hosts:
113-
hostname0:
114-
ansible_host: "IP_ADDRESS0"
115-
ansible_user: "USERNAME"
116-
ansible_connection: "ssh"
117-
connection_type: "key"
118-
virtual_host: "VIRTUAL_HOSTNAME0"
119-
become_user: "USERNAME1" #Username with root privilege
120-
os_type: "linux"
121-
vm_name: "AZURE_VM_NAME0"
122-
hostname1:
123-
ansible_host: "IP_ADDRESS1"
124-
ansible_user: "USERNAME"
125-
ansible_connection: "ssh"
126-
connection_type: "key"
127-
virtual_host: "VIRTUAL_HOSTNAME1"
128-
become_user: "USERNAME1" #Username with root privilege
129-
os_type: "linux"
130-
vm_name: "AZURE_VM_NAME1"
131-
vars:
132-
node_tier: "hana" # or "ers", "scs"
133-
```
134-
135-
In the file:
136-
137-
- X00 represents the SAP SID (System ID) of the SAP system, followed by the host type (e.g., DB, ASCS, PAS). You must provide the SAP SID of the system, regardless of whether you are testing Database High Availability or Central Services High Availability.
138-
139-
The file includes the following details:
140-
141-
- **ansible_host**: The IP address of the host.
142-
- **ansible_user**: The user for connecting to the host.
143-
- **ansible_connection**: The connection type (usually "ssh").
144-
- **connection_type**: The connection type, used when connecting via SSH key (not needed for password-based connections).
145-
- **virtual_host**: The virtual host name of the SCS/DB host.
146-
- **become_user**: The user with root privileges. For example, user "azureadm" must be able to change to root without password.
147-
- **os_type**: The operating system type (e.g., Linux or Windows).
148-
- **vm_name**: The computer name of the Azure VM.
149-
- **node_tier**: The type of node tier. Supported values: hana, ers, scs.
150-
151-
2.2.2. **sap-parameters.yaml** - SAP Configuration (required)
152-
153-
This file contains the SAP system configuration parameters. The parameters are used by the test scenarios to validate the system's high availability configuration. You can find the inventory file in the path [sap-parameters.yaml](../WORKSPACES/SYSTEM/DEV-WEEU-SAP01-X00/sap-parameters.yaml).
154-
155-
Here is an example of the sap-parameters.yaml file format:
156-
157-
```yaml
158-
# The SAP and Database SID of the SAP system.
159-
sap_sid: "your-sap-sid"
160-
db_sid: "your-db-sid"
161-
162-
# Boolean indicating if the SCS and database is configured as highly available.
163-
scs_high_availability: true
164-
database_high_availability: true
165-
166-
# The high availability configuration of the SCS and DB instance. Supported values are:
167-
# - AFA (for Azure Fencing Agent)
168-
# - ISCSI (for SBD devices with ISCSI target servers)
169-
# - ASD (for SBD devices with Azure Shared Disks)
170-
scs_cluster_type: "AFA" # or "ISCSI" or "ASD"
171-
database_cluster_type: "AFA" # or "ISCSI" or "ASD"
172-
173-
# The instance number of the SCS, ERS and DB instance.
174-
scs_instance_number: "00"
175-
ers_instance_number: "01"
176-
db_instance_number: "00"
177-
178-
# The type of database. Supported values are:
179-
# - HANA
180-
platform: "HANA"
181-
182-
# The NFS provider used for shared storage. Supported values are:
183-
# - ANF (for Azure NetApp Files)
184-
# - AFS (for Azure File Share)
185-
NFS_provider: "ANF" # or "AFS"
186-
187-
# If you're using a user-assigned managed identity (as explained in "Azure RBAC" section above):
188-
# - Enter the client ID of that identity here
189-
# - You can find this ID in Azure Portal → Managed Identities → Your Identity → Properties → Client ID
190-
# If you're using system-assigned managed identity instead:
191-
# - Leave this blank or set to empty string ""
192-
user_assigned_identity_client_id: "000000-00000-00000-00000-000000"
193-
194-
# If you have the SSH key or VM password stored in an Azure Key Vault as a secret:
195-
# - Enter the Azure Key Vault Resource ID in the key_vault_id parameter and the Secret ID in the secret_id parameter.
196-
# - You can find the Resource ID of the Key Vault in Azure Portal → Key Vaults → Your Key Vault → JSON view → Copy the Resource ID
197-
# - You can find the Resource ID of the Secret in Your Key Vault → Secrets → Select Secret → Current Version → Copy the Secret Identifier
198-
# If you're creating SSHKEY or VMPASSWORD file locally:
199-
# - Remove the following two parameters
200-
key_vault_id: /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.KeyVault/vaults/<key-vault-name>
201-
secret_id: https://<key-vault-name>.vault.azure.net/secrets/<secret-name>/<id>
202-
```
203-
204-
2.2.3. **Credential Files** (Available locally)
205-
206-
The required credential files depend on the authentication method used to connect to the SAP system:
207-
208-
1. **SSH Key Authentication**: If connecting via SSH key, place the private key inside `WORKSPACE/SYSTEM/<DIRECTORY>` and name the file "ssh_key.ppk".
209-
1. **Password Authentication**: If connecting using a username and password, create a password file by running the following command. It takes the username from hosts.yaml file.
210-
211-
```bash
212-
echo "password" > WORKSPACES/SYSTEM/<DIRECTORY>/password
213-
```
214-
215-
2.2.4. **Credential Files** (From Azure Key Vault)
216-
217-
When using Azure Key Vault to store credentials, the framework retrieves authentication details directly from the key vault using the configured managed identity.
218-
219-
**Authentication Methods:**
220-
221-
1. **SSH Key Authentication**: Store the private SSH key content in Azure Key Vault as a secret.
222-
2. **Password Authentication**: Store the password in Azure Key Vault as a secret. The username is taken from the `hosts.yaml` file.
223-
224-
**Setup:**
225-
226-
1. Ensure the managed identity has "Key Vault Secrets User" role on the key vault.
227-
228-
2. Configure `key_vault_id` and `secret_id` parameters in `sap-parameters.yaml` as shown in section 2.2.2.
229-
230-
**Important**: When using Key Vault authentication, do NOT create local credential files (`ssh_key.ppk` or `password` files).
49+
Follow the steps (2.1 - 2.2) in [Setup Guide for SAP Testing Automation Framework](./SETUP.MD#2-system-configuration) to configure your system details.
23150

23251

23352
### 3. Test Execution
@@ -279,52 +98,3 @@ After the test execution completes, a detailed HTML report is generated that sum
27998
3. **View the report**
28099

281100
You can open the HTML report in any web browser to review the results and logs.
282-
283-
## Update the framework
284-
285-
To ensure you have the latest features and fixes, it's important to keep your fork of the SAP Testing Automation Framework up to date. You can do this by pulling the latest changes from the original repository into your fork.
286-
287-
### Steps to update your fork
288-
289-
1. **Ensure you have the upstream repository configured**:
290-
291-
```bash
292-
# Check if you already have the upstream remote
293-
git remote -v
294-
295-
# If you don't see an 'upstream' entry, add it
296-
git remote add upstream https://github.com/Azure/sap-automation-qa.git
297-
```
298-
299-
2. **Fetch the latest changes from the upstream repository**:
300-
301-
```bash
302-
git fetch upstream
303-
```
304-
305-
3. **Ensure you're on your main branch**:
306-
307-
```bash
308-
git checkout main
309-
```
310-
311-
4. **Merge the changes from upstream into your local fork**:
312-
313-
```bash
314-
git merge upstream/main
315-
```
316-
317-
5. **Push the updated code to your GitHub fork**:
318-
319-
```bash
320-
git push origin main
321-
```
322-
323-
This process will update your fork with all the latest features, bug fixes, and improvements from the original SAP Testing Automation Framework repository.
324-
325-
> **NOTE**
326-
> If you've made local changes to your fork, you might encounter merge conflicts during step 4. In that case, you'll need to resolve these conflicts before proceeding with the push in step 5.
327-
328-
## Additional Resources
329-
330-
- [Azure SAP Documentation](https://docs.microsoft.com/azure/sap)

0 commit comments

Comments
 (0)