Implements the Python async client package (src/infrahub_client/) that wraps infrahub-sdk to fetch fabric intent data from Infrahub. Resolves fabric-orchestrator issue #42 Phase 2.
pyproject.toml — package config (arista-evpn-vxlan-infrahub-client) with infrahub-sdk>=0.16.0, pydantic>=2.0, ruff/pytest dev deps, Python ≥3.12
src/infrahub_client/client.py — FabricInfrahubClient async context manager with 10 public methods covering all schema entities (devices, VLANs, BGP, VRFs, VTEPs, EVPN instances, MLAG) and a TTL-based in-memory cache
src/infrahub_client/__init__.py — public API exports
tests/test_infrahub_client.py — unit tests with fully mocked SDK covering each method, InfrahubNotFoundError, branch forwarding, caching TTL expiry, and InfrahubQueryError propagation
Test plan
pip install -e ".[dev]" in the repo root
ruff check src/ tests/ — no lint errors
ruff format --check src/ tests/ — no formatting issues
pytest tests/ — all tests pass
Integration smoke test: point client at a running Infrahub instance and call get_device("leaf1")
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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