Skip to main content

Module phpipam

Module phpipam 

Source
Expand description

The phpipam IPAM backend: what phpIPAM associates with an address.

The second inventory, and the one that shows the Ipam seam is not NetBox with extra steps. It answers the same question by a different route, with a different auth scheme, a different response envelope and a different idea of what “no such address” looks like on the wire.

§What phpIPAM is asked

One lookup always happens: GET /api/<app_id>/addresses/search/<client ip>/. What it returns permits names two ways — the address’s hostname (Source::DnsName, the direct analogue of NetBox’s dns_name) and a custom column on it (Source::CustomField).

One more is conditional: Source::Device follows the address’s deviceId to GET /api/<app_id>/devices/<id>/ and reads the same column there. Like NetBox’s, it is a fallback and not a union — a value on the address is the more specific statement.

Source::Vip and Source::Fhrp are refused by name at startup: phpIPAM records no address roles and no redundancy groups, so there is nothing here to read. Ignoring them silently would leave an operator believing a check runs that never runs.

§A 404 is an answer, not a failure

The one place phpIPAM’s wire behaviour differs in a way this code has to know about. NetBox answers an unknown address with 200 and an empty result list; phpIPAM answers 404 with {"code":404,"message":"No addresses found"}. Reading that as a transport failure would turn every request from an unrecorded machine into a retryable 500 instead of the refusal it is — which is why JsonApiError carries the status at all.

§Multi-valued custom fields

A phpIPAM custom field is a plain text column, so several names are written as one comma-separated string and split here. Hardcoded rather than configurable: a comma is not legal in a DNS name, so there is no estate the separator could need to differ for.

Modules§

client
The production PhpIpamApi: phpIPAM’s REST API over HTTP/1.1.

Structs§

PhpIpamAddress
One phpIPAM address object, reduced to what this backend reads.
PhpIpamBackend
Reports which names phpIPAM associates with an address.

Traits§

PhpIpamApi
The phpIPAM queries this backend makes.