feat: add IPAddress attribute kind support [INFP-551]#1190
Merged
Conversation
Support the new bare-IP `IPAddress` attribute kind alongside IPHost/IPNetwork: - IPAddress/IPAddressOptional protocol types (IPv4Address | IPv6Address) - ATTRIBUTE_KIND_MAP + AttributeKind enum entries - parse via ipaddress.ip_address; serialize bare addresses with str() (no prefix) - import the new types in the protocols generator template - unit tests for input-data serialization and deserialization Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deploying infrahub-sdk-python with
|
| Latest commit: |
7997dd3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d11c48be.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://ipaddress-attribute-kind-inf.infrahub-sdk-python.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## infrahub-develop #1190 +/- ##
====================================================
+ Coverage 83.03% 83.12% +0.08%
====================================================
Files 139 139
Lines 12365 12413 +48
Branches 1846 1851 +5
====================================================
+ Hits 10267 10318 +51
+ Misses 1531 1528 -3
Partials 567 567
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
dgarros
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds SDK support for the new
IPAddressattribute kind (bare IP address, no netmask/prefix), alongside the existingIPHostandIPNetworkkinds. Part of the cross-stack work for Infrahub INFP-551 (targets the Infrahub 1.11 cycle).IPAddress(new)ipaddress.ip_addressIPv4Address | IPv6Address192.0.2.1IPHostipaddress.ip_interfaceIPv4Interface | IPv6Interface192.0.2.1/24IPNetworkipaddress.ip_networkIPv4Network | IPv6Network192.0.2.0/24Changes
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.Testing
uv run pytest tests/unit/sdk/test_node.py— 228 passed.client.get(...)returns a bareIPv4Address/IPv6Addressfor anIPAddressattribute, whileIPHost/IPNetworkstill return prefixed interface/network objects.Notes
Base branch is
infrahub-develop(the branch the Infrahubdevelopsubmodule tracks). The Infrahub-side PR bumps thepython_sdksubmodule 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.
AttributeKind.IPADDRESSand mapping in protocol generator.IPAddressandIPAddressOptionalprotocol types (ipaddress.IPv4Address|IPv6Address).ipaddress.ip_address; serialize as a bare string (no prefix).IPHost/IPNetworkbehavior unchanged.Written for commit 7997dd3. Summary will update on new commits.