HomeGuidesAPI Reference
GuidesAPI ReferenceGitHubAirheads Developer CommunityLog In

Command Line Access Point Configuration

Workflow tutorial for AP configuration via command line input.

This guide presupposes general knowledge of how to use Aruba Central API's and 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

AP CLI Flowchart

AP CLI Flowchart

Workflow Functionality

  1. This workflow should be used to configure a Central group or specific AOS10 AP.

  2. Workflow takes a .txt file as input with AP CLI commands to configure an AP.

  3. Pulls existing configuration from a Central group or specific AOS10 AP.

  4. 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.

  5. Posts the merged configuration to the target AP.

  6. 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.

  7. 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.

  1. 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
    
  2. A config file containing credential information for your Aruba 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">
    
  3. 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.

  1. Config .txt filepath needs to be set using the cli_path argument shown here:

    --cli_path <"filepath">
    
  2. 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

  1. 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

Troubleshooting Issues

  1. If you encounter module import errors, make sure that the package has been installed correctly.
  2. Devices on operating systems older than AOS10 cannot use serial number as target value.
  3. Check that input commands are compatible with device version.
  4. Ensure Indentation is correct for context switching. The workflow uses regex pattern matching based on appropriate whitespace for merging and copying commands.

Known Issues

  1. Devices on operating systems older than AOS10 cannot use serial number as target value.

What’s Next

Check out more workflows on our GitHub!