Skip to main content
Version: V3

Slurp’it adapter

V3 route​

Prepare a configuration package and register it. Then create and review a plan before applying the reviewed plan or running a confirmed sync; Run a sync has the canonical procedure.

What is Slurp’it?​

Slurp’it lets you easily retrieve and store any data you want from your network in an offline, structured database. Out of the box, all major vendors and templates are already pre-configured. Run the installation wizard and Slurp’it will start mining your network. You can add as many templates as you want.

Requirements​

This Adapter uses the Slurp’it SDK, distributed as slurpit-sdk on PyPI. It is available through the optional slurpit extra (slurpit-sdk>=0.9.52,<0.10). The default Sync image installs only service and does not include this SDK. To add it to a custom Sync image, copy the repository Dockerfile and add this command in the build stage after the final uv sync command:

RUN uv pip install --python /opt/infrahub-sync/venv/bin/python \
'ariadne-codegen==0.15.3' 'slurpit-sdk>=0.9.52,<0.10' \
&& uv pip check --python /opt/infrahub-sync/venv/bin/python

The current SDK requires httpx>=0.27,<0.28. The custom image also uses ariadne-codegen==0.15.3 because the default service image's 0.18 release requires httpx 0.28. The default service image keeps httpx 0.28 and real urllib3. The service and slurpit extras are marked as conflicting in uv because uv sync --extra service --extra slurpit cannot preserve the default service resolution.

Sync directions supported​

  • Slurp’it → Infrahub
info

Currently, the Slurp’it adapter supports only one-way synchronization from Slurp’it to Infrahub. Syncing data back into Slurp’it is not yet supported.

Schema​

Our infrahub repository contains an example schema that serves as a starting point for syncing Slurp’it data into Infrahub. This schema follows best practices for Infrahub, but it does not map the Slurp’it data model one-to-one since Infrahub may have additional use cases and Slurp’it can be customizable.

Schemahttps://github.com/opsmill/infrahub/blob/stable/models/examples/slurpit/slurpit.yml

Installing the example schema​

To install the example schema into Infrahub, follow these steps:

mkdir slurpit-sync
cd slurpit-sync
curl -o schema.yml https://raw.githubusercontent.com/opsmill/infrahub/refs/heads/stable/models/examples/slurpit/slurpit.yml
infrahubctl schema load schema.yml

Configuration​

infrahub-sync allows defining what gets synchronized from a source to a destination. The shipped config.yml is a legacy mapping input that matches the example schema; wrap it in a V3 configuration-package envelope before registration.

config.ymlhttps://github.com/opsmill/infrahub-sync/blob/main/examples/slurpit_to_infrahub/config.yml

To download the example config.yml

curl https://raw.githubusercontent.com/opsmill/infrahub-sync/refs/heads/main/examples/slurpit_to_infrahub/config.yml > config.yml

Configuration parameters​

The source.name is set to slurpitsync, instructing infrahub-sync to use the Slurp’it adapter.

The settings dictionary is passed directly to the Slurp’it Python SDK for authentication and connection details. Some of these parameters may be found in the Slurp’it SDK Repository.

Below is a snippet from the example config.yml file:

---
name: from-slurpit
source:
name: slurpitsync
settings:
url: "<URL>"
api_key: "<TOKEN>"
verify_ssl: true # Default value

Schema mapping​

The configuration file allows mapping Slurp’it data to the Infrahub schema, which has been designed to loosely align with the Slurp’it data model. Below is an example showing how to:

  • Set the destination Infrahub model (OrganizationGeneric)
  • Map source data from Slurp’it and run a custom function unique_vendors
  • Specify field mappings between Slurp’it and Infrahub models
schema_mapping:
- name: OrganizationGeneric
mapping: unique_vendors
fields:
- name: name
mapping: brand
- name: type
static: "Vendor"

Schema mapping connects Slurp’it fields to Infrahub's Node attributes and relationships.

Each field can either map directly to a Slurp’it field or be statically defined. This table highlights the available mappings the adapter has to gather and normalize data from Slurp’it

NameDescription
unique_vendorsRetrieves devices through the async SDK and returns each distinct brand.
unique_device_typeRetrieves devices through the async SDK and returns each distinct brand, device type, and operating system combination.
device.get_devices or site.get_sitesRetrieves devices or sites through the SDK. Other dotted SDK methods are rejected so a data load cannot call an SDK write method.
planning_results.<planning_name>Retrieves results for the planning whose SDK slug matches the suffix. For example, planning_results.routing-table uses the planning slug routing-table.
filter_networksThe filter_networks function processes a list of network entries, normalizing the network and mask fields, and filters out unwanted networks based on predefined "ignore" prefixes (such as 0.0.0.0/0 and 127.0.0.0/8). It returns a list of filtered, normalized networks, excluding those with prefixes deemed unnecessary or invalid.
filter_interfacesNormalizes interface IP addresses and matches them against previously loaded network prefixes.

The current SDK has a site.get_sites API, which the example maps to locations.