Using the stackstorm-aoscx Pack
Installation and Content Overview
Unfamiliar with the concept of a StackStorm pack? Read through StackStorm's documentation on Packs.
The stackstorm-aoscx Pack
The stackstorm-aoscx pack has been created to showcase AOS-CX integration and workflows with external systems. Later in this guide we've outlined a few example workflows and walk through how to incorporate them in your own environment.
In order to run the workflows included in the stackstorm-aoscx pack, you must first install StackStorm. Once you do so, you will need to install the stackstorm-aoscx pack with the following st2 command:
st2 pack install aoscx
Our aoscx pack is built using our Python SDK pyaoscx for more information on pyaoscx visit our Getting Started with pyaoscx guide. Pyaoscx uses REST API to configure and communicate with AOS-CX therefore in order to use the aoscx pack, you'll have to ensure REST API is enabled by following the Enabling the AOS-CX API instructions.
Aruba AOS-CX Pack on StackStorm-Exchange!
Requirements
Here are the requirements for using the AOS-CX StackStorm pack:
- Ubuntu 18.04+ or CentOS 8+
- python3 required
- Python 3.5+
- st2 3.2.0
- Minimum supported AOS-CX firmware version 10.05
- Enable REST on your AOS-CX device with the following commands:
switch(config)# https-server rest access-mode read-write
switch(config)# https-server vrf mgmt
Implementing AOS-CX Sensors
Currently there is one Sensor implemented in this pack which utilizes the AOS-CX Websocket to subscribe to a list of interfaces and report their admin status. For an example on how to implement the triggers in the AOS-CX PortSensor see Rules and Triggers below.
administrator@StackStorm-Ubuntu:~/stackstorm-aoscx$ st2 sensor get aoscx.PortSensor
+---------------+--------------------------------------------------------------+
| Property | Value |
+---------------+--------------------------------------------------------------+
| id | 5f6c78d799f71335767c2350 |
| uid | sensor_type:aoscx:PortSensor |
| ref | aoscx.PortSensor |
| pack | aoscx |
| name | PortSensor |
| enabled | True |
| entry_point | sensors.port_sensor.PortSensor |
| artifact_uri | file:///opt/stackstorm/packs/aoscx/sensors/port_sensor.py |
| trigger_types | [ |
| | "aoscx.port_status" |
| | ] |
| description | Sensor that monitors the admin status of AOS-CX switch's |
| | interfaces using Websocket connection |
| metadata_file | sensors/port_sensor.yaml |
+---------------+--------------------------------------------------------------+
AOS-CX Sensor Configuration File
The aoscx.yaml.example
file is an example configuration file used by the AOS-CX Websocket port_sensor
which monitors the admin status of a list of interfaces on an AOS-CX device. In this file is where you define the AOS-CX device, it's credentials, and the interfaces you want to monitor. Once you've inputted your device information into the file, copy this to /opt/stackstorm/configs/aoscx.yaml
.
To register the configuration file's contents with StackStorm execute the following command:
st2ctl reload --register-configs
Credentials Configuration
The pack uses REST API to connect to the AOS-CX switch. The following format is used to specify the credentials for the AOS-CX device. Each credential must have a username and password that is authorized for REST-API commands:
credentials:
admin:
username: admin
password: admin
Device Configuration
The device configuration requires the IP address of the AOS-CX device, it's credentials,
and the list of interfaces to monitor. It is optional to provide PROXY information to use in connecting to the AOS-CX Websocket.
device:
ip_address: 10.100.206.188
hostname: 8320-CX-188
credentials: admin
interface:
- 1/1/1
- 1/1/23
- 1/1/14
proxy:
http: None
https: None
credentials:
admin:
username: admin
password: admin
device:
ip_address: 10.100.206.188
hostname: 8320-CX-188
credentials: admin
interface:
- 1/1/1
- 1/1/23
- 1/1/14
proxy:
http: None
https: None
Implementing AOS-CX Actions and Action Workflows
Actions provided in the aoscx pack allow for REST API commands to be executed on AOS-CX devices as well as external systems such as Ansible. Action Workflows in the pack call multiple actions to create full workflows. See the tables below for the current supported Actions and Action Workflows.
Actions
Action | Description |
---|---|
get_link_status | Get the link status of all interfaces on an AOS-CX switch with the specified IP address and returns a formatted string. |
get_aoscx_interface_tower_info | Get the MAC address and IP address of a newly connected device to AOS-CX through LLDP. Validates if the device needs to be provisioned using Ansible Tower API and device hostname information. |
Action Workflows
Action Workflow | Description |
---|---|
ztp_ansible_tower_workflow | A workflow that runs an Ansible Tower Job Template after retrieving device LLDP information on an AOS-CX switch through the get_aoscx_interface_tower_info action. |
Reference an action's documentation to learn more about what it does and what information it requires to be used.
To display an action's details and parameters execute the st2 action get <action>
command:
administrator@StackStorm-Ubuntu:~/stackstorm-aoscx$ st2 action get aoscx.get_link_status
+---------------+--------------------------------------------------------------+
| Property | Value |
+---------------+--------------------------------------------------------------+
| id | 5f5023d616120e034d2ca30c |
| name | get_link_status |
| pack | aoscx |
| description | Gets the link status of all interfaces on an AOS-CX switch |
| | with the specified IP address |
| enabled | True |
| entry_point | get_link_status.py |
| metadata_file | |
| notify | |
| output_schema | |
| parameters | { |
| | "username": { |
| | "position": 1, |
| | "required": true, |
| | "type": "string", |
| | "description": "AOS-CX username" |
| | }, |
| | "ip": { |
| | "position": 0, |
| | "required": true, |
| | "type": "string", |
| | "description": "AOS-CX IP address" |
| | }, |
| | "password": { |
| | "position": 2, |
| | "required": true, |
| | "type": "string", |
| | "description": "AOS-CX password" |
| | } |
| | } |
| ref | aoscx.get_link_status |
| runner_type | python-script |
| tags | |
| uid | action:aoscx:get_link_status |
+---------------+--------------------------------------------------------------+
Rules and Triggers
This pack defines rules for handling syslog or websocket events from AOS-CX devices, see the tables below for more information on the rules and triggers provided in the pack.
Rules
Rule | Description |
---|---|
port_sensor_rule | Using the AOS-CX Websocket PortSensor, retrieves the admin status of all interfaces on an AOS-CX switch when an interface goes down. |
ztp_ansible_tower_workflow_rule | Starts the ztp_ansible_tower_worfklow when an interface link on AOS-CX comes up via Syslog message. |
Triggers
Trigger | Descrption |
---|---|
aoscx.port_status | Trigger which occurs when AOS-CX interface admin status changes. Reported by the AOS-CX PortSensor. |
Updated 5 months ago