Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Slurpit Chatops Commands #349

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- IPFabric
- Cisco Meraki
- Palo Alto Panorama
- Slurpit
- Write a command once and run it on every supported platform, including rich content formatting.
- Extensible - other Nautobot apps can provide additional commands which will be dynamically discovered.
- Automatic generation of basic help menus (accessed via `help`, `/command help`, or `/command sub-command help`).
Expand Down
1 change: 1 addition & 0 deletions changes/347.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added support for Slurpit.io chat commands.
5 changes: 5 additions & 0 deletions development/development.env
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,8 @@ NAUTOBOT_CHATOPS_ENABLE_NSO="False"
# NSO_URL="https://nso.example.com"
# NSO_USERNAME="admin"
# NSO_PASSWORD="admin"

# - Slurpit ------------------------
NAUTOBOT_CHATOPS_ENABLE_SLURPIT="False"
SLURPIT_HOST="https://sandbox.slurpit.io"
SLURPIT_VERIFY="True"
7 changes: 7 additions & 0 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@
"nso_username": os.environ.get("NSO_USERNAME"),
"nso_password": os.environ.get("NSO_PASSWORD"),
"nso_request_timeout": os.environ.get("NSO_REQUEST_TIMEOUT", 60),
# - Slurpit --------------------------
"enable_slurpit": is_truthy(os.getenv("NAUTOBOT_CHATOPS_ENABLE_SLURPIT")),
"slurpit_host": os.environ.get("SLURPIT_HOST"),
"slurpit_token": os.environ.get("SLURPIT_API_TOKEN"),
"slurpit_verify": is_truthy(os.environ.get("SLURPIT_VERIFY", True)),
},
}
if os.getenv("NAUTOBOT_CHATOPS_ENABLE_MATTERMOST", "") != "":
Expand Down Expand Up @@ -229,5 +234,7 @@
PLUGINS_CONFIG["nautobot_chatops"]["enable_panorama"] = is_truthy(os.getenv("NAUTOBOT_CHATOPS_ENABLE_PANORAMA"))
if os.getenv("NAUTOBOT_CHATOPS_ENABLE_NSO", "") != "":
PLUGINS_CONFIG["nautobot_chatops"]["enable_nso"] = is_truthy(os.getenv("NAUTOBOT_CHATOPS_ENABLE_NSO"))
if os.getenv("NAUTOBOT_CHATOPS_ENABLE_SLURPIT", "") != "":
PLUGINS_CONFIG["nautobot_chatops"]["enable_slurpit"] = is_truthy(os.getenv("NAUTOBOT_CHATOPS_ENABLE_SLURPIT"))

METRICS_ENABLED = is_truthy(os.getenv("NAUTOBOT_METRICS_ENABLED"))
1 change: 1 addition & 0 deletions docs/admin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ Set up integrations using the specific guides:
- [Cisco Meraki](./integrations/meraki.md)
- [Cisco NSO](./integrations/nso.md)
- [Palo Alto Panorama](./integrations/panorama.md)
- [Slurpit](./integrations/slurpit.md)
52 changes: 52 additions & 0 deletions docs/admin/integrations/slurpit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Slurpit Integration Setup

This guide will walk you through steps to set up Slurpit integration with the `nautobot_chatops` App.

## Prerequisites

Before configuring the integration, please ensure the following:

- `nautobot-chatops` App was [installed with integration extra dependencies](../install.md#installation-guide).
```shell
pip install nautobot-chatops[slurpit]
```
- `nautobot-chatops` App is set up with at least one [enabled chat platform](../install.md#chat-platforms-configuration) and [tested](./../install.md#test-your-chatbot).

## Command Setup

Create a top-level command named `slurpit` in your enabled chat platform. For detailed instructions related to your specific chat platform, refer to the [platform specific set up](../install.md#chat-platforms-configuration).

## Configuration

You must define the following values in your `nautobot_config.py` file:

| Configuration Setting | Mandatory? | Default | Available on Admin Config |
| --------------------- | ---------- | ------- | ------------------------- |
| `enable_slurpit` | **Yes** | False | Yes |
| `slurpit_host` | **Yes** | | No |
| `slurpit_token` | **Yes** | | No |
| `slurpit_verify` | **Yes** | | No |

Below is an example snippet from `development/nautobot_config.py` that demonstrates how to enable and configure Cisco ACI integration:

```python
PLUGINS = ["nautobot_chatops"]

PLUGINS_CONFIG = {
"nautobot_chatops": {
...
"enable_slurpit": True,
"slurpit_host": os.environ.get("SLURPIT_HOST"),
"slurpit_token": os.environ.get("SLURPIT_API_TOKEN"),
"slurpit_verify": is_truthy(os.environ.get("SLURPIT_VERIFY", True)),
}
}
```

The example configuration is using environment variables. Define these using the following environment variables:

```shell
export SLURPIT_HOST="{{ slurpit Host }}"
export SLURPIT_API_TOKEN="{{ Slurpit API Token }}"
export SLURPIT_VERIFY="{{ True }}"
```
Binary file added docs/images/slurpit-device-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/slurpit-get-device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/slurpit-get-devices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/slurpit-get-plannings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/slurpit-get-sites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/slurpit-help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/slurpit-search-data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/user/app_getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,4 @@ The `nautobot-chatops` package includes multiple integrations. Each integration
- [Cisco Meraki](./integrations/meraki.md)
- [Cisco NSO](./integrations/nso.md)
- [Palo Alto Panorama](./integrations/panorama.md)
- [Slurpit](./integrations/slurpit.md)
35 changes: 35 additions & 0 deletions docs/user/integrations/slurpit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Slurpit Chat Commands

## `/slurpit` Command

Interact with [Slurpit](https://slurpit.io) by utilizing the following sub-commands:

| Command | Arguments | Description |
| ----------------- | ------------------------------------ | --------------------------------------- |
| `get-devices` | | Slurpit inventory device list. |
| `get-device` | `[hostname]` | Slurpit device information. |
| `get-sites` | | Slurpit site list. |
| `get-plannings` | | Configured plannings. |
| `search-data` | `[planning]` `[latest]` `[search]` | Search planning data. |
| `device-data` | `[planning]` `[latest]` `[hostname]` | Get planning data for a given hostname. |


!!! note
All sub-commands are intended to be used with the `/slurpit` prefix.

## Screenshots

![Commands list](../../images/slurpit-help.png)

![Get Devices](../../images/slurpit-get-devices.png)

![Get Device](../../images/slurpit-get-device.png)

![Get Sites](../../images/slurpit-get-sites.png)

![Get Plannings](../../images/slurpit-get-plannings.png)

![Search Data](../../images/slurpit-search-data.png)

![Device Data](../../images/slurpit-device-data.png)

2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ nav:
- "user/integrations/meraki.md"
- "user/integrations/panorama.md"
- "user/integrations/nso.md"
- "user/integrations/slurpit.md"
- Administrator Guide:
- Install and Configure: "admin/install.md"
- Platforms:
Expand All @@ -133,6 +134,7 @@ nav:
- "admin/integrations/meraki.md"
- "admin/integrations/panorama.md"
- "admin/integrations/nso.md"
- "admin/integrations/slurpit.md"
- Upgrade: "admin/upgrade.md"
- Uninstall: "admin/uninstall.md"
- Compatibility Matrix: "admin/compatibility_matrix.md"
Expand Down
5 changes: 5 additions & 0 deletions nautobot_chatops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ class NautobotChatOpsConfig(NautobotAppConfig):
"nso_username": "",
"nso_password": "",
"nso_request_timeout": "",
# - Slurpit --------------------------
"slurpit_host": "",
"slurpit_token": "",
"slurpit_verify": True,
}
constance_config = {
"fallback_chatops_user": ConstanceConfigItem(default="chatbot", help_text="Enable Mattermost Chat Platform."),
Expand Down Expand Up @@ -149,6 +153,7 @@ class NautobotChatOpsConfig(NautobotAppConfig):
default=False, help_text="Enable Panorama Integration.", field_type=bool
),
"enable_nso": ConstanceConfigItem(default=False, help_text="Enable NSO Integration.", field_type=bool),
"enable_slurpit": ConstanceConfigItem(default=False, help_text="Enable Slurpit Integration.", field_type=bool),
}

caching_config = {}
Expand Down
1 change: 1 addition & 0 deletions nautobot_chatops/integrations/slurpit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Base module for Slurpit Integration."""
Loading