HomeGuidesAPI Reference
GuidesAPI ReferenceGitHubAirheads Developer CommunityLog In

NAPALM with StackStorm

With StackStorm's event-driven automation, users can make calls NAPALM calls based off of conditions from events detected on the network. NAPALM is usable in StackStorm using the NAPALM Integration Pack.
This allows for StackStorm uses to leverate NAPALM within StackStorm in the form of sensors, actions, and more.

📘

Installation and configuration for StackStorm for AOS-CX can be found here.
Installation and configuration of the NAPALM Integration Pack can be found in their GitHub repo here.

Supported Actions with AOS-CX NAPALM Drivers

The actions that the StackStorm Integration Pack is a subset of the NAPALM AOS-CX Driver methods. Note that some have different function call names.

  • get_arp_table
  • get_bgp_neighbors
  • get_bgp_neighbors_detail
  • get_config
  • get_facts
  • get_interfaces
  • get_lldp_neighbors
  • get_mac_address_table
  • get_ntp
  • get_route_to
  • get_snmp_information

Supported Sensors with AOS-CX NAPALM Drivers

The pack currently implements one sensor, largely for illustrative purposes.

  • napalm.NapalmLLDPSensor: This detects any changes in the number of active LLDP neighbors

Example Workflow

This example workflow uses a webhook trigger to run an action chain when an interface goes down, posting to a Slack channel through a webhook. For more information about using StackStorm with a Slack Webhook, check out the StackStorm workflow with Ansible here.

---
  version: '1.1'

  napalm.interface_down_workflow:

    input:
      - hostname
      - message
      - interface
      - slackwebhook

    type: direct

    task-defaults:
      on-error:
        - notify_on_error

    tasks:

      show_interface:
        action: "napalm.get_interfaces"
        input:
          hostname: <% $.hostname %>
          interface: <% $.interface %>
          htmlout: true
        on-success: "show_interface_counters"

      show_interface_counters:
        action: "napalm.get_interfaces"
        input:
          hostname: <% $.hostname %>
          interface: <% $.interface %>
          htmlout: true
          counters: true
        on-success: "send_slack_notif_task"

      send_slack_notif_task:
        action: core.local cmd='curl -X POST "Content-type:application/json" --data "{\"text\":\"<% ctx().message %>\"}" <% $.slackwebhook %>'