This script automates onboarding of devices to HPE GreenLake Cloud Platform (GLP) to HPE Aruba Networking Central using GLP API calls. It supports the following steps:
- Assigning devices to a Central application
- Applying subscriptions to devices
In addition to the Python script, a Postman collection is provided for this workflow. It includes all the necessary API calls required for device onboarding. This collection can be used as a reference or as an alternative to running the script.
The Postman collection is located in the postman-collection folder of this repository. It also includes an API call to add devices to the GLP workspace, which is not covered by the Python script.
- All devices must already be part of the HPE GreenLake Cloud Platform's device inventory.
- The application(eg. HPE Aruba Networking Central) to which devices will be assigned must already be installed/provisioned in the GLP account.
- The subscription key used for assignment must have enough available seats to accommodate the devices.
Clone this repository and cd into the workflow directory:
git clone -b "v2(pre-release)" https://github.com/aruba/central-python-workflows.git
cd central-python-workflows/glp-device-onboardingCreate a virtual environment (recommended):
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activateInstall required packages:
pip install -r requirements.txtYou need two input files:
-
Credentials File: Contains GLP API credentials (JSON or YAML). \
Example File(YAML)
glp: client_id: <glp-client-id> client_secret: <glp-client-secret>
Note
Input files can be in JSON or YAML format. Sample files are available in the sample-input folder of the repository: JSON, YAML
You can find steps to get API Client Credentials for GLP Platform from here
-
Input Data File: Contains device, application, and subscription details (JSON or YAML).\
Example File(YAML)
Tip
To find the application_name and region required for application assignment, log in to the HPE GreenLake Platform. Navigate to the Services section, where you can view the application name and associated region. Refer to the screenshot below for guidance:
/glp-device-onboarding/images/application_name_region.png)
# Assign device to application (mandatory)
application_assignment:
- application_name: HPE Aruba Networking Central
region: <region>
device_serial_numbers:
- <device-serial-number>
- <device-serial-number>
- application_name: HPE Aruba Networking Central
region: <region>
device_serial_numbers:
- <device-serial-number>
- <device-serial-number>
# Assign subscription to device (mandatory)
subscription_assignment:
- subscription_key: <subscription-key>
device_serial_numbers:
- <device-serial-number>
- subscription_key: <subscription-key>
device_serial_numbers:
- <device-serial-number>Note
Input files can be in JSON or YAML format. Sample files are available in the sample-input folder of the repository: JSON, YAML
The keys application_assignment, and subscription_assignment are all optional, but at least one must be present.
python onboarding_glp.py -vars onboarding_glp_input.json -c glp_token.jsonAt the end, a summary table is printed in the terminal and a detailed CSV (onboarding_results.csv) is generated.
- Terminal Table: Shows a checkmark for success and a cross for failure for each device and step. Below is an example of the terminal output when running the script:
sample_output - CSV File: Contains detailed results for each device called
onboarding_results.csv(See example output CSV here)
- Ensure your credentials and input files are valid and in JSON or YAML format.
- If you encounter any issues with the script, please contact the Automation team.
- For PyCentral-v2 issues, report bugs via GitHub Issues.