Renaming Access Points
PyCentral Workflow
This is a Python script that allows users to rename access points in bulk across all Central groups using a .csv file. The .csv file has two columns consisting of AP serial numbers and new names. The script combs through this file and communicates with our Central API endpoint to automatically rename a list of APs. One can access the code for this script here on Github.
Workflow Overview
![Renaming Access Points Flowchart](https://files.readme.io/f2a13f3-image_7.png)
Renaming Access Points Flowchart
Description
This script that uses the Pycentral library to achieve the following steps on a Central account:
- Copy AP configuration
- Change AP hostname
- Replace old AP configuration with new AP configuration that has the new hostname
Prerequisites
- 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
Installation Steps
In order to run the script, please complete the steps below:
-
Clone this repository and cd into 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/activate
In 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 override 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 override 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
Central APIs used for this workflow
Updated about 1 month ago