Giter VIP home page Giter VIP logo

dnacenter_webhook_receiver's Introduction

Cisco DNA Center Webhook Receiver

This repo is for a simple Flask application that will receive webhooks notifications. This app is to be used only in demo or lab environments, it is not written for production. Please follow these recommendations for production deployments: https://flask.palletsprojects.com/en/1.1.x/deploying/.

The "flask_receiver.py" will save the notification to a file, and it will not process the notification.

Users my continue the development of this application to parse the received event notification and take the next steps based on their use case.

Cisco Products & Services:

  • Cisco DNA Center

Tools & Frameworks:

  • Python environment to run the Flask App as a Webhook Receiver

Usage

  • Create a new Flask App to receive Cisco DNA Center notifications
  • "flask_receiver.py" - webhook receiver
  • "config.py" - configure your lab environment
  • "test_webhook_receiver" - app to test the webhook receiver without Cisco DNA Center
  • The notifications received will be save to the file "all_webhooks_detailed.log"
  • Start the Flask App
  • Test by browsing to your receiver home page
  • Configure Cisco DNA Center Webhooks to send notifications to your new receiver
  • Trigger events for the configured webhooks
  • Verify the events are received by the webhook receiver
  • Sample Output:
    • from "test_webhook_receiver.py":

      Webhook notification status code: 202

      Webhook notification response: Webhook notification received

    • from "flask_receiver.py":

      WARNING: This is a development server. Do not use it in a production deployment.
         Use a production WSGI server instead.
       * Debug mode: on
       * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
       * Restarting with stat
       * Debugger is active!
       * Debugger PIN: 764-976-195
      127.0.0.1 - - [17/Nov/2020 13:52:42] "POST /webhook HTTP/1.1" 202 -
      Webhook Received
      Payload: 
      {
          "version" : "" , 
          "instanceId" : "ea6e28c5-b7f2-43a4-9937-def73771c5ef" , 
          "eventId" : "NETWORK-NON-FABRIC_WIRED-1-251" , 
          "namespace" : "ASSURANCE" , 
          "name" : "" , 
          "description" : "" , 
          "type" : "NETWORK" , 
          "category" : "ALERT" , 
          "domain" : "Connectivity" , 
          "subDomain" : "Non-Fabric Wired" , 
          "severity" : 1 , 
          "source" : "ndp" , 
          "timestamp" : 1574457834497 , 
          "tags" : "" , 
          "details" : {
              "Type" : "Network Device" , 
              "Assurance Issue Priority" : "P1" , 
              "Assurance Issue Details" : "Interface GigabitEthernet1/0/3 on the following network device is down: Local Node: PDX-M" , 
              "Device" : "10.93.141.17" , 
              "Assurance Issue Name" : "Interface GigabitEthernet1/0/3 is Down on Network Device 10.93.141.17" , 
              "Assurance Issue Category" : "Connectivity" , 
              "Assurance Issue Status" : "active"
          } , 
          "ciscoDnaEventLink" : "https://10.93.141.35/dna/assurance/issueDetails?issueId=ea6e28c5-b7f2-43a4-9937-def73771c5ef" , 
          "note" : "To programmatically get more info see here - https://<ip-address>/dna/platform/app/consumer-portal/developer-toolkit/apis?apiId=8684-39bb-4e89-a6e4" , 
          "tntId" : "" , 
          "context" : "" , 
          "tenantId" : ""
      }

 
 This sample code is for proof of concepts and labs

**License**

This project is licensed to you under the terms of the [Cisco Sample Code License](./LICENSE).

dnacenter_webhook_receiver's People

Contributors

zapodeanu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.