Netconf-Yang-Webex-Teams

Getting operational data on a remote IOS XE device using NETCONF Yang, and posting the output in Webex Teams.

Webex Teams webhooks

A webhook is an HTTP callback, or an HTTP POST, to a specified URL that notifies your app when a particular activity or “event” has occurred in one of your resources on the Webex Teams platform. The benefit of using webhooks is that they allow your application to receive real-time data from Webex Teams, so you can keep up with the state of your resources (i.e. rooms, messages, memberships, etc.).

More information about Webex Teams wehbooks

Getting started

Creating a Virtual env and install the required packages.

Run the commands below to create a virtual environment and activate it. Commands might slightly differ depending of your OS. Commands below are for Unix kernerls.

python -m venv venv
source ./venv/bin/activate

Then, install the required packages

pip install -r requirements.txt

ngrok

If you run the bot directly on your computer, you can use ngrok to make it publicly accessible via a public URL.

Sart ngrok on port 8080.

./ngrok http 8080

Launching the bot

Then, execute the ./core/main.py file.

Capabilities

Capabilities of the bot are listed in the ./core/bot_capabilities.py file.

Webhooks tools

Webex Teams webhooks

A webhook is an HTTP callback, or an HTTP POST, to a specified URL that notifies your app when a particular activity or “event” has occurred in one of your resources on the Webex Teams platform. The benefit of using webhooks is that they allow your application to receive real-time data from Webex Teams, so you can keep up with the state of your resources (i.e. rooms, messages, memberships, etc.).

More information about Webex Teams wehbooks

post_webhooks.py

Post Webhooks for when my bot is mentioned, and when my bot is added to a new room.

  • mentioned will be sent to {URL}/newmessage
  • mentioned will be sent to {URL}/newroom

Usage: python post_webhooks.py [-h] -t TOKEN -u URL

To avoid errors, if the URL giving as a parameter ends with a "/", removes it.

delete_webhooks.py

Deletes all active webhooks for a specific Webex Teams token.

Usage: delete_webhooks.py [-h] -t TOKEN

function.py

Set of functions used by the files in this folder.

Examples

Interfaces configuration data

Listing the interfaces with their configuration data.

Interfaces configuration data

ARP data

Listing the ARP table of the device.

ARP data

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.