This is a Python script that uses the Pycentral to simplify the process of adding users and assigning roles to these users withing the HPE Greenlake Platform & Aruba Central. With this script, network admins can seamlessly onboard new users, configure their roles & ensure the users have the right access level.
- The users being added are new to the GLCP platform and Central account. They don't have any existing roles in any accounts in GLCP.
-
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
-
There are three files required for the script
- 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
- BaseURLs of Aruba Central Clusters
- Generating Access token from Central UI
- Generating Access token using OAuth APIs
- This is a CSV file that has the following columns -
- First Name
- Last Name
- Password,
- Country (2 Digit Code of Country)
- Zip-code
- All 6 columns are required for a user.
- The roles that will be provided to the user is defined in the JSON file. 2 roles are required for each user. One role for each app, i.e. GLCP(account_setting) and Aruba Central(nms).
- For example, the example user_roles.json will provide the users with the following roles -
- GLCP - Observer
- Aruba Central - View Only (For all groups)
- If you need to make changes to the roles that the script will assign to the user, please do so in the user_roles.json file.
-
Once all the required files are ready, you can run the script.
python3 user_provisioning.py --central_auth central_token.json --user_list_csv user_list.csv --user_role_json user_roles.json- If you want to change the name of any of the required files, you can do it. Please be sure to update the python command with the updated file names when do so
- Once the script is executed, it will create script_output.csv that will indicate whether it was able to successfully add the user to the Central account. This CSV file will have the following columns
- Email -> Email ID of User
- Added_User -> Indicates whether user was added to Central account