From 95ca8af3dd06942c8928c249dba766e1ea085ad7 Mon Sep 17 00:00:00 2001 From: Baptiste Date: Mon, 9 Mar 2026 21:26:54 +0100 Subject: [PATCH] feat: first version of circuit contract --- .metadata.yml | 104 ++++++++++++------ .../circuit_contract/circuit_contract.yml | 69 ++++++++++++ 2 files changed, 140 insertions(+), 33 deletions(-) create mode 100644 extensions/circuit_contract/circuit_contract.yml diff --git a/.metadata.yml b/.metadata.yml index c29e77d..60249fa 100644 --- a/.metadata.yml +++ b/.metadata.yml @@ -1,7 +1,8 @@ --- # yamllint disable rule:line-length base/dcim: - description: Basic DCIM schema to capture devices, racks, interfaces, and related + description: + Basic DCIM schema to capture devices, racks, interfaces, and related information. name: DCIM base/ipam: @@ -11,11 +12,12 @@ base/location: description: Basic Location schema to capture locations, sites, and related information. name: Locations base/organization: - description: Basic Organization schema to capture organizations, vendors, and related + description: + Basic Organization schema to capture organizations, vendors, and related information. name: Organization experimental/azure: - attribution: '[Rowan Coleman](https://www.linkedin.com/in/rowan-coleman-6a147156/)' + attribution: "[Rowan Coleman](https://www.linkedin.com/in/rowan-coleman-6a147156/)" dependencies: - base description: This schema extension introduces cloud support for Microsoft Azure. @@ -39,14 +41,16 @@ experimental/infiniband: experimental/location_extended: dependencies: - base - description: This schema extension is the most detailed when it comes to location, + description: + This schema extension is the most detailed when it comes to location, you'll find all the layers you can think of. name: Location Extended experimental/modules_linecards: dependencies: - base - extensions/modules - description: This schema extension allows you to capture Linecard related information + description: + This schema extension allows you to capture Linecard related information like the version. You can insert the Linecard into a Dcim Physical Device and leverage the Linecard type model. The Linecard can accept PIC to help configure PORT information like breakout-capabilities and configurations. @@ -55,7 +59,8 @@ experimental/modules_routing_engine: dependencies: - base - extensions/modules - description: This schema extension allows you to capture Routing Engine related + description: + This schema extension allows you to capture Routing Engine related information like the version. You can insert the Routing Engine into a Dcim Physical Device and leverage the Routing Engine type model. name: Modules Routing Engine @@ -73,32 +78,37 @@ experimental/tenancy: dependencies: - base - extensions/circuit - description: This schema extension introduces tenancy for some of the schema nodes + description: + This schema extension introduces tenancy for some of the schema nodes (circuits...) name: Tenancy experimental/topology: dependencies: - base - description: A schema for defining and managing network topology, strategies, and + description: + A schema for defining and managing network topology, strategies, and services. name: Topology experimental/vlan-translation: dependencies: - base - description: This schema extension is based on Juniper VLAN MAP, and not yet test + description: + This schema extension is based on Juniper VLAN MAP, and not yet test out for other vendors. name: VLAN Translation extensions/cable: dependencies: - base - description: This schema extension contains a basic Cable model allowing you to + description: + This schema extension contains a basic Cable model allowing you to connect two endpoints. name: Cable extensions/circuit: dependencies: - base - extensions/location_minimal - description: This schema extension contains Circuits and ways to connect them with + description: + This schema extension contains Circuits and ways to connect them with your infrastructure! The circuit could be a fiber connecting two sites, you would then have two endpoints, one on each site. name: Circuit @@ -106,21 +116,24 @@ extensions/cluster: dependencies: - base - extensions/compute - description: This schema extension contains the foundations to capture clusters. + description: + This schema extension contains the foundations to capture clusters. With this one in place you can unlock various clusters flavors (hosting cluster able to host VMs, firewall clusters built with specific appliances ...) name: Cluster extensions/compute: dependencies: - base - description: With this schema extension in place you will be able to capture all + description: + With this schema extension in place you will be able to capture all your physical servers. It also gives you the baseline to build virtualization. You might consider HostingCluster extension to go with! name: Compute extensions/cross_connect: dependencies: - base - description: This extension contains schema to capture Cross Connect. You can see + description: + This extension contains schema to capture Cross Connect. You can see it as "a cable operated by a provider". You will be able to attach it to a location and then connect endpoints to it (e.g. rear interface of a patch panel, circuit endpoint ...) @@ -129,7 +142,8 @@ extensions/dwdm: dependencies: - base - extensions/sfp - description: This schema extension contains models for OADM (Optical Add Drop Multiplexer) + description: + This schema extension contains models for OADM (Optical Add Drop Multiplexer) supporting various WDM (Wavelength Division Multiplexing) technologies such as DWDM (Dense Wavelength Division Multiplexing) or CWDM (Coarse Wavelength Division Multiplexing). With some vendors, the tunable optics are not configured via the @@ -139,7 +153,8 @@ extensions/dwdm: extensions/firewall_policer: dependencies: - base - description: This schema extension contains models for VMs. You might consider Cluster + description: + This schema extension contains models for VMs. You might consider Cluster or/and Hypervisor extension to go with! name: Firewall Policer extensions/hosting_cluster: @@ -147,20 +162,23 @@ extensions/hosting_cluster: - base - extensions/cluster - extensions/compute - description: A rather generic cluster built with compute units (e.g. servers) and + description: + A rather generic cluster built with compute units (e.g. servers) and able to host VMs. name: Hosting Cluster extensions/interface_breakout: dependencies: - base - description: This schema extension introduces relationships to support breakout + description: + This schema extension introduces relationships to support breakout interfaces, enabling you to document the breakout of a physical interface into smaller physical interfaces. name: Interface Breakout extensions/lag: dependencies: - base - description: This schema extension includes models for Link Aggregation Groups (LAGs), + description: + This schema extension includes models for Link Aggregation Groups (LAGs), enabling you to link physical interfaces as building blocs of your LAG interface. It can be used in standard networking environments as well as in compute scenarios, such as capturing bond interfaces. @@ -168,7 +186,8 @@ extensions/lag: extensions/location_minimal: dependencies: - base - description: This schema extension is minimal but will provide you with basic items + description: + This schema extension is minimal but will provide you with basic items to store location related data. name: Location Minimal extensions/mlag: @@ -209,7 +228,8 @@ extensions/peering_ixp: - extensions/routing - extensions/routing_bgp - extensions/routing_bgp_community - description: This schema extension contains all you need to model anything revolving + description: + This schema extension contains all you need to model anything revolving around internet peering (Exchange points ...)! name: Peering IXP extensions/physical_disk: @@ -224,14 +244,16 @@ extensions/qinq: dependencies: - base - extensions/vlan - description: This schema extension brings extensions to VLAN model in order to support + description: + This schema extension brings extensions to VLAN model in order to support QinQ. name: QinQ extensions/routing: dependencies: - base - extensions/vlan - description: This schema extension contains generics to create Routing Protocol + description: + This schema extension contains generics to create Routing Protocol "Instance". The idea is to create one Routing Protocol instance per IpamVRF + DcimDevice pair. name: Routing @@ -239,7 +261,8 @@ extensions/routing_aggregate: dependencies: - base - extensions/routing - description: This schema extension contains all you need to model the Aggregate + description: + This schema extension contains all you need to model the Aggregate Routing Protocol. name: Routing Aggregate extensions/routing_bgp: @@ -259,14 +282,16 @@ extensions/routing_bgp_rr: - base - extensions/routing - extensions/routing_bgp - description: This schema extension extend the BGP extension to add BGP Route Reflector + description: + This schema extension extend the BGP extension to add BGP Route Reflector Clustering. name: Routing BGP RR extensions/routing_ospf: dependencies: - base - extensions/routing - description: This schema extension contains all you need to model the OSPF Routing + description: + This schema extension contains all you need to model the OSPF Routing Protocol. name: Routing OSPF extensions/routing_pim: @@ -278,7 +303,8 @@ extensions/routing_pim: extensions/routing_policies: dependencies: - base - description: This schema extension contains a generic to create Routing Policies. + description: + This schema extension contains a generic to create Routing Policies. This Generic can be extend for each Routing Protocols you may want to use. name: Routing Policies extensions/routing_policies_aggregate: @@ -287,7 +313,8 @@ extensions/routing_policies_aggregate: - extensions/routing - extensions/routing_policies - extensions/routing_aggregate - description: This extension is using the Routing Policies extensions and the Routing + description: + This extension is using the Routing Policies extensions and the Routing Aggregate one together. name: Routing Policies Aggregate extensions/routing_policies_bgp: @@ -296,7 +323,8 @@ extensions/routing_policies_bgp: - extensions/routing - extensions/routing_policies - extensions/routing_bgp - description: This extension is using the Routing Policies extensions and the Routing + description: + This extension is using the Routing Policies extensions and the Routing BGP one together. name: Routing Policies BGP extensions/routing_policies_ospf: @@ -305,7 +333,8 @@ extensions/routing_policies_ospf: - extensions/routing - extensions/routing_policies - extensions/routing_ospf - description: This extension is using the Routing Policies extensions and the Routing + description: + This extension is using the Routing Policies extensions and the Routing OSPF one together. name: Routing Policies OSPF extensions/routing_policies_pim: @@ -314,7 +343,8 @@ extensions/routing_policies_pim: - extensions/routing - extensions/routing_policies - extensions/routing_pim - description: This schema inherits the `RoutingPolicy` schema and removes `import_policies` + description: + This schema inherits the `RoutingPolicy` schema and removes `import_policies` and `export_policies` attributes. However it adds a number of relationships to `RoutingPIM`. name: Routing Policies (PIM) @@ -335,14 +365,16 @@ extensions/sfp: extensions/snmp: dependencies: - base - description: This schema extension contains models for SNMP Communities and SNMP + description: + This schema extension contains models for SNMP Communities and SNMP Clients. As you can see this extension is not linked to Tenancy or Device, as you could decide to link the Community to different models based on your use case. name: SNMP extensions/topology: dependencies: - base - description: This schema extension introduces abstract network pods and services + description: + This schema extension introduces abstract network pods and services running in the pods, such as MPLS and EVPN. name: Topology extensions/users: @@ -365,3 +397,9 @@ extensions/vrrp: - base description: This schema extension contains models for VRRP. name: VRRP +extensions/circuit_contract: + dependencies: + - base + - extensions/circuit + description: This schema extension provides models for managing Circuit Contracts, enabling structured representation of service agreements with network providers. Compatible with Infrahub 1.8. + name: Circuit Contract diff --git a/extensions/circuit_contract/circuit_contract.yml b/extensions/circuit_contract/circuit_contract.yml new file mode 100644 index 0000000..fc7ab25 --- /dev/null +++ b/extensions/circuit_contract/circuit_contract.yml @@ -0,0 +1,69 @@ +# yaml-language-server: $schema=https://schema.infrahub.app/infrahub/schema/latest.json +--- +version: "1.0" +nodes: + - name: CircuitContract + namespace: Dcim + inherit_from: + - CoreFileObject + description: A contract document associated with a circuit service, including terms, costs, and validity period. + label: Circuit Contract + icon: mdi:file-sign + menu_placement: DcimCircuit + human_friendly_id: + - name__value + order_by: + - contract_end__value + display_label: "Contract (Circuit `{{ circuit__circuit_id__value }}`)" + attributes: + - name: name + kind: Text + computed_attribute: + kind: Jinja2 + jinja2_template: "contract_{{ circuit__circuit_id__value }}" + read_only: true # You must set the attribute to read-only as the value will be handled by the system + optional: false # As it's a Jinja2 kind of attribute you can make it mandatory + - name: contract_start + kind: DateTime + optional: false + - name: contract_end + kind: DateTime + optional: false + - name: monthly_cost + kind: Number + optional: true + - name: currency + kind: Dropdown + optional: true + choices: + - name: usd + label: USD + description: United States Dollar + - name: eur + label: EUR + description: Euro + - name: gbp + label: GBP + description: British Pound Sterling + relationships: + # Example of a relationship to capture the account that signed the contract + # - name: signed_by + # peer: CoreAccount + # kind: Attribute + # cardinality: one + # optional: true + - name: circuit + peer: DcimCircuit + kind: Attribute + cardinality: one + optional: false + order_weight: 950 + +extensions: + nodes: + - kind: DcimCircuit + relationships: + - name: contract + peer: DcimCircuitContract + cardinality: one + optional: true