This is a Python script that uses the Pycentral library to achieve the following steps on an Aruba Central account-
- Copy AP configuration
- Change AP hostname
- Replace old AP configuration with new AP configuration that has the new hostname
- All Access Points have valid Central licenses before the workflow is run
- Access Points are all online and configurable
- Access Points do not need to be in the same group
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/renaming_aps -
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 [variables_sample.csv] (variables_sample.csv is the default csv file) with AP serial numbers and new names OR create a custom csv of the same format to be used as an argument when executing the script
sys_serial,new_name {ap1_serial_number},{ap1_new_name} {ap2_serial_number},{ap2_new_name}
-
Once central_token.json & variables_sample.csv are updated with the relevant information, you can execute the script with the following command:
python renaming_aps.py
Note
- This script takes the following optional parameters to overide default filenames for the script
- central_auth - Path of Central Token File
- csv_names - Path of CSV Names File with AP serial numbers and new names (if no csv is specified the default variables_sample.csv file will be used)
- You can run the following command to use the optional parameters -
python renaming_aps.py --central_auth <central_token_file> --csv_names <csv_names_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 -
-
An [output.csv] file will be created with the output of the script results
- Columns will consist of: serial_number, old_name, new_name, status
- The status variable shows whether or not the AP was successfully renamed
serial_number,old_name,new_name,status {ap1_serial_number},{ap1_old_name},{ap1_new_name},success {ap2_serial_number},{ap2_old_name},{ap2_new_name},failure
