-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #608 from lpconsulting321/slurpit-new
Nautobot SSoT: Slurpit
- Loading branch information
Showing
42 changed files
with
3,884 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added integration with Slurpit. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")), | ||
} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Slurpit SSoT.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
57
nautobot_ssot/integrations/slurpit/diffsync/adapters/nautobot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
) |
Oops, something went wrong.