Skip to content

Latest commit

 

History

History
 
 

README.md

Device Provisioning

This is a Python script that uses the Pycentral library to achieve the following steps on an Aruba Central account-

  1. Create a group (Template-based group)
  2. Upload Configuration Template to Group
  3. Move Devices to the newly created Group.
  4. Create a Site
  5. Move Devices to the newly created Site.

Demo Workflow

Prerequisite

  1. All devices have valid Central licenses before the workflow is run
  2. The group and site that the workflow creates does not already exist in the Central account.
  3. Devices aren't associated with any existing sites on the Central account

Installation Steps

In order to run the script, please complete the steps below:

  1. Clone this repository and cd into the workflow directory:

    git clone https://github.hpe.com/hpe/central-python-workflows
    cd central-python-workflows/device_provisioning
  2. 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
  3. Activate the virtual environment In Mac/Linux:

    source env/bin/activate

    In Windows:

    env/Scripts/activate.bat
  4. Install the packages required for the script

    python -m pip install -r requirements.txt
  5. 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

  6. Update the placeholder data of Group, Site & Device details in workflow_variables.json to match your environment.

    {
        "group_details": {
            "name": "<group-name>",
            "attributes": {
                "template_info": {
                    "Wired": true,
                    "Wireless": true
                },
                "group_properties": {
                    "AllowedDevTypes": [
                        "AccessPoints",
                        "Switches"
                    ],
                    "Architecture": "Instant",
                    "ApNetworkRole": "Standard",
                    "AllowedSwitchTypes": [
                        "AOS_CX"
                    ]
                }
            },
            "config_templates": {
                "CX": {
                    "template_name": "<template_name>",
                    "template_filename": "<template_file_path>",
                    "version": "<version>",
                    "model": "<model>"
                },
                "IAP": {
                    "template_name": "<template_name>",
                    "template_filename": "<template_file_path>",
                    "version": "<version>",
                    "model": "<model>"
                }
            }
        },
        "site_details": {
            "name": "<site-name>",
            "address": {
                "address": "",
                "city": "",
                "state": "",
                "country": "",
                "zipcode": ""
            }
        },
        "device_details": {
            "SWITCH": [
                "<device-serial-1>",
                "<device-serial-2>"
            ],
            "IAP": [
                "<device-serial-1>",
                "<device-serial-2>"
            ]
        }
    }

    Note

    • The attributes section for group_details supports all attributes that are available for group_attributes for this API.
  7. Once central_token.json & workflow_variables.json are updated with the relevant information, you can execute the script with the following command:

     python device_provisioning.py

    Note

    • This script takes the following optional parameters to overide default filenames for the script
      • central_auth - Path of Central Token File
      • workflow_variables - Path of Workflows Variables File
    • You can run the following command to use the optional parameters -
    python device_provisioning.py --central_auth <central_token_file> --workflow_variables <workflow_variables_file>
  8. If the script runs successfully, your terminal output should look like this -

Central APIs used for this workflow -

  1. Create new group with specified properties
  2. Create new template
  3. Move devices to a group
  4. Create Site
  5. Associate Site to a list of devices