Command Line Access Point Configuration
Workflow tutorial for AP configuration via command line input.
This guide presupposes general knowledge of how to use HPE Aruba Networking's Central APIs, and how to execute workflow scripts. Please see here for detailed information on installing pycentral and getting setup to execute workflow scripts.
The AP CLI workflow is used to configure Central AP's through the use of CLI commands. This allows users to interact directly with APs on Central without the need to operate manually through UI.
Workflow Overview
Workflow Functionality
-
This workflow should be used to configure a Central group or specific AOS-CX 10 AP.
-
Workflow takes a .txt file as input with AP CLI commands to configure an AP.
-
Pulls existing configuration from a Central group or specific AOS-CX 10 AP.
-
Merges input CLI with existing configuration, replacing any existing configuration that matches a context from the input. Any input not replaced is added to the new configuration.
-
Posts the merged configuration to the target AP.
-
Pulls new configuration from Central and validates that input was posted. Any CLI input command not in the new configuration is printed to the terminal as an error.
-
Can optionally replace entire config by setting a flag during execution.
Merging Input
During the merge, existing configurations with matching contexts are replaced. For example if an existing configuration and input CLI both contain the context 'wlan ssid-profile name' all the existing configurations for that WLAN profile will be replaced by input.
Setup
For step-by-step installation guide please navigate to the Github and follow the readme.
-
Clone this repository and
cd
into the workflow directory:git clone https://github.hpe.com/hpe/central-python-workflows.git cd central-python-workflows/ap_config
-
A config file containing credential information for your Central account is required to run this workflow. This guide will help setup configuration files for Central authorization. One common method is to use a token only approach for your credential file which can be found here. The config filename should be passed as a CLI argument during execution.
The Central authorization filename is set as a CLI argument to the workflow as shown below:
--central_auth <"filepath">
-
Install the requirements.
Installation Best Practices
Setting up a virtual environment can be a great way to compartmentalize installations and keep your work isolated form the rest of your working configurations. This guide is a helpful resource for setting up workflow execution in a virtual environment with python!
Configuration Setup
AP configuration is provided in a .txt file in CLI format.
-
Config .txt filepath needs to be set using the cli_path argument shown here:
--cli_path <"filepath">
-
The body structure for the input .txt file is purely AP CLI. Commands that need to be in a CLI context should be indented two spaces under the parent context.
Below is an example of context switching with a WLAN profile. In this example 'wlan ssid-profile' is a new context. Everything indented underneath it belongs to that context. 'wlan access-rule' is a separate context.
wlan ssid-profile test essid test opmode enhanced-open type guest captive-portal internal dtim-period 1 broadcast-filter arp max-authentication-failures 0 blacklist inactivity-timeout 1000 dmo-channel-utilization-threshold 90 max-clients-threshold 1024 enable utf8 wlan access-rule test utf8 rule any any match any any any permit
Sample Configurations
A directory of sample configurations has been provided as a reference in the configurations folder under the ap_config directory here
Executing The Workflow
-
With the input file configured the workflow can now be executed.
$ python replace_ap_workflow.py <group name/serial> --central_auth <"/central/token/path"> --cli_path <"config/path">
Workflow can also be executed with the -r flag to completely replace the existing configuration with the input.
$ python replace_ap_workflow.py <group name/serial> -r --central_auth <"/central/token/path"> --cli_path <"config/path">
Caution
Using the -r flag to replace existing configuration is non-reversible. This option overwrites the entire existing configuration. This can result in issues when attempting to remodify a group due to missing default settings. This option is best used when using the workflow to set up a complete AP configuration.
Documentation
- Python package documentation: pycentral module documentation
- Use-Cases and Workflows: Aruba Developer Hub
- AP CLI Config Reference: API DevHub Reference
- Get AP CLI Config Reference: Get AP CLI Config Reference
- AP CLI Reference Guide: CLI Reference
Troubleshooting Issues
- If you encounter module import errors, make sure that the package has been installed correctly.
- Devices on operating systems older than AOS-CX 10 cannot use serial number as target value.
- Check that input commands are compatible with device version.
- Ensure Indentation is correct for context switching. The workflow uses regex pattern matching based on appropriate whitespace for merging and copying commands.
Known Issues
- Devices on operating systems older than AOS-CX 10 cannot use serial number as target value.
Updated 5 months ago