feat(infrahub): add Infrahub client for fabric intent (#42) #19
Reference in New Issue
Block a user
Delete Branch "feature/42-infrahub-client"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implements the Python async client package (
src/infrahub_client/) that wrapsinfrahub-sdkto fetch fabric intent data from Infrahub. Resolves fabric-orchestrator issue #42 Phase 2.pyproject.toml— package config (arista-evpn-vxlan-infrahub-client) withinfrahub-sdk>=0.16.0,pydantic>=2.0, ruff/pytest dev deps, Python ≥3.12src/infrahub_client/exceptions.py—InfrahubClientErrorhierarchy (ConnectionError,QueryError,NotFoundError)src/infrahub_client/models.py— 11 frozen Pydantic v2 models (DeviceIntent,VlanIntent,VniIntent,BgpRouterConfigIntent,BgpPeerGroupIntent,BgpSessionIntent,VrfIntent,VtepIntent,MlagDomainIntent,MlagPeerConfigIntent,EvpnInstanceIntent)src/infrahub_client/client.py—FabricInfrahubClientasync context manager with 10 public methods covering all schema entities (devices, VLANs, BGP, VRFs, VTEPs, EVPN instances, MLAG) and a TTL-based in-memory cachesrc/infrahub_client/__init__.py— public API exportstests/test_infrahub_client.py— unit tests with fully mocked SDK covering each method,InfrahubNotFoundError, branch forwarding, caching TTL expiry, andInfrahubQueryErrorpropagationTest plan
pip install -e ".[dev]"in the repo rootruff check src/ tests/— no lint errorsruff format --check src/ tests/— no formatting issuespytest tests/— all tests passget_device("leaf1")🤖 Generated with Claude Code
Pull request closed