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

Slurpit Support #601

Closed
wants to merge 98 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
b3e7e89
Nautobot SSoT: Slurpit
lpconsulting321 Nov 14, 2024
cef8aae
Update test
lpconsulting321 Nov 14, 2024
c4f814d
small improvements on testing
lpconsulting321 Nov 14, 2024
c54a4fd
Add poetry configuration
lpconsulting321 Nov 15, 2024
4c2fbe7
Add changelog
lpconsulting321 Nov 15, 2024
ecd2c79
Fix ruff formatting
lpconsulting321 Nov 15, 2024
7f1bfd2
fixes: codeowners
lpconsulting321 Nov 15, 2024
9cca34e
Fix pylint issues
lpconsulting321 Nov 15, 2024
ff61a14
Fix unit test
lpconsulting321 Nov 15, 2024
5090947
Add locationtype during test setup
lpconsulting321 Nov 15, 2024
b11e876
Fix pylint issue
lpconsulting321 Nov 15, 2024
c56fd40
Fix 3.8 issues
lpconsulting321 Nov 25, 2024
9c0cd28
update readme
lpconsulting321 Nov 25, 2024
935c8a1
Add typed dicts
Renrut5 Oct 8, 2024
b51427a
Add changelog
Renrut5 Oct 8, 2024
e874fc5
update docs
Renrut5 Oct 29, 2024
03d43e7
fix errors
Renrut5 Oct 29, 2024
f8beda4
fix: 🐛 Fixed missing hostname_mapping functionality in DNA Center int…
jdrew82 Oct 25, 2024
8a99d78
refactor: 🔥 Removed use of OS Version CustomField as it is now covere…
jdrew82 Oct 25, 2024
a32b1ea
feat: ✨ Added support for Software Version model in Nautobot 2.2.
jdrew82 Oct 25, 2024
c3f58fa
fix: 🐛 Add SoftwareImageFile creation and association to DeviceType t…
jdrew82 Oct 25, 2024
e9f9f4e
docs: 📝 Update Job form screenshot
jdrew82 Oct 25, 2024
d9473a9
refactor: ♻️ Redo code for hostname_map to make it unique
jdrew82 Oct 25, 2024
9aea0bb
test: ✅ Fix tests to address changes in DNAC integration
jdrew82 Oct 25, 2024
c6364fc
test: 🚨 Disable warning from pylint
jdrew82 Oct 25, 2024
141308c
refactor: ♻️ Move Meraki skip to happen earlier so it's not in failed…
jdrew82 Oct 28, 2024
b2eef1e
refactor: ♻️ Rename var per comment on PR
jdrew82 Oct 28, 2024
03af999
fix: 🐛 Ensure that Global isn't a parent if the setting is False.
jdrew82 Oct 28, 2024
df8620b
refactor: ♻️ Tweak Meraki detection using errorDescription in case it…
jdrew82 Oct 28, 2024
f85be3b
test: 🐛 Correct fixture parent value to Global.
jdrew82 Oct 28, 2024
0576a11
refactor: ♻️ Redo loading of areas to be done through loading of Buil…
jdrew82 Oct 29, 2024
5f3d8a6
fix: 🐛 Update area attribute on Building model to be Optional.
jdrew82 Oct 29, 2024
378e3a8
test: ✅ Update load_area/buildings tests to account for refactor.
jdrew82 Oct 29, 2024
40ead83
test: ✅ Add tests to validate handling of loading areas and buildings…
jdrew82 Oct 29, 2024
27812e1
fix: 🐛 Add a check that the data being used to update area_parent is …
jdrew82 Oct 29, 2024
37802cb
fix: 🐛 Change how area_parent is updated to check if building name is…
jdrew82 Oct 29, 2024
3169243
test: ✅ Add a test validating using location_map when you have buildi…
jdrew82 Oct 29, 2024
8d24c01
perf: 🧑‍💻 Move some warning log statements behind debug toggle.
jdrew82 Oct 30, 2024
5f2bf85
fix: 🐛 Add check that Area parent is defined before trying to assign.
jdrew82 Oct 30, 2024
794fa5e
fix: 🐛 Add mask_length update to IPAddress.update()
jdrew82 Oct 30, 2024
44ecac7
feat: ✨ Add PrefixLocation DiffSyncModel to track location assignment…
jdrew82 Oct 30, 2024
924ab7d
fix: 🐛 Correct check when using location_map to use network name.
jdrew82 Nov 1, 2024
5cfd10a
feat: ✨ Add ability to rename network if name key found in location_m…
jdrew82 Nov 1, 2024
f83c54c
feat: ✨ Add ability to rename Building in DNA Center with location_map.
jdrew82 Nov 1, 2024
093ac0f
test: ✅ Update Prefix model tests to remove use of Location as it's n…
jdrew82 Nov 1, 2024
5d70041
fix: 🐛 Ensure name key is used.
jdrew82 Nov 1, 2024
cbe8b49
fix: 🐛 Fix name of Building if found in location_map and only load Fl…
jdrew82 Nov 1, 2024
6b395a6
docs: 📝 Update docs for job var.
jdrew82 Nov 1, 2024
55184c6
test: ✅ Fix tests for load_floors()
jdrew82 Nov 1, 2024
de74c81
fix: 🐛 Correct bug where wrong building name was used due to overwrite.
jdrew82 Nov 1, 2024
b0f94a2
fix: 🐛 Fix Nautobot loading wrong Location names for site and floor.
jdrew82 Nov 5, 2024
a68e474
build: 👷 Add missing code owners for DNAC, Meraki, and Itential integ…
jdrew82 Nov 6, 2024
5524bbf
docs: 📝 Add changelog fragment
jdrew82 Nov 6, 2024
a2a0f92
fix: 🐛 Add check for port existing in uplink_settings before loading …
jdrew82 Nov 6, 2024
23ca2f8
fix: 🐛 Fix creation of PrefixLocationAssignment in Meraki.
jdrew82 Nov 6, 2024
057ff8d
fix: 🐛 Correct PrefixLocationAssignment to use location as site_map h…
jdrew82 Nov 6, 2024
1d6524d
fix: 🐛 Change check for location attribute to be done only if locatio…
jdrew82 Nov 7, 2024
bec846c
fix: 🐛 Fix bug in Bootstrap integration from loading ValidatedSoftwar…
jdrew82 Nov 8, 2024
3434ca6
refactor: ♻️ Refactor load_validated_software to not grab SoftwareLCM…
jdrew82 Nov 8, 2024
e904830
fix: 🐛 Check for device_platform attribute on Software and resort to …
jdrew82 Nov 8, 2024
680471a
fix: 🐛 Change getattr to hasattr
jdrew82 Nov 8, 2024
a68a88f
fix: 🐛 Correct identifiers for validated_software
jdrew82 Nov 8, 2024
96dcb26
fix: 🐛 Catch DoesNotExist thrown when attempting to find ContentType …
jdrew82 Nov 8, 2024
7e97a91
feat: ✨ Added support for SoftwareVersion to Bootstrap integration.
jdrew82 Nov 8, 2024
c85d56e
fix: 🐛 Correct logging var
jdrew82 Nov 8, 2024
64bd33a
revert: ⏪️ Restore checks around DLM classes
jdrew82 Nov 8, 2024
01f457d
fix: 🐛 Fix the imports for models to use apps instead of direct impor…
jdrew82 Nov 6, 2024
a320a49
fix conflicts
lpconsulting321 Nov 25, 2024
e284aa0
feat: ✨ Add default settings to project and update dev environment.
jdrew82 Nov 14, 2024
f49039b
refactor: ♻️ Extract parse_hostname_for_role function to SSoT utils t…
jdrew82 Nov 14, 2024
c26981c
fix: 🐛 Add try/except block around import for Controller and CMDG
jdrew82 Nov 14, 2024
db5be5f
fix: 🐛 Update DiffSyncFlags on DNAC integration to disable logging un…
jdrew82 Nov 14, 2024
a019815
feat: ✨ Add Citrix ADM integration
jdrew82 Nov 14, 2024
8c5470b
test: ✅ Add tests for CItrix ADM integration.
jdrew82 Nov 14, 2024
dbbee53
fix: 🐛 Fix missing ContentType bug in use of create_or_update_custom_…
jdrew82 Nov 15, 2024
4869887
docs: 📝 Add documentation for Citrix ADM integration.
jdrew82 Nov 15, 2024
caaa2ab
build:
jdrew82 Nov 15, 2024
fa136be
test: ✅ Adjust tests for migration to SSoT project
jdrew82 Nov 15, 2024
fb64b18
feat: ✨ Add additional information to Job like Citrix logo and Data m…
jdrew82 Nov 15, 2024
0b51b9c
test: 🚨 Ignore pylint warning
jdrew82 Nov 18, 2024
8db8904
test: 🚨 Address complaints from pylint
jdrew82 Nov 18, 2024
1b95773
docs: 📝 Add changelog fragment bout parse_hostname_for_role() change.
jdrew82 Nov 19, 2024
b7cdb0c
conflict
lpconsulting321 Nov 25, 2024
cb113de
Fix infite loop when resolving location parents.
progala Oct 2, 2024
7ab20d7
Replace region reference with parent.
progala Oct 2, 2024
0703fb0
Disable unused job flag.
progala Oct 2, 2024
b599951
Implement SNOW SSOT 'delete_records' flag.
progala Oct 3, 2024
71be453
Add change fragments.
progala Nov 14, 2024
c05d3ac
Fix linting error.
progala Nov 20, 2024
8df8d9e
docs: 📝 Add missing acknowledgements
jdrew82 Nov 20, 2024
7e2e394
build: Add code owner for Citrix integration
jdrew82 Nov 20, 2024
bb3b229
docs: 📝 Add changelog snippets
jdrew82 Nov 20, 2024
06a33cc
fix: 🐛 Fix hostname_mapping option in Citrix ADM integration.
jdrew82 Nov 21, 2024
f37f299
refactor: ♻️ Remove duplicate parse_hostname_for_role() in Meraki int…
jdrew82 Nov 21, 2024
fd71fdc
docs: 📝 Add changelog snippets
jdrew82 Nov 21, 2024
8782719
fix: 🐛 Correct default to be a list.
jdrew82 Nov 21, 2024
dde0c13
conflict
lpconsulting321 Nov 25, 2024
6a9f874
update lock
lpconsulting321 Nov 25, 2024
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 .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/nautobot_ssot/integrations/infoblox/ @qduk @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/ipfabric/ @alhogan @nautobot/plugin-ssot
/nautobot_ssot/integrations/servicenow/ @glennmatthews @qduk @nautobot/plugin-ssot
/nautobot_ssot/integrations/slurpit/ @lpconsulting321 @pietos @nautobot/plugin-ssot
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 @@ -110,3 +110,6 @@ IPFABRIC_SSL_VERIFY="True"
IPFABRIC_TIMEOUT=15

NAUTOBOT_SSOT_ENABLE_ITENTIAL="True"

NAUTOBOT_SSOT_ENABLE_SLURPIT="True"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be False.

Copy link
Contributor

@jdrew82 jdrew82 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lpconsulting321 That is most likely being caused due to your integration being enabled. Making this change should resolve the issue. Itential is the only integration that's left enabled for now as it has tests of the integration's Job that requires the integration be installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<3

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 @@ -229,6 +229,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 @@ -12,3 +12,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 @@ -12,3 +12,4 @@ This Nautobot app supports the following integrations:
- [Itential](./itential.md)
- [Cisco Meraki](./meraki.md)
- [ServiceNow](./servicenow.md)
- [Slurpit](./slurpit.md)
31 changes: 31 additions & 0 deletions docs/user/integrations/slurpit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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) | Prefixe |
| 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.

## 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 @@ -118,6 +118,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 @@ -136,6 +137,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 @@ -105,6 +105,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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# 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,
PlatformModel,
PrefixModel,
RoleModel,
VLANModel,
VRFModel,
)


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

def __init__(self, *args, job, sync=None, data=None, **kwargs):
"""Initialize the NautobotDiffSyncAdapter."""
self.data = data if data is not None else {}
super().__init__(*args, job=job, sync=sync, **kwargs)

def _load_objects(self, diffsync_model):
"""Given a diffsync model class, load a list of models from the database and return them."""
parameter_names = self._get_parameter_names(diffsync_model)
for database_object in diffsync_model._get_queryset(data=self.data): # 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
top_level = (
"location",
"manufacturer",
"device_type",
"platform",
"role",
"device",
"vlan",
"vrf",
"prefix",
"ipaddress",
"interface",
)
Loading
Loading