This Python script automates the configuration of a WPA3 PSK (Wi-Fi Protected Access 3 - Pre-Shared Key) in New HPE Aruba Networking Central. It creates configuration profiles such as roles and policies in New Central, modifies policy groups and associates policies with them, and generates WPA3 PSK configurations with associated roles. Additionally, it assigns these configurations to the appropriate scopes, whether site or global, and moves devices into the site with the WPA3 PSK configuration to ensure they inherit the profile.
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtThis file contains the credentials required to authenticate with New Central.
new_central:
base_url: <your_base_url>
client_id: <your_client_id>
client_secret: <your_client_secret>This file contains the credentials required to authenticate with the Classic Central API.
central_info:
base_url: <your_classic_central_base_url>
token:
access_token: <your_classic_central_token>
ssl_verify: trueThis file contains the configuration details for the WPA3 PSK workflow.
Important
Ensure that the site_details section is properly configured. The ssid variable is the name of your wlan ssid profile. The default-role should match the name of the role_details role name so that the role created in this workflow is correctly applied to the wlan ssid profile when it is created. A WPA3 PSK must have the enable parameter set to true in order to enable the SSID profile. The opmode or operation mode must be set to WPA3_PSK: Wi-Fi Protected Access 3 with Pre-Shared Key authentication.
site_details:
name: "WPA3-PSK-Site"
address: "6280 America Center Dr"
city: "San Jose"
state: "California"
country: "United States"
zipcode: "95002"
timezone: "America/Los_Angeles"
role_details:
role:
- name: "wpa3-psk-role"
description: "wpa3-psk-role description"
policy_details:
policy:
- name: "wpa3-psk-policy"
type: "POLICY_TYPE_SECURITY"
description: "wpa3-psk-policy description"
security-policy:
type: "SECURITY_POLICY_TYPE_DEFAULT"
policy-rule:
- position: 1
description: "Allow All"
condition:
type: "CONDITION_DEFAULT"
rule-type: "RULE_ANY"
source:
type: "ADDRESS_ROLE"
role: "wpa3-psk-role"
destination:
type: "ADDRESS_ANY"
action:
type: "ACTION_ALLOW"
policy_group_details:
policy-group:
policy-group-list:
- name: "wpa3-psk-policy"
position: 4
description: "wpa3-psk-policy description"
ssid_details:
wlan-ssid:
- ssid: "wpa3-psk-wlan"
enable: true
forward-mode: "FORWARD_MODE_BRIDGE"
opmode: "WPA3_PSK"
default-role: "wpa3-psk-role"This file contains the mapping of devices to the site. It specifies the device type and serial numbers of devices to be moved to the site.
WPA3-PSK-Site:
- device_type: IAP
devices:
- PHQSLBN5HBThis file contains the new passphrase details for updating the WPA3 PSK.
Important
Ensure that the ssid matches the name of the WLAN SSID profile you want to update. The new_passphrase should be a secure and valid passphrase. The passphrase must be between 8 and 63 characters long and can include letters, numbers, and special characters.
ssid: "wpa3-psk-wlan"
new_passphrase: "<your_new_passphrase>"This workflow automates the configuration of a WPA3 PSK in HPE Aruba Networking Central, including site creation, role and policy assignment, and device management. Ensure that all configuration files are properly set up before running the script.
Note
Please make sure the device is provisioned to New Central before assigning it to a site.
The script currently supports assigning devices managed by both Classic and New Central, but only devices in New Central can inherit site-level configurations. Since the goal of the script is to apply these inherited profiles, devices should be in New Central before site assignment.
To execute the workflow, run the following command:
python wpa3_psk_overlay_workflow.py -c account_credentials.yaml -cc classic_account_credentials.yaml -i inventory.yaml -p wlan_overlay_profiles.yamlTo update the WPA3 PSK passphrase, include the -np flag with the new_passphrase.yaml file:
python wpa3_psk_overlay_workflow.py -c account_credentials.yaml -cc classic_account_credentials.yaml -i inventory.yaml -p wlan_overlay_profiles.yaml -np new_passphrase.yamlThe script includes logic to handle passphrase updates conditionally based on the -np flag and the contents of the new_passphrase.yaml file.
-
Checking the
-npFlag:- The script checks if the
-npflag is provided when running the script. - If the flag is not provided, the passphrase update steps (Step 13 and Step 14) are skipped entirely.
- The script checks if the
-
Checking the
new_passphrase.yamlFile:- If the
-npflag is provided, the script reads thenew_passphrase.yamlfile. - The file must contain the
ssid_namefield (the name of the SSID to update). If this field is missing, the script will terminate with an error. - The file may optionally contain the
new_passphrasefield:- If
new_passphraseis present and non-empty, the script executes Step 13 to update the passphrase for the specified SSID. - If
new_passphraseis missing or empty, the script executes Step 14 to generate a new passphrase and update the SSID with the generated value.
- If
- If the
-
Confirmation Prompts:
- Before executing either Step 13 or Step 14, the script prompts the user for confirmation with a message explaining the action to be taken.
- The user must confirm by entering
yto proceed; otherwise, the step is skipped.
- Command:
python wpa3_psk_overlay_workflow.py -c account_credentials.yaml -cc classic_account_credentials.yaml -i inventory.yaml -p wlan_overlay_profiles.yaml -np new_passphrase.yaml
new_passphrase.yaml:ssid_name: "wpa3-psk-wlan" new_passphrase: "securepassword123"
- Outcome:
- The script executes Step 13 to update the passphrase for
wpa3-psk-wlantosecurepassword123.
- The script executes Step 13 to update the passphrase for
- Command:
python wpa3_psk_overlay_workflow.py -c account_credentials.yaml -cc classic_account_credentials.yaml -i inventory.yaml -p wlan_overlay_profiles.yaml -np new_passphrase.yaml
new_passphrase.yaml:ssid_name: "wpa3-psk-wlan" new_passphrase: ""
- Outcome:
- The script executes Step 14 to generate a new random passphrase and update the SSID
wpa3-psk-wlanwith the generated value.
- The script executes Step 14 to generate a new random passphrase and update the SSID
- Command:
python wpa3_psk_overlay_workflow.py -c account_credentials.yaml -cc classic_account_credentials.yaml -i inventory.yaml -p wlan_overlay_profiles.yaml
- Outcome:
- The script skips both Step 13 and Step 14 since the
-npflag is not provided.
- The script skips both Step 13 and Step 14 since the
-
Authentication Errors:
- Ensure that the credentials in account_credentials.yaml and classic_account_credentials.yaml are correct.
-
Site Creation Fails:
- Check the site_details section in wlan_overlay_profiles.yaml for missing or incorrect fields.
-
Role or Policy Assignment Fails:
- Ensure that the role or policy exists before assigning it to a site.
-
Device Retrieval Fails:
- Verify that devices are associated with the site in HPE Aruba Networking Central.
-
Passphrase Update Fails:
- Ensure that the
new_passphrase.yamlfile is properly configured with the correct SSID and a valid passphrase.
- Ensure that the
- This workflow is designed for HPE Aruba Networking Central environments and requires the pycentral SDK.
- Ensure that the configuration files listed above are filled out properly before running the script.