Skip to content

Commit 2f657b7

Browse files
Documentation and Setup Improvements (#119)
* Bump requests from 2.32.4 to 2.32.5 (#105) * Bump requests from 2.32.4 to 2.32.5 (#106) * Updated logic for HA DB/SCS cluster configuration validation (#114) * Restructure the documents for high availability testing (#116) * Bump pandas from 2.3.1 to 2.3.3 (#118) Bumps [pandas](https://github.com/pandas-dev/pandas) from 2.3.1 to 2.3.3. - [Release notes](https://github.com/pandas-dev/pandas/releases) - [Commits](pandas-dev/pandas@v2.3.1...v2.3.3) --- updated-dependencies: - dependency-name: pandas dependency-version: 2.3.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Devansh Jain <[email protected]> * Updated commands to get the automated-register and priority fencing delay (#122) * Add provider value resolution and enhance parameter status determination logic * Refactor cluster parameter retrieval logic and update related tests * Refactor command imports and update cluster status retrieval logic to use new parameters * Refactor HANA resource handling by renaming parameters and updating related logic across multiple files * Refactor command execution logic to simplify parameter value retrieval * Fix typo in method name and update related test cases for cluster parameter retrieval * Fix inconsistent quote style in test case for cluster parameter retrieval * Update cluster parameter retrieval to include PRIORITY_FENCING_DELAY and fix typo in test case name --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent ad42a99 commit 2f657b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2230
-980
lines changed

.github/copilot-instructions.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SAP Testing Automation Framework - Copilot Instructions
2+
3+
## Project Context
4+
5+
This is the SAP Testing Automation Framework—an open-source orchestration tool for validating SAP deployments on Microsoft Azure. The framework focuses on HA testing for SAP HANA Scale-Up and SAP Central Services in two-node Pacemaker clusters.
6+
7+
### Key Technologies & Architecture
8+
- **Primary Stack**: Python 3.10+, Ansible, Azure CLI/APIs
9+
- **Target Environment**: SAP on Azure (SLES/RHEL clusters)
10+
- **Testing Focus**: HA functional testing, configuration validation, failover scenarios
11+
- **Structure**: Modular design with separate modules, roles, and utilities
12+
- **Standards**: pytest for testing, pylint/black for code quality, 85% code coverage requirement
13+
14+
### Project Structure Understanding
15+
- `src/`: Core framework code (Ansible modules, playbooks, utilities)
16+
- `tests/`: Comprehensive pytest test suite
17+
- `docs/`: Architecture and integration documentation
18+
- `WORKSPACES/`: System-specific configurations and credentials
19+
- Key files: `pyproject.toml` (project config), Ansible playbooks for HA testing
20+
21+
### Enterprise-Grade & OOP Defaults (mandatory)
22+
23+
#### Enterprise-grade by default. No compromises.
24+
25+
- Production-ready code: safe defaults, clear failure modes, strict typing, deterministic behavior.
26+
- Observability: structured logging, metrics hooks, and trace-friendly correlation IDs.
27+
- Resilience: timeouts, bounded retries with jitter/backoff, idempotency, and circuit-breaker patterns.
28+
- Security: least privilege, no plaintext secrets, input validation, deny-by-default.
29+
- Performance hygiene: avoid needless subprocess calls, batch remote ops, reduce SSH/chatty loops.
30+
31+
##### Object-Oriented mindset for every answer and artifact.
32+
- Favor well-named classes with SRP, clear interfaces, and dependency inversion.
33+
- Encapsulate external systems (Azure, OS, Ansible runner) behind ports/adapters.
34+
- Model states and workflows as explicit types; avoid “stringly typed” protocols.
35+
- Provide seams for testing via interfaces and small, mockable collaborators.
36+
37+
## Coding Partnership Rules
38+
39+
Follow these rules at all times:
40+
41+
1. **Be critical, not agreeable**:
42+
- Do not just follow assumptions. Flag missing context and risky design choices.
43+
- Provide counterpoints/alternatives, esp. for SAP/Azure specifics that look wrong.
44+
45+
2. **Apply best design principles**:
46+
- SOLID, DRY, KISS, clear separation of concerns.
47+
- Maintainability > cleverness. Small units > god-objects.
48+
- Production SAP constraints: reliability, observability, rollback plans, and operability.
49+
50+
3. **Cover edge cases**:
51+
- Empty/invalid inputs, boundary conditions, transient Azure failures, partial cluster outages,
52+
quorum loss, fencing misconfig, split-brain, storage throttling, DNS/MI/IMDS hiccups.
53+
54+
4. **Output style**:
55+
- Concise. Minimal yet complete code. Black-formatted, pylint-clean, ≤100-char lines.
56+
- Include types, docstrings, explicit exceptions. Show tests when relevant.
57+
58+
5. **Collaboration stance**:
59+
- Act as a Principal software reviewer. Push back on weak requests or ambiguous scope.
60+
- Offer 2–3 viable designs when trade-offs exist, with crisp pros/cons.
61+
62+
## Project-Specific Guidance
63+
64+
- **Ansible Modules**: Follow the existing module pattern with proper error handling and result objects
65+
- **Testing**: Maintain 85% code coverage, use pytest fixtures effectively
66+
- **SAP Context**: Understand HA requirements, cluster behavior, and Azure integration points
67+
- **Documentation**: Update relevant docs when making architectural changes

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,6 @@ VMWPASSWORD
409409
.coverage.*
410410
*.ini
411411
.ansible/
412+
413+
# GitHub Copilot configuration files
414+
copilot-instructions.md
File renamed without changes.

docs/HIGH_AVAILABILITY.md

Lines changed: 3 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -28,107 +28,19 @@ Currently SAP Testing Automation Framework is supported for below Linux distros
2828

2929
For SAP Central Services on SLES, both the simple mount approach and the classic method are supported.
3030

31-
## Technical Requirements for running Automation Framework
32-
33-
To run the SAP Testing Automation Framework, you must meet certain prerequisites and follow techincal requirements.
34-
35-
### SAP System Deployment on Microsoft Azure
36-
37-
- The SAP system must be hosted on Microsoft Azure Infrastructure-as-a-Service (IaaS).
38-
- The SAP system deploymed should follow SAP on Azure best practices as outlined in:
39-
- [SAP HANA high availability on Azure Virtual Machine](https://learn.microsoft.com/azure/sap/workloads/sap-high-availability-guide-start).
40-
- [SAP Netweaver high availability on Azure Virtual Machine](https://learn.microsoft.com/azure/sap/workloads/sap-high-availability-guide-start)
4131

4232
### Enabling Cluster Services on Boot
43-
33+
4434
Before executing the tests, ensure that the cluster services are configured to start automatically during system boot. Run the following command on one of the cluster nodes to enable this setting. The `--all` option ensures that the cluster services are enabled on all nodes within the cluster.
4535

4636
```bash
4737
crm cluster enable --all # for SUSE virtual machines
4838
pcs cluster enable --all # for RedHat virtual machine
4939
```
5040

51-
### Management server
52-
53-
The SAP Testing Automation Framework requires a jumpbox or management server with the following setup:
54-
55-
- **Operating System**: Supported (Ubuntu 22.04 LTS, SLES 15 SP4, 15 SP6).
56-
- **Location**: Must be deployed on Azure.
57-
58-
### Azure RBAC
59-
60-
For the framework to access the properties of the Azure Load Balancer in a high availability SAP system on Azure, the management server must have a Reader role assigned to the Load Balancer. This can be done using either a system-assigned or user-assigned managed identity.
61-
62-
#### Configuring access using system-assigned managed identity
63-
64-
1. Enable system managed identity on the management server by following the steps in [Configure managed identities on Azure VMs](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/how-to-configure-managed-identities?pivots=qs-configure-portal-windows-vm#system-assigned-managed-identity).
65-
1. Open the Azure Load Balancer used for the high availability deployment of your SAP system on Azure.
66-
1. In the Azure Load Balancer panel, go to Access control (IAM).
67-
1. Follow steps from [Use managed identity to access Azure Resource](https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal) to complete the configuration.
68-
69-
#### Configuring access using user-assigned managed identity
70-
71-
1. Create user-assigned managed identity as described in [manage user-assigned managed identities](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp#create-a-user-assigned-managed-identity)
72-
1. Assign user-assigned managed identity to management server as described in [configure managed identities on Azure VMs](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/how-to-configure-managed-identities?pivots=qs-configure-portal-windows-vm#assign-a-user-assigned-managed-identity-to-an-existing-vm)
73-
1. Open the Azure Load Balancer used for the high availability deployment of your SAP system on Azure.
74-
1. In the Azure Load Balancer panel, go to Access control (IAM).
75-
1. Assign the required role to the user-assigned managed identity by following the steps in [assign roles using Azure portal](https://learn.microsoft.com/azure/role-based-access-control/role-assignments-portal).
76-
77-
### Network Connectivity
78-
79-
The management server must have network connectivity to the SAP system to perform tests and validations. You can establish this connection by peering the networks as outlined in [manage a virtual network peering](https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-peering?tabs=peering-portal).
80-
81-
### Analytics Integration (optional)
82-
83-
- **Analytics Integration** [Telemetry Setup Information](./TELEMETRY_SETUP.md)
84-
- Azure Log Analytics
85-
- Azure Data Explorer
86-
87-
## Getting Started
88-
89-
### 1. Environment Setup
90-
91-
To set up your environment in management server, follow these steps:
41+
### 1. Setup Configuration
9242

93-
1.1. **Login to the management server**:
94-
95-
Ensure you are logged into the management server that is connected to the SAP system's virtual network.
96-
97-
1.2. **Install git on management server**:
98-
99-
```bash
100-
# Debian/Ubuntu
101-
sudo su -
102-
apt-get install git
103-
104-
# RHEL/CentOS
105-
sudo su -
106-
yum install git
107-
108-
# SUSE
109-
sudo su -
110-
zypper install git
111-
```
112-
113-
1.3. **Fork and clone the repository**:
114-
115-
```bash
116-
# sudo to root
117-
sudo su -
118-
119-
# First, visit https://github.com/Azure/sap-automation-qa in your browser
120-
# Click the "Fork" button in the top-right corner to create a fork in your GitHub account
121-
122-
# Clone your fork of the repository (replace GITHUB-USERNAME with your GitHub username)
123-
git clone https://github.com/GITHUB-USERNAME/sap-automation-qa.git
124-
cd sap-automation-qa
125-
```
126-
127-
1.4. **Run the initial setup script**:
128-
129-
```bash
130-
./scripts/setup.sh
131-
```
43+
Follow the steps in [Setup Guide for SAP Testing Automation Framework](./SETUP.MD) to set up the framework on a management server.
13244

13345
### 2. Configuration
13446

docs/SETUP.MD

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
2+
# Setup Guide for SAP Testing Automation Framework
3+
4+
## Technical Requirements for running Automation Framework
5+
6+
To run the SAP Testing Automation Framework, you must meet certain prerequisites and follow technical requirements.
7+
8+
### SAP System Deployment on Microsoft Azure
9+
10+
- The SAP system must be hosted on Microsoft Azure Infrastructure-as-a-Service (IaaS).
11+
- The SAP system deployed should follow SAP on Azure best practices as outlined in:
12+
- [SAP HANA high availability on Azure Virtual Machine](https://learn.microsoft.com/azure/sap/workloads/sap-high-availability-guide-start).
13+
- [SAP Netweaver high availability on Azure Virtual Machine](https://learn.microsoft.com/azure/sap/workloads/sap-high-availability-guide-start)
14+
15+
### Management server
16+
17+
The SAP Testing Automation Framework requires a jumpbox or management server with the following setup:
18+
19+
- **Operating System**: Supported (Ubuntu 22.04 LTS, SLES 15 SP4, 15 SP6, REDHAT 9.4).
20+
- **Location**: Must be deployed on Azure.
21+
22+
### Azure RBAC
23+
24+
For the framework to access the properties of the Azure Load Balancer in a high availability SAP system on Azure, the management server must have a Reader role assigned to the Load Balancer. This can be done using either a system-assigned or user-assigned managed identity.
25+
26+
#### Configuring access using system-assigned managed identity
27+
28+
1. Enable system managed identity on the management server by following the steps in [Configure managed identities on Azure VMs](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/how-to-configure-managed-identities?pivots=qs-configure-portal-windows-vm#system-assigned-managed-identity).
29+
1. Open the Azure Load Balancer used for the high availability deployment of your SAP system on Azure.
30+
1. In the Azure Load Balancer panel, go to Access control (IAM).
31+
1. Follow steps from [Use managed identity to access Azure Resource](https://learn.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal) to complete the configuration.
32+
33+
#### Configuring access using user-assigned managed identity
34+
35+
1. Create user-assigned managed identity as described in [manage user-assigned managed identities](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp#create-a-user-assigned-managed-identity)
36+
1. Assign user-assigned managed identity to management server as described in [configure managed identities on Azure VMs](https://learn.microsoft.com/entra/identity/managed-identities-azure-resources/how-to-configure-managed-identities?pivots=qs-configure-portal-windows-vm#assign-a-user-assigned-managed-identity-to-an-existing-vm)
37+
1. Open the Azure Load Balancer used for the high availability deployment of your SAP system on Azure.
38+
1. In the Azure Load Balancer panel, go to Access control (IAM).
39+
1. Assign the required role to the user-assigned managed identity by following the steps in [assign roles using Azure portal](https://learn.microsoft.com/azure/role-based-access-control/role-assignments-portal).
40+
41+
### Network Connectivity
42+
43+
The management server must have network connectivity to the SAP system to perform tests and validations. You can establish this connection by peering the networks as outlined in [manage a virtual network peering](https://learn.microsoft.com/azure/virtual-network/virtual-network-manage-peering?tabs=peering-portal).
44+
45+
### Analytics Integration (optional)
46+
47+
- **Analytics Integration** [Telemetry Setup Information](./TELEMETRY_SETUP.md)
48+
- Azure Log Analytics
49+
- Azure Data Explorer
50+
51+
## Getting Started
52+
53+
### 1. Environment Setup
54+
55+
To set up your environment in management server, follow these steps:
56+
57+
1.1. **Login to the management server**:
58+
59+
Ensure you are logged into the management server that is connected to the SAP system's virtual network.
60+
61+
1.2. **Install git on management server**:
62+
63+
```bash
64+
# Debian/Ubuntu
65+
sudo su -
66+
apt-get install git
67+
68+
# RHEL/CentOS
69+
sudo su -
70+
yum install git
71+
72+
# SUSE
73+
sudo su -
74+
zypper install git
75+
```
76+
77+
1.3. **Fork and clone the repository**:
78+
79+
```bash
80+
# sudo to root
81+
sudo su -
82+
83+
# First, visit https://github.com/Azure/sap-automation-qa in your browser
84+
# Click the "Fork" button in the top-right corner to create a fork in your GitHub account
85+
86+
# Clone your fork of the repository (replace GITHUB-USERNAME with your GitHub username)
87+
git clone https://github.com/GITHUB-USERNAME/sap-automation-qa.git
88+
cd sap-automation-qa
89+
```
90+
91+
1.4. **Run the initial setup script**:
92+
93+
```bash
94+
./scripts/setup.sh
95+
```
96+
97+
1.5. **Activate the python environment**:
98+
99+
```bash
100+
source .venv/bin/activate
101+
```

docs/DB_HIGH_AVAILABILITY.md renamed to docs/high_availability/DB_HIGH_AVAILABILITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
| Test Case | Type | Description | More Info |
66
|-----------|-----------|-------------| --------- |
7-
| HA Parameters Validation | Configuration | The HA parameter validation test validates HA configuration including Corosync settings, Pacemaker resources, SBD device configuration, and HANA system replication setup. | [ha-config.yml](../src/roles/ha_db_hana/tasks/ha-config.yml) |
8-
| Azure Load Balancer | Configuration | The Azure LB configuration test validates Azure Load Balancer setup including health probe configuration, backend pool settings, load balancing rules, and frontend IP configuration. | [azure-lb.yml](../src/roles/ha_db_hana/tasks/azure-lb.yml) |
7+
| HA Parameters Validation | Configuration | The HA parameter validation test validates HA configuration including Corosync settings, Pacemaker resources, SBD device configuration, and HANA system replication setup. | [ha-config.yml](../../src/roles/ha_db_hana/tasks/ha-config.yml) |
8+
| Azure Load Balancer | Configuration | The Azure LB configuration test validates Azure Load Balancer setup including health probe configuration, backend pool settings, load balancing rules, and frontend IP configuration. | [azure-lb.yml](../../src/roles/ha_db_hana/tasks/azure-lb.yml) |
99
| Resource Migration | Failover | The Resource Migration test validates planned failover scenarios by executing controlled resource movement between HANA nodes. It performs a graceful migration of the primary HANA resources to the secondary node, verifies proper role changes, ensures cluster maintains stability throughout the transition, and validates complete data synchronization after migration. | [resource-migration.md](./pseudocode/resource-migration.md) |
1010
| Primary Node Crash | Failover | The Primary Index Server Crash test simulates cluster behavior when the HANA index server crashes on the primary node. It simulates an index server failure by forcefully terminating the process, then verifies automatic failover to the secondary node, monitors system replication status, and confirms service recovery without data loss. | [node-crash.md](./pseudocode/node-crash.md) |
1111
| Block Network | Network | The Block Network test validates cluster behavior during network partition scenarios by implementing iptables rules to block communication between primary and secondary HANA nodes. It verifies split-brain prevention mechanisms, validates proper failover execution when nodes become isolated, and ensures cluster stability and data consistency after network connectivity is restored. | [block-network.md](./pseudocode/block-network.md) |

0 commit comments

Comments
 (0)