feat: draft for schema library v2 - #75
Open
BaptisteGi wants to merge 30 commits into
Open
Conversation
Deploying schema-library with
|
| Latest commit: |
893be13
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2cf805ce.schema-library.pages.dev |
| Branch Preview URL: | https://bgi-schema-library-v2.schema-library.pages.dev |
BaptisteGi
marked this pull request as ready for review
June 23, 2026 15:33
lancamat1
self-requested a review
July 12, 2026 09:31
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.
Schema Library v2.0
Version 2.0 is a full pass over the base DCIM and IPAM schemas and most extensions, rather than an incremental update. It combines two kinds of work: closing data-modeling gaps found in an audit of the previous schema — VRF route targets that could only hold one target, interfaces with no valid default MTU, two competing topology and location models, inconsistent use of Dropdown versus plain-text enums, typos in published attribute names, among others — and adding capabilities the library didn't have before, such as tracking swappable device modules and power supplies, assigning IP aggregates to a registry, and scoping tenancy to devices and prefixes. Because so much of the base and extension schemas changed shape as part of that cleanup, v2.0 is not compatible with schemas or data built on v1.x: loading it as-is over an existing v1.x deployment will fail or silently drop data on the attributes and relationships listed below, so plan a migration rather than an in-place upgrade.
Warning
Breaking changes in this release
This release changes attribute and relationship names, types, and cardinalities across
base/dcim.yml,base/ipam.yml,base/location.yml, and most extensions. Loading v2.0 over data created with v1.x schemas requires migrating that data first.Highlights
extensions/modulesshipped no ready-to-use node types, only a generic to build on.extensions/device_modulenow ships a workingModule/ModuleTypepair tied to aDcimModuleBayslot, andextensions/device_psu_moduleadds a PSU flavor with wattage and hot-swap attributes. See Track modules and power supplies as inventory on a device.extensions/aggregateextension adds anAggregatenode tied to anRIRnode. See Assign IP aggregates to a registry.location_minimalhierarchy.extensions/rackandextensions/location_sitesplit racks and sites into their own extensions, so either can be loaded independently. See Model racks and standalone sites independently of a full location hierarchy.extensions/tenancy(promoted out of experimental) wires aTenantdirectly to devices, prefixes, IP addresses, and hosted locations. See Scope tenancy to devices, prefixes, and hosted locations.Track modules and power supplies as inventory on a device
Devices with swappable hardware — fan trays, line cards, power supplies — can now be modeled as installed modules rather than static device attributes.
What changed:
extensions/device_module(replacingextensions/modules) adds aDcimModuleBaynode representing a physical slot on a device, and a ready-to-useModule/ModuleTypepair that installs into a bay. A module can only be tracked once it is installed in a bay; spares awaiting installation are not modeled.extensions/device_psu_module(new, depends onextensions/device_module) adds a PSU-specific module type withwattage(Number) andhotswappable(Boolean) attributes.extensions/modules_linecardsandextensions/modules_routing_enginenow depend onextensions/device_moduleinstead of the removedextensions/modules.extensions/patch_panelno longer defines its ownDcimPatchPanelModulenode; a patch panel's modules are now tracked through the sameDcimModuleBaymechanism as any other device.Assign IP aggregates to a registry
Top-level address space can now be tracked back to the registry or private authority that assigned it, rather than only appearing as a role on a generic prefix.
What changed:
extensions/aggregate(new) adds anAggregatenode for top-level IPv4/IPv6 blocks, and anRIRnode (with anis_privateflag) that an aggregate points to.Model racks and standalone sites independently of a full location hierarchy
A rack or a site can now be loaded on its own, without pulling in the rest of a country/metro/site hierarchy.
What changed:
extensions/rack(new) splitsLocationRackout ofextensions/location_minimalinto its own extension, and relates it to a site through an explicitsite/racksrelationship rather than hierarchical nesting. It addsstatus,serial_number, andasset_tagattributes that the rack did not have before.extensions/location_site(new) adds a standaloneLocationSitenode (facility, physical address, timezone, status) with no region or country tier above it. It defines the sameLocation.Sitenode asextensions/location_minimal, so load one or the other, not both.extensions/location_minimal's hierarchy changes fromCountry → Metro → Site → RacktoRegion → Country → Site(theMetrotier is removed, aRegiontier is added aboveCountry, andRackmoves to its own extension as described above).Scope tenancy to devices, prefixes, and hosted locations
A tenant can now own the devices, address space, and locations it's responsible for directly, instead of only circuits and buildings.
What changed:
extensions/tenancy(promoted fromexperimental/tenancy, and rebuilt) wires aTenantnode toDcimGenericDevice(devices),IpamPrefix(prefixes),IpamIPAddress(addresses), andLocationHosting(locations). It no longer depends onextensions/circuit; extending tenancy onto circuits or other optional nodes is documented as a pattern you apply yourself intenancy.yml.Align VRFs, interfaces, and VLANs with industry standards
Several base and extension schemas are retyped or restructured to match industry standards, and to fix values that couldn't previously be expressed at all.
What changed:
IpamVRF.import_rtandexport_rtchange fromcardinality: onetocardinality: many, so a VRF can import or export more than one route target — the correspondingIpamRouteTargetrelationship splits intoimport_vrf/export_vrf.DcimInterface's defaultmtuof1514(the full Ethernet frame size) is removed from the shared generic;InterfacePhysicalnow sets a default of1500(the IP payload size) directly.InterfaceVirtualno longer carries anmtuattribute.DcimInterface.roledrops thelagchoice (LAG is already modeled byInterfaceLag) and renamescusttocustomer.DcimInterface.statusdropsdeletedandoutageand is now mandatory.qinq_roleDropdown patched onto the genericIpamVLAN(extensions/qinq/qinq.yaml) to dedicatedIpamSVLANandIpamCVLANnode types (extensions/qinq/qinq.yml— note the corrected.ymlextension) built on a newGenericVLANbase. ACVLAN's name is computed from its parentSVLANand VLAN ID.IpamL2Domainis replaced byIpamVLANGroup, scoped to a location the same wayextensions/aggregatescopes to an RIR.extensions/topology's schema is removed;experimental/topologyremains the only topology model in the library.SnmpCommunityV2.access,SnmpCommunityV3.auth_protocol/privacy_protocol) andBGPSession.session_typechange fromkind: Textwith anenum:list tokind: Dropdown, and their stored values change case (e.g.EXTERNAL→external,Read-Only→read_only).Bug fixes
RoutingBGPSession.import_routing_policies/export_routing_policiespointed to the genericRoutingPolicypeer and reused the same relationship identifiers (bgp__import_policies/bgp__export_policies) as the equivalent relationships onRoutingBGPPeerGroup. Both now point toRoutingPolicyBGPand use distinct identifiers, so a session's routing policies no longer risk being conflated with a peer group's.IpamIPAddress.interfaceandInterfaceLayer3.ip_addressesare now linked with a matchingidentifier, so the two sides resolve as one relationship instead of being treated as unrelated.Minor changes
Documentation
docs/docs/reference/*.mdx) for every base and extension schema to reflect the v2.0 model, and added dedicated reference pages foraggregate,device_module,device_psu_module,location_site, andrack.docs.infrahub.appor OpsMill for architectural review.Developer Experience
load_demo_ipam_dciminvoke task that loads the base schema plus a curated set of extensions (aggregate, cable, circuit, compute, cluster, hosting_cluster, lag, location_minimal, vlan, qinq, rack, vrf) for a demo environment.Reliability
extensions/firewall_policermoves toexperimental/firewall_policer.Full changelog
Added
extensions/aggregate—AggregateandRIRnodes for top-level IP address space. (#75)extensions/device_module—DcimModuleBay,Module, andModuleTypenodes, replacingextensions/modules. (#75)extensions/device_psu_module— PSU-specific module type withwattageandhotswappable. (#75)extensions/rack— standaloneLocationRack, split out ofextensions/location_minimal. (#75)extensions/location_site— standaloneLocationSitewith no region/country hierarchy. (#75)extensions/tenancy— promoted fromexperimental/tenancy, wired to devices, prefixes, addresses, and hosted locations. (#75)DcimCircuit.commit_rate,DcimCircuitEndpoint.side,IpamVRF.enforce_unique,IpamIPAddress.status/role,SnmpCommunity.devices,SnmpClient.ip_address. (#75)tasks/schemas.py:load_demo_ipam_dciminvoke task. (#75)Changed
IpamVRF.import_rt/export_rt—cardinality: onetomany. (#75)DcimInterface.mtu— default1514to1500, moved from the shared generic toInterfacePhysicalonly. (#75)DcimInterface.role/statuschoices reduced and renamed (cust→customer,lagremoved;deleted/outageremoved). (#75)DcimDevice.statuschoices —drainedremoved,reserved/deprecatedadded. (#75)extensions/qinq— rebuilt aroundIpamSVLAN/IpamCVLAN; file renamedqinq.yaml→qinq.yml. (#75)IpamL2Domain→IpamVLANGroup, scoped via the newIpamVLANGroupScopemixin. (#75)extensions/location_minimalhierarchy —Country → Metro → Site → RacktoRegion → Country → Site;Site.facility_id→facility. (#75)DcimCircuit.circuit_typechoices —upstreamreplaced byinternet_access,point_to_pointadded. (#75)DcimCircuitEndpoint.name— now a computed attribute (circuit ID + side), replacing free text. (#75)VRRPGroup.group→vrid(TexttoNumber);VRRPGroup.ip_address→ip_addresses. (#75)hosting_cluster'scluster_type→technology; cloud-specific choices (aws,gcp) replaced bypublic_cloud. (#75)BGPSession.session_type, SNMP community/client enums —Text+enumtoDropdown, values changed to lowercase/snake_case. (#75)extensions/firewall_policermoved toexperimental/firewall_policer. (#75)extensions/topologyschema removed (superseded byexperimental/topology). (#75)LocationGeneric/LocationHosting—shortnameremoved;human_friendly_idswitches toname. (#75)IpamPrefix—organization,location,gatewayrelationships removed in favor of the newscoperelationship (IpamPrefixScope);rolechoices fully replaced ({loopback, management, public, server, supernet, technical, loopback-vtep}→{management, link, customer, supernet, backbone}). (#75)Fixed
DcimCircuit.enpoints→endpointstypo. (#75)DcimInterface.rolecust→customertypo/abbreviation. (#75)RoutingBGPSessionrouting-policy relationships retyped toRoutingPolicyBGPwith distinct identifiers, no longer colliding withRoutingBGPPeerGroup's. (#75)IpamIPAddress.interface/InterfaceLayer3.ip_addressesgiven a matchingidentifierso both sides resolve as one relationship. (#75)