Skip to main content

Netbox plugin for Prophetess

Project description

🧙‍♀️ Prophetess Netbox Plugin

Prophetess plugin for loading data into Netbox

🚀 Installation

pip install prophetess-netbox

🔧 Configuration

NetboxLoader takes several required and optional configuration options. The full configuration break down is presented below:

host: 'http://localhost:8000'
api_key: 123key
update_method: update
endpoint: dcim
model: sites
pk:
- slug
- cf_id: "{site}"
fk:
  region:
    endpoint: dcim
    model: regions
    pk:
    - cf_sf_id: "{region}"

Loader

Key Values Description
host string Fully qualified URL to root of Netbox install
api_key string Valid API key for accessing Netbox resources
update_method (update, partial_update) When updating existing records, which method to use. update will send all fields, partial_update will only submit changed values, or skip the update if no values have been updated
endpoint string The root API group to use, eg: dcim, ipam, tenant, etc
model string Which Model of the endpoint to manipulate
pk string or list (pk) How to identify a unique record from endpoint and model. See PK
fk object (fk) Mapping of any record fields that are related to other data models. See FK

PK

PK, Primary Key(s), are a list of strings or dictionaries (objects) on how to check if a record to be loaded exists. When using a dictionary the key is used for lookup against the API and the value is a Python formatted string. This allows for flexibility in mapping parsed record to what Netbox assumes.

For example, given the parsed record of:

{
  'slug': 'nb-slug',
  'region': 'custom-field-lookup',
  'name': 'test',
}

With a PK config of

- slug
- cf_region: '{region}'

The resulting lookup would be: ?slug=nb-slug&cf_region=custom-field-lookup

FK

FK, Forigen Key(s), allow for mapping of string values from an extractor to record ids in netbox. The are a dictionary of record key to a mapping of configuration for lookup. Records can be linked across any endpoint and model within a single Netbox instance.

Given the following record:

{
  'slug': 'nb-slug',
  'region': 'region-slug',
  'name': 'test',
}

When parsed with the following FK configuration:

region:
  endpoint: dcim
  model: regions
  pk:
  - slug

Would produce, assuming there was a region with the slug region-slug that had a record ID of 12:

{
  'slug': 'nb-slug',
  'region': 12,
  'name': 'test',
}

If no FK record is found, None is set instead.

Config

Key Values Description
endpoint string The root API group to use, eg: dcim, ipam, tenant, etc
model string Which Model of the endpoint to manipulate
pk string or list (pk) How to identify a unique record from endpoint and model. See PK

🧰 Development

Please fork this project and create a new branch to submit any changes. While not required, it's highly recommended to first create an issue to propose the change you wish to make. Keep pull requests well scoped to one change / feature.

This project uses tox + pytest to unit test and lint code. Use the following commands to validate your changes aren't breaking:

tox --cov-report term-missing
tox -e lint

🎉 Special Thanks

❤️ Charles Butler
❤️ Erick Daniszewski

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prophetess-netbox-0.2.4.post1.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

prophetess_netbox-0.2.4.post1-py2.py3-none-any.whl (21.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file prophetess-netbox-0.2.4.post1.tar.gz.

File metadata

  • Download URL: prophetess-netbox-0.2.4.post1.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.8

File hashes

Hashes for prophetess-netbox-0.2.4.post1.tar.gz
Algorithm Hash digest
SHA256 acdee0192ef28b81efecc8b6ffdaea60e32c9645dbdac61ab9a9346f705e275e
MD5 a1c0353417980dc993efa35d2aaa7a98
BLAKE2b-256 f5b88dd8dc53105b07eb0ebf4909cc7cf4af0fc312d04176df33a9776f8a9714

See more details on using hashes here.

Provenance

File details

Details for the file prophetess_netbox-0.2.4.post1-py2.py3-none-any.whl.

File metadata

  • Download URL: prophetess_netbox-0.2.4.post1-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.6.8

File hashes

Hashes for prophetess_netbox-0.2.4.post1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2ab93b3b066cf24c5d5a5c52875ebd617793098e605e0cb1e8fd669078b898d4
MD5 9cb77b6f11107a5e8f2e994b02d3c31a
BLAKE2b-256 3c661af770d84a5183796220b9ad76c052271df013d7bd7c1b439f345cfede45

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page