This is a Python script that uses the Pycentral library to achieve the following steps on an Aruba Central account-
- Create a group (Template-based group)
- Upload Configuration Template to Group
- Move Devices to the newly created Group.
- Create a Site
- Move Devices to the newly created Site.
- All devices have valid Central licenses before the workflow is run
- The group and site that the workflow creates does not already exist in the Central account.
- Devices aren't associated with any existing sites on the Central account
In order to run the script, please complete the steps below:
-
Clone this repository and
cdinto the workflow directory:git clone https://github.hpe.com/hpe/central-python-workflows cd central-python-workflows/device_provisioning -
Install virtual environment (refer https://docs.python.org/3/library/venv.html). Make sure python version 3 is installed in system.
python -m venv env
-
Activate the virtual environment In Mac/Linux:
source env/bin/activateIn Windows:
env/Scripts/activate.bat
-
Install the packages required for the script
python -m pip install -r requirements.txt
-
Provide the Central API Gateway Base URL & Access Token in the central_token.json
{ "central_info": { "base_url": "<api-gateway-domain-url>", "token": { "access_token": "<api-gateway-access-token>" } }, "ssl_verify": true }Note
-
Update the placeholder data of Group, Site & Device details in workflow_variables.json to match your environment.
{ "group_details": { "name": "<group-name>", "attributes": { "template_info": { "Wired": true, "Wireless": true }, "group_properties": { "AllowedDevTypes": [ "AccessPoints", "Switches" ], "Architecture": "Instant", "ApNetworkRole": "Standard", "AllowedSwitchTypes": [ "AOS_CX" ] } }, "config_templates": { "CX": { "template_name": "<template_name>", "template_filename": "<template_file_path>", "version": "<version>", "model": "<model>" }, "IAP": { "template_name": "<template_name>", "template_filename": "<template_file_path>", "version": "<version>", "model": "<model>" } } }, "site_details": { "name": "<site-name>", "address": { "address": "", "city": "", "state": "", "country": "", "zipcode": "" } }, "device_details": { "SWITCH": [ "<device-serial-1>", "<device-serial-2>" ], "IAP": [ "<device-serial-1>", "<device-serial-2>" ] } }Note
- The
attributessection forgroup_detailssupports all attributes that are available forgroup_attributesfor this API.
- The
-
Once central_token.json & workflow_variables.json are updated with the relevant information, you can execute the script with the following command:
python device_provisioning.py
Note
- This script takes the following optional parameters to overide default filenames for the script
- central_auth - Path of Central Token File
- workflow_variables - Path of Workflows Variables File
- You can run the following command to use the optional parameters -
python device_provisioning.py --central_auth <central_token_file> --workflow_variables <workflow_variables_file>
- This script takes the following optional parameters to overide default filenames for the script
-
If the script runs successfully, your terminal output should look like this -

