Giter Club home page Giter Club logo

nautobot-app-chatops's Introduction

Nautobot

Nautobot

Nautobot is a Network Source of Truth and Network Automation Platform built as a web application atop the Django Python framework with a PostgreSQL or MySQL database.

Key Use Cases

1. Flexible Source of Truth for Networking - Nautobot core data models are used to define the intended state of network infrastructure enabling it as a Source of Truth. While a baseline set of models are provided (such as IP networks and addresses, devices and racks, circuits and cable, etc.) it is Nautobot's goal to offer maximum data model flexibility. This is enabled through features such as user-defined relationships, custom fields on any model, and data validation that permits users to codify everything from naming standards to having automated tests run before data can be populated into Nautobot.

2. Extensible Data Platform for Automation - Nautobot has a rich feature set to seamlessly integrate with network automation solutions. Nautobot offers GraphQL and native Git integration along with REST APIs and webhooks. Git integration dynamically loads YAML data files as Nautobot config contexts. Nautobot also has an evolving plugin system that enables users to create custom models, APIs, and UI elements. The plugin system is also used to unify and aggregate disparate data sources creating a Single Source of Truth to streamline data management for network automation.

3. Platform for Network Automation Apps - The Nautobot plugin system enables users to create Network Automation Apps. Apps can be as lightweight or robust as needed based on user needs. Using Nautobot for creating custom applications saves up to 70% development time by re-using features such as authentication, permissions, webhooks, GraphQL, change logging, etc. all while having access to the data already stored in Nautobot. Some production ready applications include:

The complete documentation for Nautobot can be found at Read the Docs.

Questions? Comments? Start by perusing our GitHub discussions for the topic you have in mind, or join the #nautobot channel on Network to Code's Slack community!

Build Status

Branch Status
main Build Status
develop Build Status
next Build Status

Screenshots

Gif of main page


Gif of config contexts


Gif of prefix hierarchy


Gif of GraphQL


Gif of Modes

Installation

Please see the documentation for instructions on installing Nautobot.

Application Stack

Below is a simplified overview of the Nautobot application stack for reference:

Application stack diagram

Plugins and Extensibility

Nautobot offers the ability to customize your setup to better align with your direct business needs. It does so through the use of various plugins that have been developed for network automation, and are designed to be used in environments where needed.

There are many plugins available within the Nautobot Apps ecosystem. The below screenshots are an example of some popular ones that are currently available.

Plugin Screenshots

Golden Config Plugin

Gif of golden config

ChatOps Plugin

Gif of chatops

Device Lifecycle Management Plugin

Gif of DLM

Providing Feedback

The best platform for general feedback, assistance, and other discussion is our GitHub discussions. To report a bug or request a specific feature, please open a GitHub issue using the appropriate template.

If you are interested in contributing to the development of Nautobot, please read our contributing guide prior to beginning any work.

Related projects

Please check out the GitHub nautobot topic for a list of relevant community projects.

Notices

Nautobot was initially developed as a fork of NetBox (v2.10.4). NetBox was originally developed by Jeremy Stretch at DigitalOcean and the NetBox Community.

nautobot-app-chatops's People

Contributors

briddo avatar bryanculver avatar chadell avatar cmsirbu avatar dependabot[bot] avatar dgarros avatar dgjustice avatar glennmatthews avatar jathanism avatar jdrew82 avatar jedelman8 avatar jeffkala avatar jjeff07 avatar jvanderaa avatar matt852 avatar mattmiller87 avatar meganerddev avatar nniehoff avatar pke11y avatar progala avatar qduk avatar romanukes avatar sdoiron0330 avatar smk4664 avatar snaselj avatar tanvimoharir avatar tim-fiola avatar ubajze avatar whitej6 avatar zackt25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nautobot-app-chatops's Issues

Docs review

A couple of links to the ChatOps plugin are not working in the README.md file in the section In https://github.com/networktocode-llc/nautobot-plugin-chatops-meraki/blob/develop/README.md#command-setup

  1. The hyperlink in Add a slash command to Slack called /meraki. See the nautobot-chatops installation guide for instructions on adding a slash command to your Slack channel. for the nautobot-chatops installation guide is https://github.com/nautobot/nautobot-plugin-chatops/blob/develop/docs/chat_setup.md. This URL is not found. I think the file name changed.

  2. Same thing as above with linked URL in same section in the sentence You may need to adjust your Access Grants in Nautobot depending on your security requirements.. The hyperlink for Access Grants in Nautobot is https://github.com/nautobot/nautobot-plugin-chatops/blob/develop/docs/chat_setup.md#grant-access-to-the-chatbot, which leads nowhere.

Allow for optional dialog box inputs

Environment

  • Nautobot version: 1.0.2
  • nautobot-plugin-chatops version: 1.4.0

Proposed Functionality

When creating new chatops plugins or commands, allow an input from a dialog box to be optional.

Use Case

I want to create a ChatOps command to trace a path between two IP addresses, where the Ports and Protocols are optional. If provided, additional firewall checks are ran.

Upgrade the Slack SDK

slackclient is marked as legacy.
Add support for https://slack.dev/python-slack-sdk/

Environment

  • Python version:
  • Nautobot version:
  • nautobot-plugin-chatops version:

Steps to Reproduce

Expected Behavior

Observed Behavior

Docs - Incorrect variable name referenced

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

In the chat setup instruction docs, the Webex Teams access token is incorrectly referred to as webex_teams_access_token. The code base uses the variable name webex_teams_token consistently throughout the rest of the plugin.

This is also the case in one other location in one specific file: nautobot_chatops/api/views/webex_teams.py, line 31.

Steps to Reproduce

n/a

Expected Behavior

n/a

Observed Behavior

n/a

Package vs plugin version mismatch

Steps to Reproduce

Compare plugin and package version as follows:

nautobot@USOHWCPINNAF9-nafnautobotworker:~$ pip freeze | grep chatops
nautobot-chatops @ file:///root/.cache/pypoetry/artifacts/99/44/0a/66fddb1188ebbda44819246bad15744dc7a6c2ca5475cd3a3321e3238f/nautobot_chatops-1.4.0-py3-none-any.whl

via plugin's endpoint (api/plugins/installed-plugins/):

    {
        "name": "Nautobot ChatOps",
        "package": "nautobot_chatops",
        "author": "Network to Code",
        "author_email": "[email protected]",
        "description": "A plugin providing chatops capabilities.",
        "verison": "1.1.0",
        "version": "1.1.0"
    },

Expected Behavior

Plugin has the same version as the package.

Observed Behavior

Plugin has different version than the package

Microsoft Teams - No list returned with too large an output

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.1.0

Steps to Reproduce

  1. Have over 200 devices in one site in the Nautobot DB
  2. In Webex teams, run the "get-devices" command for that category
  3. For device filter, select "Site"
  4. Select the site with over 200 devices in it

Expected Behavior

For get-devices, I expected the bot to return all devices in the site.

Observed Behavior

The Bot responds with the initial response of:

Hey <user>, here is that device list you requested.

Shortcut: "nautobot get-devices site <site-name>"

Filter type |   | site
-- | -- | --
Filter value |   | <site-name>

However it does not reply with any devices afterwards. Normally with a site with a lesser amount of devices, it will list out all of the devices and relevant info.

I do not know if this bug starts at 200 devices specifically, but it might be less.

Documentation: Document available Dispatcher commands

Proposed Functionality

As a Chatops Developer, I would like to know what dispatcher functions are available for building chatops commands.

Use Case

It would be nice to have a reference page of the available dispatcher functions are available for building chat commands.

Update Logo

Environment

  • Nautobot version: 1.0b4
  • nautobot-plugin-chatops version: 1.1.0

Proposed Functionality

Please update the nautobot logo in this repo to be the square logo from the public slack channel.

Use Case

Migrate to Celery Worker

Environment

  • Nautobot version: 1.1.0
  • nautobot-plugin-chatops version: 1.x

Proposed Functionality

The Chatops plugin should use Celery workers in Nautobot 1.1

Use Case

RQ is being deprecated

Cleanup Pylint Messages

Proposed Functionality

Currently we have most of the pylint settings ignored, we should fix what we can and ignore specific issues in the individual files and not globally.

Use Case

New Developed code would standout when an exception was made or when it is not following pylint.

Doc Update: Slack need to invite the bot into the channel

Environment

  • Python version: n/a
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.0

Steps to Reproduce

  1. Followed setup instructions
  2. Troubleshot error with the bot
  3. Found that the bot needed to be invited in

Expected Behavior

Would expect that this would be in the documentation

Observed Behavior

The bot was not fully usable with the docs as is

Unable to issue command line: `/nautobot get-interface-connections Region`

Environment

  • Python version: N/A
  • Nautobot version: N/A
  • nautobot-plugin-chatops version: 1.4.1

Steps to Reproduce

  1. Start chat bot
  2. Issue command /nautobot get-interface-connections Region to match the text in the drop down of a previous execution
  3. Receive error

Expected Behavior

I expected to type the word "Region" as displayed by the filter drop downs.

Observed Behavior

Received "I don't know how to filter by Region". This is likely due to the use of a slug where it should be lower case region.

Webex Documentation

Environment

  • Python version: 3.9.1
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

Webex Installation instructions shows unclear target url.

targetUrl: "https:///api/plugins/chatops/webex_teams/"

Should probably be:
targetUrl: "https://{nautobot_server}/api/plugins/chatops/webex_teams/"

Slack won't display more than 100 items in a dropdown list at a time

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

Steps to Reproduce

  1. Have over 100 devices in the nautobot database
  2. In Slack, run the command "/nautobot get-device-facts"

Expected Behavior

The dropdown menu where the user can select a device should include all devices in the database.

Observed Behavior

A warning message is displayed with the following message:

Then the dropdown menu is presented, allowing me to select a device, but only 100 devices are listed. It appears I can manually specify a device by running /nautobot get-device-facts <device-name>.

More than 100 options are available. Slack limits us to only displaying 100 options at a time.

Also note this same behavior occurs whereever a dropdown menu is used and more than 100 options are available. For example, if you have more than 100 circuits assigned to a site, then run /nautobot get-circuits and filter by that site, the same issue occurs.

Mattermost multiple interactions failing

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

There is a bug if you run commands that require the user to select from a menu, then select something else from a second returned menu, the 2nd menu doesn't appear and the command flow simply stops. An example is the command "get-devices", where you first select from the "menu", then select the device from the filtered list.

Steps to Reproduce

  1. In Mattermost, run command "/nautobot get-devices"
  2. In the "Select a device filter" menu, select "Site" (or really any option other than "Name")

Expected Behavior

A second menu select box should appear asking you to select a site.

Observed Behavior

Nothing happens. Nothing is returned and the workflow is abandoned.

On the web server, it appears the first menu is triggered via the URL ending with /slash_command/, but the second menu is triggered via /interaction/ and consistently throws a 404 error.

[11/Mar/2021 18:17:25] "POST /api/plugins/chatops/mattermost/slash_command/ HTTP/1.1" 200 0
[11/Mar/2021 18:17:30] "POST /api/plugins/nautobot/mattermost/interaction/ HTTP/1.1" 404 7174

Allow interaction with Nautobot in threads

Environment

  • Nautobot version: 1.1.0
  • nautobot-plugin-chatops version: 1.3.1

Proposed Functionality

Slack provides threads for conversations, it would be cool to interact with nautobot in a slack thread

Use Case

When troubleshooting an issue, Alert manager fires an alert in a slack channel. The team then uses the thread from the channel to communicate about this issue and provide additional links, logs, etc for the issue. It would be nice to have some context from Nautobot in this thread. For now it would be cool if the team could interact with Nautobot in this thread, however I could also see some automation if an alert for a specific interface fires automatically respond in the thread with device/interface information from Nautobot.

Add API for Command Tokens

Environment

  • Nautobot version: 1.0.1
  • nautobot-plugin-chatops version: 1.3.0

Proposed Functionality

CommandTokens were added in to support Multiple commands in Mattermost. At the time this was implemented, an API was not added.

Use Case

With the extensibility of Nautobot-plugin-chatops, a user may need add multiple commands for Mattermost. This allows for easy management of the tokens required for the Mattermost integration.

Support Multiple Environments

Environment

  • Nautobot version: 1.0.1
  • nautobot-plugin-chatops version: 1.2.0

Proposed Functionality

Capability to have multiple instances of the chat environment to work with the single bot.

Slack instance 1 --
Nautobot Chatops Plugin
Slack instance 2 --/

Use Case

The ability to have dev and production instances of chat to be used with a single instance of Nautobot Chatops Plugin

explicit app_label and isn't in an application in INSTALLED_APPS

Environment

  • Python version:
  • Nautobot version:
  • nautobot-plugin-chatops version:

Steps to Reproduce

  1. Install the plugin pip install nautobot-chatops
  2. Add the plugin to nautobot_config.py
  3. `# In your nautobot_config.py
    PLUGINS = ["nautobot_chatops"]

PLUGINS_CONFIG = {
"nautobot_chatops": {
# ADD YOUR SETTINGS HERE
}
}`
4. Follow instruction on how to setup chat platform of you choice (Webex, Slack, Etc...)

Expected Behavior

I was expecting for the chatbot to respond with available sub-commands but nothing is returned.

Observed Behavior

Traceback (most recent call last):
File "/opt/nautobot/lib/python3.6/site-packages/rq/worker.py", line 975, in perform_job
rv = job.perform()
File "/opt/nautobot/lib/python3.6/site-packages/rq/job.py", line 696, in perform
self._result = self._execute()
File "/opt/nautobot/lib/python3.6/site-packages/rq/job.py", line 719, in _execute
return self.func(*self.args, **self.kwargs)
File "/opt/nautobot/lib/python3.6/site-packages/rq/job.py", line 212, in func
return import_attribute(self.func_name)
File "/opt/nautobot/lib/python3.6/site-packages/rq/utils.py", line 129, in import_attribute
module = importlib.import_module(module_name)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 941, in _find_and_load_unlocked
File "", line 219, in _call_with_frames_removed
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "/opt/nautobot/lib/python3.6/site-packages/nautobot_chatops/workers/init.py", line 17, in
from nautobot_chatops.models import CommandLog
File "/opt/nautobot/lib/python3.6/site-packages/nautobot_chatops/models.py", line 14, in
class CommandLog(BaseModel):
File "/opt/nautobot/lib/python3.6/site-packages/django/db/models/base.py", line 116, in new
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class nautobot_chatops.models.CommandLog doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

Unpin Cryptography

Environment

  • nautobot-plugin-chatops version: 1.3.0

Proposed Functionality

Unpin specific version, go to a less specific version requirement for cryptography, to version 3.x.x

Use Case

Allow for the updating of cryptography

Clarify nomenclature of `access_grants`

Environment

  • Python version: 3.8.10
  • Nautobot version: 1.1.2
  • nautobot-chatops version: 1.5.0

Steps to Reproduce

  1. Read the documentation on this page - https://github.com/nautobot/nautobot-plugin-chatops/blob/develop/docs/chat_setup/chat_setup.md#grant-access-to-the-chatbot
  2. Attempt to create some access grants for Cisco Webex Teams

Expected Behavior

I expected to glean from the documentation on how to set this up using Webex Teams constructs.

For example, Webex uses the term room instead of the Slack specific term channel. I'd suggest perhaps having a translation table which shows the correlation between the different nomenclature.

Observed Behavior

Not applicable.

Migrate to nautobot-chatops.workers to avoid confusion

Environment

  • Python version: 3.7.9
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

Request

To avoid ambiguity with the Nautobot product, we should move the registration from nautobot.workers to nautobot-chatops.workers.

Error filtering interface connections by region

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

There is an error across all supported chatops platforms if you try to filter by region for the command /nautobot get-interface-connections, but no regions are configured in Nautobot. This also occurs if regions are configured, but no sites are assigned a region.

NOTE: If a region is configured, and a site is assigned to a region, this bug does not trigger even if there are no interfaces connections in that region.

Each chatops program gives different responses:

  • MS Teams - untested
  • Mattermost - Nothing happens
  • Webex Teams - this message appears:

If you're seeing this message, something went wrong

  • Slack - this message appears:
Sorry <user>, an error occurred :sob:
The request to the Slack API failed.
The server responded with: {'ok': False, 'error': 'internal_error'}

Steps to Reproduce

  1. Either way will trigger the bug here:
    1a. In Nautobot, verify no regions are configured
    1b. In Nautobot, verify no sites are assigned to any configured regions (regions can still be configured to trigger this bug)
  2. In any chatops program, run command /nautobot get-interface-connections
  3. In the initial filter box labeled "Select an interface connection filter", select "Region"

Expected Behavior

A message or similar stating no regions are available to filter by
OR
Region to not even be a filterable option

Observed Behavior

A workflow crash occurs, with some platforms responding with an error message, and others do not (see above for platform specific details)

Expose a method to send unrequested IM

Environment

Nautobot version: 1.0.0
nautobot-plugin-chatops version: 1.1.0

Proposed Functionality

Even Chatops is designed for user interaction today, I believe that having the necessary credentials to interact with the different IM systems, it would make sense to expose a method such as send_message that would be able to send an unrequested message to a specific group.

Use Case

This feature could be used from other plugins to send custom notifications to IM groups in order to notify when an event happens.

Error filtering interface connections by site

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

When running /nautobot get-interface-connections and filtering by "Site", the following error occurs:
:warning: I don't know how to filter by site :warning:

Steps to Reproduce

  1. Run /nautobot get-interface-connections
  2. Select "Site" to filter by

Expected Behavior

A list of sites to appear to filter by

Observed Behavior

The following error message occurs and the workflow is terminated:
:warning: I don't know how to filter by site :warning:

Dynamically determine a users timezone using upstream chat client info.

Proposed Functionality

I think this is something we could expose from the nautobot_chatops dispatcher methods for the platforms that support it.

I'm thinking the logic would be something like:

  1. If a timezone is passed in as a chat command argument, use this timezone.
  2. If the upstream chat platform supports a method that determines the user timezone use this timezone.
  3. Finally, if either of those are undetermined, use the default timezone in the config file.

Doc Update: Add how to debug

Environment

  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.0

Proposed Functionality

Show how to setup debugs to True with a logging mechanism to help provide more detailed feedback as to what is occurring error wise.

Use Case

Helpful tips to end users on getting started

Mattermost dispatcher prompt_for_text flaky

Environment

  • Python version: 3.7
  • Nautobot version: 1.0.3
  • nautobot-plugin-chatops version: 1.3.1

Steps to Reproduce

  1. Have a command workflow with two or more dispatcher.prompt_for_text calls
  2. Run against a local mattermost instance
  3. invoke the command a few times in mattermost, such that the prompts take place

Expected Behavior

The prompts take place, in the order expected

Observed Behavior

I am seeing the prompt_for_text command fail intermittently, even on the first command, almost certainly on two prompts in a row. I see this in mattermost:

Malformatted requests: {"id":"interactive_message.decode_trigger_id.missing_data","message":"Trigger ID missing required data for interactive dialog.","detailed_error":"","request_id":"kyhrzqod4iynfd64kxn5sdwc3o","status_code":400}

And this in mattermost's docker logs:

{"level":"debug","ts":1626965190.1836636,"caller":"mlog/log.go:230","msg":"Trigger ID missing required data for interactive dialog.","path":"/api/v4/actions/dialogs/open","request_id":"kyhrzqod4iynfd64kxn5sdwc3o","ip_addr":"172.17.0.1","user_id":"s3fucxrozfdadfspy98ym8jdxe","method":"POST","err_where":"DecodeAndVerifyTriggerId","http_code":400,"err_details":""}

Intermittent, but reliably intermittent, if that makes sense. I do not see the same behaviour in the dispatcher for slack.

MS Teams Bold Text - Needs an Updated Format

Environment

  • Python version: 3.9
  • Nautobot version: 1.1.2
  • nautobot-plugin-chatops version: 1.5.1

Steps to Reproduce

  1. Create a bolded text
  2. Send to MS Teams

Expected Behavior

Bolded Text

Observed Behavior

Additional output including *

Create Allow All WildCard Permissions Button

Proposed Functionality

Would like to see a button on the top right of access grants to have the default allow all configuration items added to the DB

Use Case

Simplify the use of setup for those that wish to allow all.

Doc Updates needed

Doc Updates based on review

  • Add link on install docs to ngrok.io
  • Update Slack to include the requesting page information (screen shot)
  • Add optional to step to customize bot

Command with 2 args both requiring quotes fail if both sets of quotes use double quotes.

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.2
  • nautobot-plugin-chatops version: 1.3.0

Steps to Reproduce

  1. Have two args for a command. Example /meraki get-switchports [org-name] [device-name]
  2. Both the args have spaces in them which now require the use of quotes around the arg names. Command example /meraki get-camera-recent “Aspire Technology Partners, LLC.” "MV12 Staging Lab Cam1"
  3. Use double quotes around both arg names.

Expected Behavior

The command runs as expected.

Observed Behavior

Immediately the command fails with error.
==> /var/log/nautobot/nautobot.log <==
2021-05-27 16:53:15 ERROR No closing quotation

/meraki get-camera-recent "Aspire Technology Partners, LLC." 'MV12 Staging Lab Cam1' works
/meraki get-camera-recent "Aspire Technology Partners, LLC." "MV12 Staging Lab Cam1" doesn’t work
/meraki get-camera-recent 'Aspire Technology Partners, LLC.' 'MV12 Staging Lab Cam1' also works.

Appears to be an issue with parse_command_string function.

Mattermost menu cancel button processes as 401

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

In Mattermost, if you run any command that prompts you with a menu selection, for example to either to select a value or a filter, but you click the cancel button instead, there is no error displayed to the user but the backend Django server processes it as a 401 error.

[12/Mar/2021 15:26:46] "POST /api/plugins/chatops/mattermost/interaction/ HTTP/1.1" 401 0

Other selections are processed correctly.
This action in other chat ops programs are processed correctly when the cancel button is clicked.

Slack example:
[12/Mar/2021 15:32:12] "POST /api/plugins/chatops/slack/interaction/ HTTP/1.1" 200 0

Steps to Reproduce

  1. In Mattermost, run the command /nautobot get-devices (or any command that prompts with a menu selection box)
  2. Click "Cancel"
  3. Observe Django logs on backend Nautobot server

Expected Behavior

The server to process the request as a 200 OK.

Observed Behavior

The server processes the request as a 401. In Ngrok, the HTTP request shows as:

POST /api/plugins/chatops/mattermost/interaction/ 401 Missing Command Token

update chat shortcuts to have names vs. UUIDs

Environment

  • Public Sandbox and using #nautobot-chat in Slack

Steps to Reproduce

  1. Use /nautobot get-rack

Expected Behavior

Have a shortcut with the rack name.

Observed Behavior

Shortcut has UUID.

image

Update Installation Docs

Environment

  • Python version: 3.8.6
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.0

Steps to Reproduce

  1. Run through the installation docs

Expected Behavior

Installation successful

Observed Behavior

Slight modification of the docs were needed

Dependencies out of date

Environment

  • Python version: 3.6.10
  • Nautobot version: 1.0.1
  • nautobot-plugin-chatops version: 1.2.0

When adding "social-auth-core[openidconnect]" per the Nautobot documentation to enable OIDC SSO authentication I ran into a dependency problem showing this plugin needs to have it's dependencies updated:

poetry add 'social-auth-core[openidconnect]'
Using version ^4.1.0 for social-auth-core
Updating dependencies
Resolving dependencies... (1.0s)
  SolverProblemError
  Because no versions of social-auth-core match >4.1.0,<5.0.0
   and social-auth-core (4.1.0) depends on PyJWT (>=2.0.0), social-auth-core (>=4.1.0,<5.0.0) requires PyJWT (>=2.0.0).
  Because pyjwt (1.7.1) depends on pyjwt (1.7.1)
   and no versions of pyjwt match >1.7.1,<2.0.0, pyjwt (>=1.7.1,<2.0.0) requires pyjwt (1.7.1).
  Thus, social-auth-core (>=4.1.0,<5.0.0) is incompatible with pyjwt (>=1.7.1,<2.0.0).
  And because nautobot-chatops (1.2.0) depends on pyjwt (>=1.7.1,<2.0.0)
   and no versions of nautobot-chatops match >1.2.0,<2.0.0, social-auth-core (>=4.1.0,<5.0.0) is incompatible with nautobot-chatops (>=1.2.0,<2.0.0).
  So, because nautobot-project depends on both nautobot-chatops (^1.2.0) and social-auth-core (^4.1.0), version solving failed.
  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│ 
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

Steps to Reproduce

  1. Add both the chatops plugin and social auth opened packages

Expected Behavior

SSO Auth should work as documented

Observed Behavior

Unable to install SSO and chatops plugin

Add Panels to device views

consider how we might add a panel from Grafana and/or a link to a dashboard on a view from Nautobot site/device/etc

Mattermost dialog box doesn't auto-appear on interaction calls

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

In Mattermost, when I run the command /nautobot get-devices command, and select "Name" from the Select a Device Filter selection menu, no dialog box appears.

Steps to Reproduce

  1. In Mattermost, run the command /nautobot get-devices
  2. In the Select a Device Filter menu, select "Name"

Expected Behavior

A dialog box to appear, allowing me to type in the device name.

Observed Behavior

I got a private message from the bot saying "If the dialog does not appear, copy this command and resend: /nautobot get-devices name"

Nothing else appeared after that. However if I run that exact command listed, /nautobot get-devices name, a dialog box properly appears and I'm able to pull up a device.

No ordering when filtering device connections

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

When running /nautobot get-device-connections and filtering by any of the below, the choices are returned in a random order. They should have some ordering to them.

  • Device
  • Site
  • Role
  • Region
  • Model

Steps to Reproduce

  1. Run /nautobot get-device-connections
  2. Select "Model" (or any one of the above filters)
  3. Observe returned choices to select

Expected Behavior

All returned choices should be ordered.

Observed Behavior

Return choices are unordered.

Automatically fix markdown links for slack

Normal links in markdown are written like this an example i.e. [an example](http://example.com).

However, Slack, for whatever reason, formats links like <http://example.com|an example>. It would be nice if the dispatcher.send_markdown implementation for Slack automatically converted normal markdown link syntax into Slack syntax, so users could just write normal link syntax.

Bonus points for other dispatchers to notice other syntax and convert to whatever "native" syntax is!

Mattermost Development Guide

Environment

  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.0

Proposed Functionality

Would love to get docs on using Mattermost container for development within Mattermost

Use Case

Help to develop Mattermost integrations. Since Mattermost does have a container/local installation possible. It would be good to get a guide together on how to do that.

Expose a session Chatops context to improve user experience

Proposed Functionality

From the Chatops point of view, that could server multiple IM integrations, it would be interesting to offer a context that could be used to provide per user helper information. The dispatcher one it's dependent on the IM platform and this one should be shared across multiple IM integrations.

For instance, defining a specific time reference to run all the commands against.

We have used it in one Chatops implementation with this simple code:

"""Functions for caching per-user context."""
import hashlib
from django.core.cache import cache
from . import MyChatops

def _get_cache_key(user: str) -> str:
    """Key generator for the cache, adding the plugin prefix name."""
    key_string = "-".join([MyChatops.name, user])
    return hashlib.md5(key_string.encode("utf-8")).hexdigest()  # nosec

def get_context(user: str) -> dict:
    """Return context stored for user."""
    return cache.get(_get_cache_key(user)) or {}

def set_context(user: str, updated_context: dict) -> dict:
    """Update user context."""
    context = get_context(user)
    cache.set(_get_cache_key(user), {**context, **updated_context}, timeout=86400)

Use Case

Offering a Chatops context would facilitate that each user would customize his experience against multiple IM, and would simplify a lot of commands using this context, because parameters can be reused.

Another example could be when you run debugging against one device, setting the device first, and then just run commands that will now via the context which is the target device.

Obviously, we should expose commands to get and set this context as needed.

get-rack command output is unordered

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

The site menu selection displayed for filtering, when runningr the command get-rack, is unordered, and all filter choices appear randomly. This should be fixed to return all results in an ordered manner, similar to all other commands with selection menus.

Steps to Reproduce

  1. Create multiple sites in Nautobot
  2. Create multiple racks in multiple sites in Nautobot
  3. Run command /nautobot get-rack

Expected Behavior

All sites returned in the "Select a Site" filter selection box should be ordered.

Observed Behavior

All sites returned in the "Select a Site" filter selection box appear randomized in no particular order.

Restructure unittests for dispatchers

Environment

  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

Proposed Functionality

In writing up unittests for the Slack dispatcher, I discovered that all 4 dispatcher unittest files (Slack, MS Teams, Webex Teams, and Mattermost) leverage the same base class for all 4 tests. However this runs into issues when attempting to write tests that do not apply to every platform, every time.

This can happen for a variety of reasons in the way each platform processes things differently.

Use Case

This use case resulted from Slack being the only chatops platform that limits selection menu choices to 100 or less. I believe by splitting these into separate files, this will enable easier platform-specific unit tests in the future.

Webex Teams: Error with too large an output

Environment

  • Python version: 3.8.5
  • Nautobot version: 1.0.0b2
  • nautobot-plugin-chatops version: 1.0.1

Steps to Reproduce

  1. Have over 200 devices in one site in the Nautobot DB
  2. In Webex teams, run the "get-devices" command for that category
  3. For device filter, select "Site"
  4. Select the site with over 200 devices in it

Expected Behavior

For get-devices, I expected the bot to return all devices in the site.

Observed Behavior

Webex (not nautobot) returned an error, presumably because nautobot successfully generated the list of devices, but it was too large for Webex to handle. The error is:

An internal error occurred: [400] Bad Request - Unable to post message to room: Message length limited to 7439 characters before encryption and 10000 characters after encryption. [Tracking ID: ROUTER_604A552B-AD26-01BB-03BA-AC12FB2803BA]

The Tracking ID changes each time.

Also note this exact same error occurs for similar commands. For example, if you have too many circuits at one site, and run the "get-circuits" command, and filter by "All (no filter)"

Rename Webex Teams -> Webex

Environment

  • Python version: N/A
  • Nautobot version: N/A
  • nautobot-plugin-chatops version: 1.0.0

Expected Behavior

Observed Behavior

Webex Teams has been renamed to just Webex. This may help the messaging to rename webex_teams work to just webex where applicable.

Support MySQL

Environment

Proposed Functionality

Currently, Nautobot-plugin-chatops uses django.contrib.postgres.fields.ArrayField which is not compatible with MySQL Backed Database Engines. I propose we convert this field to nautobot.utilities.fields.JSONArrayField.

Use Case

Now that Nautobot supports MySQL, we should support MySQL as well to maintain compatibility.

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.