When NetBox fires a webhook after a prefix is created, updated, or deleted, RIPE Updater’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jalmargyyk/ripe-updater/llms.txt
Use this file to discover all available pages before exploring further.
/update endpoint orchestrates the entire pipeline — from validating the request to writing the final INETNUM or INET6NUM object into the RIPE database. Understanding this flow helps you configure NetBox correctly, debug unexpected responses, and reason about edge cases like overlapping prefixes.
Processing pipeline
Authorization check
RIPE Updater compares the incoming When
Authorisation header against UPDATE_TOKEN. If they do not match, the request is rejected with HTTP 401.UPDATE_TOKEN is not set, it defaults to None. In that case, request.headers.get('Authorisation') also returns None for requests without the header, so the comparison evaluates to False and all requests pass through. Set UPDATE_TOKEN in your environment to enforce authentication.Configure the matching token in NetBox’s webhook Additional Headers field:Payload validation
RIPE Updater expects a JSON body (
Content-Type: application/json). It validates two things before proceeding:webhook['model']must equal'prefix'— only prefix objects are supported.webhook['data']['custom_fields']['ripe_report']must be present — this custom field drives all routing decisions.
HTTP 400 with a descriptive error message.ripe_report flag routing
The
ripe_report boolean custom field on the NetBox prefix determines what action is taken:ripe_report | NetBox event | Action |
|---|---|---|
false | any | Delete the object from RIPE DB |
true | created or updated | Push (create or update) the object in RIPE DB |
true | deleted | Delete the object from RIPE DB |
ObjectBuilder parses prefix metadata
ObjectBuilder extracts all attributes needed to build the RIPE object from the webhook payload and live NetBox API calls:- prefix — taken directly from
webhook['data']['prefix'] - username — the NetBox user who triggered the webhook (
webhook['username']) - country — resolved by walking the site’s region hierarchy until an ISO 3166-1 alpha-2 country name is found; falls back to
DEFAULT_COUNTRYif the site has no region - org — looked up from the
lir_org.jsonmapping by reading thelircustom field on the parent aggregate in NetBox
RipeObjectManager builds the RIPE object
RipeObjectManager receives the parsed ObjectBuilder and immediately:- Determines the object type:
inet6numfor IPv6,inetnumfor IPv4. - Fetches the existing object from RIPE DB (if any) and saves a backup.
- Reads the
ripe_templatecustom field to select the correct template and base template fromtemplates.json. - Merges dynamic attributes (prefix, netname, org, country) with template-defined and master-template-defined attributes to produce the final object body.
RIPE REST API call
push_object() checks whether the object already exists in RIPE DB and chooses the correct HTTP method:- POST — object does not exist yet (create)
- PUT — object already exists (update)
- DELETE — triggered by
delete_object()whenripe_reportis false or the prefix was deleted in NetBox
RIPE_MNT_PASSWORD for authentication via the password query parameter.Response codes
On success,/update returns HTTP 204 (no content). On any RipeUpdaterException the endpoint returns HTTP 500 with the exception message. Prefixes that are filtered out (too small or non-routable) return HTTP 200 with a short explanatory message — they are intentionally skipped, not treated as errors.
Overlap detection
When aPOST to RIPE DB fails with HTTP 400, RIPE Updater checks whether an overlapping object already exists in the database. This is handled by RipeObjectManager.overlapped_with(), which searches the RIPE REST API for any existing object of the same type that covers the target prefix:
FetchData.authorize_delete_overlapped_candidate). If it does not exist in NetBox, the overlap is considered stale and is automatically deleted from RIPE DB before retrying the original POST. If the overlap exists in NetBox, creation is aborted and the error is included in the email report.
IPv4 vs. IPv6 object types
RIPE Updater maps the two IP families to distinct RIPE DB object types:| Family | RIPE object type | Status |
|---|---|---|
| IPv4 | inetnum | ASSIGNED PA |
| IPv6 | inet6num | ASSIGNED |
192.0.2.0/24) to the legacy range format (192.0.2.0 - 192.0.2.255) required by the RIPE inetnum schema. This conversion is performed by format_cidr():
Prefix size filtering
Prefixes that are too small are silently skipped (HTTP 200, no RIPE DB write). The limits are controlled by two environment variables:| Variable | Default | Meaning |
|---|---|---|
SMALLEST_PREFIX_V4 | 31 | IPv4 prefix lengths greater than this are ignored |
SMALLEST_PREFIX_V6 | 127 | IPv6 prefix lengths greater than this are ignored |
/32 IPv4 host route is ignored, and a /128 IPv6 host route is ignored.
Private and non-routable network filtering
Prefixes that are not publicly routable are also silently skipped. For IPv4, this covers loopback, reserved, private (RFC 1918), and multicast ranges. For IPv6, link-local, loopback, reserved, private, multicast, and any non-global addresses are additionally excluded:Both
ErrorSmallPrefix and NotRoutedNetwork return HTTP 200 — they are expected and handled conditions, not errors.