Skip to main content

Imports ripe IP ranges from Negistry into Netbox

Project description

Netbox Negistry Importer

Tool to pull data from Negistry (ripe IP ranges) and synchronize it with a Netbox (SOT) as a prefixes.


Install

  1. Clone repository
    • git@gitlab.cesnet.cz:701/done/netbox_negistry_importer.git
  2. Go into the repository
    • cd netbox_network_importer
  3. Create virtualenv
    • python3 -m venv venv
  4. Activate it
    • source venv/bin/activate
  5. Install the tool
    • pip install .
  6. Setup configuration file
    • cp config/.secrets.yaml.sample config/.secrets.yaml
    • cp config/settings.yaml.sample config/settings.yaml

Alternatives

  1. pip install git+ssh://git@gitlab.cesnet.cz/701/done/netbox_negistry_importer.git
    • installs the package
  2. Setup configuration files! (see below)

Pre-requisite

To operate, the Netbox Negistry Importer is dependent on the following items:

  • Access to Netbox API
  • Access to Negistry API
  • Created Custom Field on Netbox
    "results": [
        {
            "display": "Client ID",
            "content_types": [
                "ipam.prefix",
            ],
            "type": {
                "value": "text",
                "label": "Text"
            },
            "object_type": null,
            "data_type": "string",
            "name": "client_id",
            "label": "Client ID",
            "description": "",
            "required": false,
            "filter_logic": {
                "value": "loose",
                "label": "Loose"
            },
            "default": null,
            "weight": 100,
            "validation_minimum": null,
            "validation_maximum": null,
            "validation_regex": "",
            "choices": [],
        },
        {
            "display": "Negistry primary key",
            "content_types": [
                "ipam.prefix"
            ],
            "type": {
                "value": "text",
                "label": "Text"
            },
            "object_type": null,
            "data_type": "string",
            "name": "negistry_primary_key",
            "label": "Negistry primary key",
            "description": "IP range from Negistry",
            "required": false,
            "filter_logic": {
                "value": "loose",
                "label": "Loose"
            },
            "default": null,
            "weight": 100,
            "validation_minimum": null,
            "validation_maximum": null,
            "validation_regex": "",
            "choices": [],
        },
        {
            "display": "Netname",
            "content_types": [
                "ipam.prefix",
            ],
            "type": {
                "value": "text",
                "label": "Text"
            },
            "object_type": null,
            "data_type": "string",
            "name": "netname",
            "label": "Netname",
            "description": "",
            "required": false,
            "filter_logic": {
                "value": "loose",
                "label": "Loose"
            },
            "default": null,
            "weight": 100,
            "validation_minimum": null,
            "validation_maximum": null,
            "validation_regex": "",
            "choices": [],
        }
    ]
  • Created "negistry" tag on Netbox
        {
            "display": "negistry",
            "name": "negistry",
            "slug": "negistry",
            "description": "Negistry Prefix",
        }

Configuration file

The configuration properties must be provided via the configuration files.

Netbox Negistry Importer try to find the configuration file in folders:

  • <PROJECT_ROOT>/config/
  • /etc/netbox_negistry_importer/
  • /home/<user>/.config/netbox_negistry_importer/
  • Or you can set path to configuratin files like:
    • SETTINGS_FILE_FOR_DYNACONF=/some/custom/path/settings.yaml SECRETS_FOR_DYNACONF=/some/another/path/.secrets.yaml import_negistry

# settings.yaml
---
LOGLEVEL: DEBUG
NEGISTRY_URL: <negistry_url>
NETBOX_INSTANCE_URL: <netbox_url>

# .secrets.yaml
---
NETBOX_API_TOKEN: <TOKEN>

Execute

The Netbox Negistry Importer runs only in apply mode.

Apply Mode

Execution:

  • import_negistry # runs the importer

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

netbox_negistry_importer-0.2.0.tar.gz (7.2 kB view details)

Uploaded Source

File details

Details for the file netbox_negistry_importer-0.2.0.tar.gz.

File metadata

  • Download URL: netbox_negistry_importer-0.2.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for netbox_negistry_importer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b0bc49c8438443d9e984a8b1bca4c4affb34e570e73b827323ef8cb9eda289e9
MD5 6662ec4f9f8975082fb8e76554e042f0
BLAKE2b-256 3c941185007afdd685fb5dbdcc03c261ca9f79b60be7afc431bac94bf3295ce0

See more details on using hashes here.

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