This is a Python script that uses the Pycentral library to achieve the following steps on an Aruba Central account-
- Assign Devices to Central Application Instance
- Provide Devices with Central Subscriptions.
- Create a template 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.
- The Aruba Central application is installed in the Greenlake account in which the devices are present.
- The devices used in the workflow are not assigned to any application in the Greenlake account and do not have any subscriptions associated with them.
- The subscription that the workflow utilizes is not expired and has open seats for assignment.
- The group and site that the workflow creates does not already exist in 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.com/aruba/central-python-workflows cd central-python-workflows/device_onboarding -
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.
{ "device_details": { "SWITCH": { "<device-serial-1>": { "mac_address": "<device-1-mac-address-1>", "central_subscription": "<subscription-type-for-device-1>" }, "<device-serial-2>": { "mac_address": "<device-2-mac-address>", "central_subscription": "<subscription-type-for-device-2>" } }, "IAP": { "<device-serial-3>": { "mac_address": "<device-3-mac-address>", "central_subscription": "<subscription-type-for-device-2>" } } }, "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": "" } } }- 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_onboarding.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_onboarding.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 -

