https://github.com/tes3awy/cisco-catalyst-center-webhooks
Webhook Testing with Cisco Catalyst Center (a.k.a DNA Center)
https://github.com/tes3awy/cisco-catalyst-center-webhooks
api catalyst-center-automation cisco flask real-time webhook websocket
Last synced: 3 months ago
JSON representation
Webhook Testing with Cisco Catalyst Center (a.k.a DNA Center)
- Host: GitHub
- URL: https://github.com/tes3awy/cisco-catalyst-center-webhooks
- Owner: Tes3awy
- License: mit
- Created: 2025-01-23T12:19:53.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-02T19:18:56.000Z (over 1 year ago)
- Last Synced: 2025-06-06T21:11:26.520Z (about 1 year ago)
- Topics: api, catalyst-center-automation, cisco, flask, real-time, webhook, websocket
- Language: Python
- Homepage: https://developer.cisco.com/codeexchange/github/repo/Tes3awy/cisco-catalyst-center-webhooks
- Size: 617 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://developer.cisco.com/codeexchange/github/repo/Tes3awy/cisco-catalyst-center-webhooks)
[](https://github.com/psf/black)
[](https://pycqa.github.io/isort/)





# Webhook Testing with Cisco Catalyst Center (a.k.a DNA Center)
## Objective
This project is a Proof of Concept (PoC) for the use of webhooks with Cisco SDN solutions, specifically integrating with Cisco Catalyst Center. It leverages a Flask application to receive and process webhook notifications in real-time, showcasing how events from the Cisco Catalyst Center can be handled programmatically.
| Webhook Receiver Up | Webhook Receiver Down |
| :-------------------------------------------------------: | :-------------------------------------------------------------: |
|  |  |
# Table of Contents
- [Objective](#objective)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Use Case](#use-case)
- [Security Considerations/Improvements](#security-considerationsimprovements)
- [Debugging Tips](#debugging-tips)
- [Author(s)](#authors)
- [Getting involved](#getting-involved)
- [References](#references)
## Features
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
- **Webhook Integration**: Receive and process notifications from Cisco Catalyst Center.
- **Websockets**: Enable ongoing, full-duplex, bidirectional communication between client and server.
- **Real-time Updates**: Display incoming notifications in a dynamically updating dashboard web page.
- **Authentication**: Secure webhook endpoints with basic authentication.
- **Notification Sound**: Play a sound when a new notification is received.
- **Pagination**: Display event notifications in a paginated format.
## Prerequisites
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
- Python 3.9+
- Flask
- Cisco Catalyst Center with webhook enabled
## Installation
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
1. Clone the repo
```bash
$ git clone https://github.com/Tes3awy/cisco-catalyst-center-webhooks.git
$ cd cisco-catalyst-center-webhooks
```
2. Setup a virtual environment (Optional but recommended)
```bash
$ python -m venv .venv
$ source .venv/bin/activate . # On Windows, use `.\.venv\Scripts\Activate.ps1` in powershell
(.venv)$
```
3. Install SQLite3
> Linux
```bash
$ sudo apt update && sudo apt upgrade -y
$ sudo apt install sqlite3 -y
$ sqlite3 --version
```
> Windows
Follow this [tutorial](https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/SQLite3-How-to-download-and-install-SQLite-on-Windows-version-latest-tutorial)
4. Install dependencies
```bash
(.venv)$ pip install -r requirements.txt
```
5. Set _private_ environment variables
Create a `.env` file in the root directory and add the following:
```env
BASIC_AUTH_USERNAME="USERNAME"
BASIC_AUTH_PASSWORD="PASSWORD"
```
6. Run the application
```bash
(.venv)$ flask run
* Serving Flask app 'run'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on https://127.0.0.1:5443
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 419-253-304
***** Copy Headers for Cisco Catalyst Center Webhook *****
Authorization: Basic YWRtaW46Q2lzY28hMjM0NQ==
Content-Type: application/json
***** Copy Headers for Cisco Catalyst Center Webhook *****
```
7. Configure Cisco Catalyst Center
- Navigate to **System > Settings > External Services > Destination > Webhook** in the Catalyst Center dashboard.
- Add a new POST webhook with the Webhook URL `https://:5443/api/v1/webhook`.
- For the Trust Certificate radio button, choose **No**.
- For Authentication, choose **Basic** and set the required headers:
- `Content-Type: application/json`
- `Authorization: Basic `
- Configure a webhook destination for an event. _(Refer to the references section)_
## Usage
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
Once the application is running, it will listen for webhook notifications from Cisco Catalyst Center. When a notification is received, it will be displayed on the dashboard in real-time.
## Use Case
This project can be used to monitor and respond to events from Cisco Catalyst Center in real-time. For example, you can use it to:
- Monitor network changes, such as device additions, deletions, or modifications.
- Monitor network performance and troubleshoot issues in real-time.
- Trigger automated responses to network events, such as sending alerts or notifications.
- Analyze network data and trends over time.
## Security Considerations/Improvements
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
- Use HTTPs to secure webhook communications.
- Validate all incoming requests using a custom authentication token.
## Debugging Tips
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
Check the Flask application logs in the terminal for errors and/or warnings.
## Author(s)
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
This project was written and is maintained by the following individuals:
* Osama Abbas
## Getting involved
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
Contributions are welcome! Please open an issue or submit a pull request with improvements or bug fixes.
## References
**[`^ back to top ^`](#webhook-testing-with-cisco-catalyst-center-aka-dna-center)**
- [Configure a Webhook Destination](https://www.cisco.com/c/en/us/td/docs/cloud-systems-management/network-automation-and-management/dna-center-platform/2-3-7/user-guide/b-dnac-platform-ug-2-3-7/b-dnac-platform-ug-2-3-7-chapter-0101.html#Cisco_Task_in_List_GUI.dita_e24b1b78-ea6e-4aa5-932a-359e04d4122f)
- [Work with Event Notifications](https://www.cisco.com/c/en/us/td/docs/cloud-systems-management/network-automation-and-management/dna-center-platform/2-3-7/user-guide/b-dnac-platform-ug-2-3-7/b-dnac-platform-ug-2-3-7-chapter-0111.html#Cisco_Task_in_List_GUI.dita_ca236611-5a22-4c83-9a65-22d98a28b98e)
- [Get Webhook'd - How to Build your Cisco DNA Center Integration](https://dcl3wxcscqm28.cloudfront.net/8130338649073540/4521856223995780/TECH%2041%20GetWebhooked.pdf)
- [WebSockets and Webhooks - Embed network intelligence into your applications](https://www.ciscolive.com/c/dam/r/ciscolive/emea/docs/2024/pdf/DEVNET-1841.pdf)