Skip to content

Commit 4b69787

Browse files
authored
feat: first version of circuit contract (#67)
1 parent 38f873a commit 4b69787

2 files changed

Lines changed: 140 additions & 33 deletions

File tree

.metadata.yml

Lines changed: 71 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
# yamllint disable rule:line-length
33
base/dcim:
4-
description: Basic DCIM schema to capture devices, racks, interfaces, and related
4+
description:
5+
Basic DCIM schema to capture devices, racks, interfaces, and related
56
information.
67
name: DCIM
78
base/ipam:
@@ -11,11 +12,12 @@ base/location:
1112
description: Basic Location schema to capture locations, sites, and related information.
1213
name: Locations
1314
base/organization:
14-
description: Basic Organization schema to capture organizations, vendors, and related
15+
description:
16+
Basic Organization schema to capture organizations, vendors, and related
1517
information.
1618
name: Organization
1719
experimental/azure:
18-
attribution: '[Rowan Coleman](https://www.linkedin.com/in/rowan-coleman-6a147156/)'
20+
attribution: "[Rowan Coleman](https://www.linkedin.com/in/rowan-coleman-6a147156/)"
1921
dependencies:
2022
- base
2123
description: This schema extension introduces cloud support for Microsoft Azure.
@@ -52,14 +54,16 @@ experimental/optical_transport:
5254
experimental/location_extended:
5355
dependencies:
5456
- base
55-
description: This schema extension is the most detailed when it comes to location,
57+
description:
58+
This schema extension is the most detailed when it comes to location,
5659
you'll find all the layers you can think of.
5760
name: Location Extended
5861
experimental/modules_linecards:
5962
dependencies:
6063
- base
6164
- extensions/modules
62-
description: This schema extension allows you to capture Linecard related information
65+
description:
66+
This schema extension allows you to capture Linecard related information
6367
like the version. You can insert the Linecard into a Dcim Physical Device and
6468
leverage the Linecard type model. The Linecard can accept PIC to help configure
6569
PORT information like breakout-capabilities and configurations.
@@ -68,7 +72,8 @@ experimental/modules_routing_engine:
6872
dependencies:
6973
- base
7074
- extensions/modules
71-
description: This schema extension allows you to capture Routing Engine related
75+
description:
76+
This schema extension allows you to capture Routing Engine related
7277
information like the version. You can insert the Routing Engine into a Dcim Physical
7378
Device and leverage the Routing Engine type model.
7479
name: Modules Routing Engine
@@ -86,54 +91,62 @@ experimental/tenancy:
8691
dependencies:
8792
- base
8893
- extensions/circuit
89-
description: This schema extension introduces tenancy for some of the schema nodes
94+
description:
95+
This schema extension introduces tenancy for some of the schema nodes
9096
(circuits...)
9197
name: Tenancy
9298
experimental/topology:
9399
dependencies:
94100
- base
95-
description: A schema for defining and managing network topology, strategies, and
101+
description:
102+
A schema for defining and managing network topology, strategies, and
96103
services.
97104
name: Topology
98105
experimental/vlan-translation:
99106
dependencies:
100107
- base
101-
description: This schema extension is based on Juniper VLAN MAP, and not yet test
108+
description:
109+
This schema extension is based on Juniper VLAN MAP, and not yet test
102110
out for other vendors.
103111
name: VLAN Translation
104112
extensions/cable:
105113
dependencies:
106114
- base
107-
description: This schema extension contains a basic Cable model allowing you to
115+
description:
116+
This schema extension contains a basic Cable model allowing you to
108117
connect two endpoints.
109118
name: Cable
110119
extensions/circuit:
111120
dependencies:
112121
- base
113122
- extensions/location_minimal
114-
description: This schema extension contains Circuits and ways to connect them with
123+
description:
124+
This schema extension contains Circuits and ways to connect them with
115125
your infrastructure! The circuit could be a fiber connecting two sites, you would
116126
then have two endpoints, one on each site.
117127
name: Circuit
118128
extensions/cluster:
119129
dependencies:
120130
- base
121131
- extensions/compute
122-
description: This schema extension contains the foundations to capture clusters.
132+
description:
133+
This schema extension contains the foundations to capture clusters.
123134
With this one in place you can unlock various clusters flavors (hosting cluster
124135
able to host VMs, firewall clusters built with specific appliances ...)
125136
name: Cluster
126137
extensions/compute:
127138
dependencies:
128139
- base
129-
description: With this schema extension in place you will be able to capture all
140+
description:
141+
With this schema extension in place you will be able to capture all
130142
your physical servers. It also gives you the baseline to build virtualization.
131143
You might consider HostingCluster extension to go with!
132144
name: Compute
133145
extensions/cross_connect:
134146
dependencies:
135147
- base
136-
description: This extension contains schema to capture Cross Connect. You can see
148+
description:
149+
This extension contains schema to capture Cross Connect. You can see
137150
it as "a cable operated by a provider". You will be able to attach it to a location
138151
and then connect endpoints to it (e.g. rear interface of a patch panel, circuit
139152
endpoint ...)
@@ -142,7 +155,8 @@ extensions/dwdm:
142155
dependencies:
143156
- base
144157
- extensions/sfp
145-
description: This schema extension contains models for OADM (Optical Add Drop Multiplexer)
158+
description:
159+
This schema extension contains models for OADM (Optical Add Drop Multiplexer)
146160
supporting various WDM (Wavelength Division Multiplexing) technologies such as
147161
DWDM (Dense Wavelength Division Multiplexing) or CWDM (Coarse Wavelength Division
148162
Multiplexing). With some vendors, the tunable optics are not configured via the
@@ -152,36 +166,41 @@ extensions/dwdm:
152166
extensions/firewall_policer:
153167
dependencies:
154168
- base
155-
description: This schema extension contains models for VMs. You might consider Cluster
169+
description:
170+
This schema extension contains models for VMs. You might consider Cluster
156171
or/and Hypervisor extension to go with!
157172
name: Firewall Policer
158173
extensions/hosting_cluster:
159174
dependencies:
160175
- base
161176
- extensions/cluster
162177
- extensions/compute
163-
description: A rather generic cluster built with compute units (e.g. servers) and
178+
description:
179+
A rather generic cluster built with compute units (e.g. servers) and
164180
able to host VMs.
165181
name: Hosting Cluster
166182
extensions/interface_breakout:
167183
dependencies:
168184
- base
169-
description: This schema extension introduces relationships to support breakout
185+
description:
186+
This schema extension introduces relationships to support breakout
170187
interfaces, enabling you to document the breakout of a physical interface into
171188
smaller physical interfaces.
172189
name: Interface Breakout
173190
extensions/lag:
174191
dependencies:
175192
- base
176-
description: This schema extension includes models for Link Aggregation Groups (LAGs),
193+
description:
194+
This schema extension includes models for Link Aggregation Groups (LAGs),
177195
enabling you to link physical interfaces as building blocs of your LAG interface.
178196
It can be used in standard networking environments as well as in compute scenarios,
179197
such as capturing bond interfaces.
180198
name: Lag
181199
extensions/location_minimal:
182200
dependencies:
183201
- base
184-
description: This schema extension is minimal but will provide you with basic items
202+
description:
203+
This schema extension is minimal but will provide you with basic items
185204
to store location related data.
186205
name: Location Minimal
187206
extensions/mlag:
@@ -222,7 +241,8 @@ extensions/peering_ixp:
222241
- extensions/routing
223242
- extensions/routing_bgp
224243
- extensions/routing_bgp_community
225-
description: This schema extension contains all you need to model anything revolving
244+
description:
245+
This schema extension contains all you need to model anything revolving
226246
around internet peering (Exchange points ...)!
227247
name: Peering IXP
228248
extensions/physical_disk:
@@ -237,22 +257,25 @@ extensions/qinq:
237257
dependencies:
238258
- base
239259
- extensions/vlan
240-
description: This schema extension brings extensions to VLAN model in order to support
260+
description:
261+
This schema extension brings extensions to VLAN model in order to support
241262
QinQ.
242263
name: QinQ
243264
extensions/routing:
244265
dependencies:
245266
- base
246267
- extensions/vlan
247-
description: This schema extension contains generics to create Routing Protocol
268+
description:
269+
This schema extension contains generics to create Routing Protocol
248270
"Instance". The idea is to create one Routing Protocol instance per IpamVRF +
249271
DcimDevice pair.
250272
name: Routing
251273
extensions/routing_aggregate:
252274
dependencies:
253275
- base
254276
- extensions/routing
255-
description: This schema extension contains all you need to model the Aggregate
277+
description:
278+
This schema extension contains all you need to model the Aggregate
256279
Routing Protocol.
257280
name: Routing Aggregate
258281
extensions/routing_bgp:
@@ -272,14 +295,16 @@ extensions/routing_bgp_rr:
272295
- base
273296
- extensions/routing
274297
- extensions/routing_bgp
275-
description: This schema extension extend the BGP extension to add BGP Route Reflector
298+
description:
299+
This schema extension extend the BGP extension to add BGP Route Reflector
276300
Clustering.
277301
name: Routing BGP RR
278302
extensions/routing_ospf:
279303
dependencies:
280304
- base
281305
- extensions/routing
282-
description: This schema extension contains all you need to model the OSPF Routing
306+
description:
307+
This schema extension contains all you need to model the OSPF Routing
283308
Protocol.
284309
name: Routing OSPF
285310
extensions/routing_pim:
@@ -291,7 +316,8 @@ extensions/routing_pim:
291316
extensions/routing_policies:
292317
dependencies:
293318
- base
294-
description: This schema extension contains a generic to create Routing Policies.
319+
description:
320+
This schema extension contains a generic to create Routing Policies.
295321
This Generic can be extend for each Routing Protocols you may want to use.
296322
name: Routing Policies
297323
extensions/routing_policies_aggregate:
@@ -300,7 +326,8 @@ extensions/routing_policies_aggregate:
300326
- extensions/routing
301327
- extensions/routing_policies
302328
- extensions/routing_aggregate
303-
description: This extension is using the Routing Policies extensions and the Routing
329+
description:
330+
This extension is using the Routing Policies extensions and the Routing
304331
Aggregate one together.
305332
name: Routing Policies Aggregate
306333
extensions/routing_policies_bgp:
@@ -309,7 +336,8 @@ extensions/routing_policies_bgp:
309336
- extensions/routing
310337
- extensions/routing_policies
311338
- extensions/routing_bgp
312-
description: This extension is using the Routing Policies extensions and the Routing
339+
description:
340+
This extension is using the Routing Policies extensions and the Routing
313341
BGP one together.
314342
name: Routing Policies BGP
315343
extensions/routing_policies_ospf:
@@ -318,7 +346,8 @@ extensions/routing_policies_ospf:
318346
- extensions/routing
319347
- extensions/routing_policies
320348
- extensions/routing_ospf
321-
description: This extension is using the Routing Policies extensions and the Routing
349+
description:
350+
This extension is using the Routing Policies extensions and the Routing
322351
OSPF one together.
323352
name: Routing Policies OSPF
324353
extensions/routing_policies_pim:
@@ -327,7 +356,8 @@ extensions/routing_policies_pim:
327356
- extensions/routing
328357
- extensions/routing_policies
329358
- extensions/routing_pim
330-
description: This schema inherits the `RoutingPolicy` schema and removes `import_policies`
359+
description:
360+
This schema inherits the `RoutingPolicy` schema and removes `import_policies`
331361
and `export_policies` attributes. However it adds a number of relationships to
332362
`RoutingPIM`.
333363
name: Routing Policies (PIM)
@@ -348,14 +378,16 @@ extensions/sfp:
348378
extensions/snmp:
349379
dependencies:
350380
- base
351-
description: This schema extension contains models for SNMP Communities and SNMP
381+
description:
382+
This schema extension contains models for SNMP Communities and SNMP
352383
Clients. As you can see this extension is not linked to Tenancy or Device, as
353384
you could decide to link the Community to different models based on your use case.
354385
name: SNMP
355386
extensions/topology:
356387
dependencies:
357388
- base
358-
description: This schema extension introduces abstract network pods and services
389+
description:
390+
This schema extension introduces abstract network pods and services
359391
running in the pods, such as MPLS and EVPN.
360392
name: Topology
361393
extensions/users:
@@ -378,3 +410,9 @@ extensions/vrrp:
378410
- base
379411
description: This schema extension contains models for VRRP.
380412
name: VRRP
413+
extensions/circuit_contract:
414+
dependencies:
415+
- base
416+
- extensions/circuit
417+
description: This schema extension provides models for managing Circuit Contracts, enabling structured representation of service agreements with network providers. Compatible with Infrahub 1.8.
418+
name: Circuit Contract
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# yaml-language-server: $schema=https://schema.infrahub.app/infrahub/schema/latest.json
2+
---
3+
version: "1.0"
4+
nodes:
5+
- name: CircuitContract
6+
namespace: Dcim
7+
inherit_from:
8+
- CoreFileObject
9+
description: A contract document associated with a circuit service, including terms, costs, and validity period.
10+
label: Circuit Contract
11+
icon: mdi:file-sign
12+
menu_placement: DcimCircuit
13+
human_friendly_id:
14+
- name__value
15+
order_by:
16+
- contract_end__value
17+
display_label: "Contract (Circuit `{{ circuit__circuit_id__value }}`)"
18+
attributes:
19+
- name: name
20+
kind: Text
21+
computed_attribute:
22+
kind: Jinja2
23+
jinja2_template: "contract_{{ circuit__circuit_id__value }}"
24+
read_only: true # You must set the attribute to read-only as the value will be handled by the system
25+
optional: false # As it's a Jinja2 kind of attribute you can make it mandatory
26+
- name: contract_start
27+
kind: DateTime
28+
optional: false
29+
- name: contract_end
30+
kind: DateTime
31+
optional: false
32+
- name: monthly_cost
33+
kind: Number
34+
optional: true
35+
- name: currency
36+
kind: Dropdown
37+
optional: true
38+
choices:
39+
- name: usd
40+
label: USD
41+
description: United States Dollar
42+
- name: eur
43+
label: EUR
44+
description: Euro
45+
- name: gbp
46+
label: GBP
47+
description: British Pound Sterling
48+
relationships:
49+
# Example of a relationship to capture the account that signed the contract
50+
# - name: signed_by
51+
# peer: CoreAccount
52+
# kind: Attribute
53+
# cardinality: one
54+
# optional: true
55+
- name: circuit
56+
peer: DcimCircuit
57+
kind: Attribute
58+
cardinality: one
59+
optional: false
60+
order_weight: 950
61+
62+
extensions:
63+
nodes:
64+
- kind: DcimCircuit
65+
relationships:
66+
- name: contract
67+
peer: DcimCircuitContract
68+
cardinality: one
69+
optional: true

0 commit comments

Comments
 (0)