feat: add IPAddress attribute kind support [INFP-551]
Merged
PH
4mo ago+84+84+01234567890123456789-2-2-0123456789
Summary
Adds SDK support for the new IPAddress attribute kind (bare IP address, no netmask/prefix), alongside the existing IPHost and IPNetwork kinds. Part of the cross-stack work for Infrahub INFP-551 (targets the Infrahub 1.11 cycle).
| Kind | Python mapping | Value type | Stores |
|---|---|---|---|
IPAddress (new) | ipaddress.ip_address | IPv4Address | IPv6Address | bare 192.0.2.1 |
IPHost | ipaddress.ip_interface | IPv4Interface | IPv6Interface | 192.0.2.1/24 |
IPNetwork | ipaddress.ip_network | IPv4Network | IPv6Network | 192.0.2.0/24 |
Changes
protocols_base.py: newIPAddress/IPAddressOptionalattribute types.protocols_generator/constants.py:ATTRIBUTE_KIND_MAPentry.schema/main.py:AttributeKind.IPADDRESS.node/attribute.py+node/constants.py: parse viaipaddress.ip_address; serialize bare addresses withstr()(nowith_prefixlen).protocols_generator/template.j2: import the new types so generated protocols reference them.- Unit tests for input-data serialization and deserialization (async + sync).
Testing
uv run pytest tests/unit/sdk/test_node.pyโ 228 passed.- ruff + mypy clean on changed files.
- Verified end-to-end against a live Infrahub instance built from the matching backend branch:
client.get(...)returns a bareIPv4Address/IPv6Addressfor anIPAddressattribute, whileIPHost/IPNetworkstill return prefixed interface/network objects.
Notes
Base branch is infrahub-develop (the branch the Infrahub develop submodule tracks). The Infrahub-side PR bumps the python_sdk submodule pointer only after this merges.
๐ค Generated with Claude Code
Summary by cubic
Adds SDK support for a new IPAddress attribute kind to store and return bare IPv4/IPv6 addresses without a prefix. This fulfills INFP-551 by enabling schemas to validate and serialize plain IPs without the implicit /32 or /128.
- New Features
- Added
AttributeKind.IPADDRESSand mapping in protocol generator. - Introduced
IPAddressandIPAddressOptionalprotocol types (ipaddress.IPv4Address|IPv6Address). - Parse with
ipaddress.ip_address; serialize as a bare string (no prefix).IPHost/IPNetworkbehavior unchanged. - Updated node attribute parsing and GraphQL payload generation to handle bare IPs.
- Added unit tests for sync/async serialization and deserialization.
- Added