Skip to content

Commit

Permalink
Merge pull request #608 from lpconsulting321/slurpit-new
Browse files Browse the repository at this point in the history
Nautobot SSoT: Slurpit
  • Loading branch information
jdrew82 authored Dec 6, 2024
2 parents b31acbb + 3bcec13 commit c14be83
Show file tree
Hide file tree
Showing 42 changed files with 3,884 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/nautobot_ssot/integrations/itential/ @jtdub @nautobot/plugin-ssot
/nautobot_ssot/integrations/meraki/ @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/servicenow/ @glennmatthews @qduk @nautobot/plugin-ssot
/nautobot_ssot/integrations/slurpit/ @lpconsulting321 @pietos @nautobot/plugin-ssot
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ This Nautobot application framework includes the following integrations:
- Itential
- Cisco Meraki
- ServiceNow
- Slurpit

Read more about integrations [here](https://docs.nautobot.com/projects/ssot/en/latest/user/integrations). To enable and configure integrations follow the instructions from [the install guide](https://docs.nautobot.com/projects/ssot/en/latest/admin/install/#integrations-configuration).

Expand Down Expand Up @@ -93,6 +94,7 @@ The SSoT framework includes a number of integrations with external Systems of Re
* Itential
* Cisco Meraki
* ServiceNow
* Slurpit

> Note that the Arista CloudVision integration is currently incompatible with the [Arista Labs](https://labs.arista.com/) environment due to a TLS issue. It has been confirmed to work in on-prem environments previously.
Expand Down
1 change: 1 addition & 0 deletions changes/600.added
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added integration with Slurpit.
3 changes: 3 additions & 0 deletions development/development.env
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,6 @@ IPFABRIC_SSL_VERIFY="True"
IPFABRIC_TIMEOUT=15

NAUTOBOT_SSOT_ENABLE_ITENTIAL="True"

NAUTOBOT_SSOT_ENABLE_SLURPIT="False"
SLURPIT_HOST="https://sandbox.slurpit.io"
1 change: 1 addition & 0 deletions development/nautobot_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
"enable_itential": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_ITENTIAL")),
"enable_meraki": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_MERAKI")),
"enable_servicenow": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_SERVICENOW")),
"enable_slurpit": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_SLURPIT")),
"hide_example_jobs": is_truthy(os.getenv("NAUTOBOT_SSOT_HIDE_EXAMPLE_JOBS")),
"device42_defaults": {
"site_status": "Active",
Expand Down
1 change: 1 addition & 0 deletions docs/admin/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ Set up each integration using the specific guides:
- [Itential](./integrations/itential_setup.md)
- [Cisco Meraki](./integrations/meraki_setup.md)
- [ServiceNow](./integrations/servicenow_setup.md)
- [Slurpit](./integrations/slurpit_setup.md)
1 change: 1 addition & 0 deletions docs/admin/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ This Nautobot app supports the following integrations:
- [Itential](./itential_setup.md)
- [Cisco Meraki](./meraki_setup.md)
- [ServiceNow](./servicenow_setup.md)
- [Slurpit](./slurpit_setup.md)
34 changes: 34 additions & 0 deletions docs/admin/integrations/slurpit_setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Slurpit Integration Setup

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

## Prerequisites

Before configuring the integration, please ensure, that `nautobot-ssot` app was [installed with Slurpit integration extra dependencies](../install.md#install-guide).

```shell
pip install nautobot-ssot[slurpit]
```

## Configuration

Access to your Slurpit instance is defined using the [ExternalIntegration](https://docs.nautobot.com/projects/core/en/stable/user-guide/platform-functionality/externalintegration/) model which allows you to utilize this integration with multiple instances concurrently. Each ExternalIntegration must specify a SecretsGroup that contains Secrets that contain the Slurpit token to authenticate against that instance. You can find Secrets and SecretsGroups available under the Secrets menu.

![Slurpit Token](../../images/slurpit_token.png)

![Slurpit SecretsGroup](../../images/slurpit_secretsgroup.png)

Please note that is it imperative for the SecretsGroup used for Slurpit uses HTTP(S) Access type and Token. Also note that the name of the Secrets or SecretsGroup are irrelevant but are recommended to be relevant to the Slurpit instance in question.

Once the SecretsGroup is created you'll need to create the ExternalIntegration. You'll find this under the Extensibility menu.

![Slurpit ExternalIntegration](../../images/slurpit_externalintegration.png)

Below is an example snippet from `nautobot_config.py` that demonstrates how to enable and configure the Slurpit integration:

```python
PLUGINS_CONFIG = {
"nautobot_ssot": {
"enable_slurpit": is_truthy(os.getenv("NAUTOBOT_SSOT_ENABLE_SLURPIT")),
}
```
Binary file added docs/images/slurpit-detail-view.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-result-view.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_externalintegration.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_secretsgroup.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_token.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/integrations/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ This Nautobot app supports the following integrations:
- [Itential](./itential.md)
- [Cisco Meraki](./meraki.md)
- [ServiceNow](./servicenow.md)
- [Slurpit](./slurpit.md)
42 changes: 42 additions & 0 deletions docs/user/integrations/slurpit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Slurpit SSoT Integration

This integration provides a simple way to synchronize data between [Slurpit](https://slurpit.io/) and [Nautobot](https://github.com/nautobot/nautobot). It support multiple data types, including Devices, Interfaces, and IP Addresses.

It synchronizes the following objects:

| Slurpit | Nautobot |
| ----------------------- | ---------------------------- |
| Sites | Location |
| Devices | Manufacturer |
| Devices | Platform |
| Devices | Device Type |
| Devices | Device |
| Planning (Hardware Info) | Inventory Item |
| Planning (VLANs) | VLAN |
| Planning (Routing Table) | VRF |
| Planning (Routing Table) | Prefix |
| Planning (Interfaces) | Interface |
| Planning (Interfaces) | IP Address |

## Usage

Once the integration is installed and configured, from the Nautobot SSoT Dashboard view (`/plugins/ssot/`), Slurpit will be shown as a Data Source. You can click the **Sync** button to access a form view from which you can run the Slurpit-to-Nautobot synchronization Job. Running the job will redirect you to a Nautobot **Job Result** view, from which you can access the **SSoT Sync Details** view to see detailed information about the outcome of the sync Job.

There are several options available for the sync Job:

- **Dryrun**: If enabled, the sync Job will only report the differences between the source and destination without synchronizing any data.
- **Memory Profiling**: If enabled, the sync Job will collect memory profiling data and include it in the Job Result.
- **Slurpit Instance**: The Slurpit instance to sync data from.
- **Site LocationType**: The Nautobot LocationType to use for imported Sites.
- **IPAM Namespace**: The Namespace to use for all imported IPAM data.
- **Ignore Routing Table Prefixes**: If enabled, the sync Job will not import some routing table prefixes such as `0.0.0.0/0`, `::/0`, `224.0.0.0/4` and more.
- **Sync tagged objects only**: If enabled, the sync Job will only import objects that have been tagged with the `SSoT Synced from Slurpit` tag in Nautobot.
- **Task Queue**: The Task Queue to use for the sync Job.

## Screenshots

![Detail View](../../images/slurpit-detail-view.png)

---

![Results View](../../images/slurpit-result-view.png)
2 changes: 2 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ nav:
- Itential: "user/integrations/itential.md"
- Cisco Meraki: "user/integrations/meraki.md"
- ServiceNow: "user/integrations/servicenow.md"
- Slurpit: "user/integrations/slurpit.md"
- Modeling: "user/modeling.md"
- Performance: "user/performance.md"
- Frequently Asked Questions: "user/faq.md"
Expand All @@ -138,6 +139,7 @@ nav:
- Itential: "admin/integrations/itential_setup.md"
- Cisco Meraki: "admin/integrations/meraki_setup.md"
- ServiceNow: "admin/integrations/servicenow_setup.md"
- Slurpit: "admin/integrations/slurpit_setup.md"
- Upgrade: "admin/upgrade.md"
- Uninstall: "admin/uninstall.md"
- Compatibility Matrix: "admin/compatibility_matrix.md"
Expand Down
1 change: 1 addition & 0 deletions nautobot_ssot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class NautobotSSOTAppConfig(NautobotAppConfig):
"enable_infoblox": False,
"enable_ipfabric": False,
"enable_servicenow": False,
"enable_slurpit": False,
"enable_itential": False,
"hide_example_jobs": True,
"ipfabric_api_token": "",
Expand Down
1 change: 1 addition & 0 deletions nautobot_ssot/integrations/slurpit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Slurpit SSoT."""
11 changes: 11 additions & 0 deletions nautobot_ssot/integrations/slurpit/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Constants used by Slurpit Integration."""

from django.conf import settings

CONFIG = settings.PLUGINS_CONFIG.get("nautobot_ssot", {})

# Required Settings
DEFAULT_DEVICE_ROLE = CONFIG.get("slurpit_default_device_role", "Network Device")
DEFAULT_DEVICE_ROLE_COLOR = CONFIG.get("slurpit_default_device_role_color", "ff0000")
DEFAULT_DEVICE_STATUS = CONFIG.get("slurpit_default_device_status", "Active")
DEFAULT_DEVICE_STATUS_COLOR = CONFIG.get("slurpit_default_device_status_color", "ff0000")
Empty file.
Empty file.
57 changes: 57 additions & 0 deletions nautobot_ssot/integrations/slurpit/diffsync/adapters/nautobot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# pylint: disable=R0801
"""DiffSync adapter for Nautobot."""

from nautobot_ssot.contrib import NautobotAdapter
from nautobot_ssot.integrations.slurpit.diffsync.models import (
DeviceModel,
DeviceTypeModel,
InterfaceModel,
InventoryItemModel,
IPAddressModel,
LocationModel,
ManufacturerModel,
NautobotIPAddressToInterfaceModel,
PlatformModel,
PrefixModel,
RoleModel,
VLANModel,
VRFModel,
)


class NautobotDiffSyncAdapter(NautobotAdapter):
"""DiffSync adapter for Nautobot."""

def _load_objects(self, diffsync_model):
"""Given a diffsync model class, load a list of models from the database and return them. Passing in job kwargs for model filtering."""
parameter_names = self._get_parameter_names(diffsync_model)
for database_object in diffsync_model._get_queryset(data=self.job.kwargs): # pylint: disable=W0212
self._load_single_object(database_object, diffsync_model, parameter_names)

location = LocationModel
manufacturer = ManufacturerModel
device_type = DeviceTypeModel
platform = PlatformModel
role = RoleModel
device = DeviceModel
interface = InterfaceModel
inventory_item = InventoryItemModel
vlan = VLANModel
vrf = VRFModel
prefix = PrefixModel
ipaddress = IPAddressModel
ipassignment = NautobotIPAddressToInterfaceModel
top_level = (
"location",
"manufacturer",
"device_type",
"platform",
"role",
"device",
"vlan",
"vrf",
"prefix",
"ipaddress",
"interface",
"ipassignment",
)
Loading

0 comments on commit c14be83

Please sign in to comment.