From edc40dede68e21e1fb6d6a34c637c7f4e5406f52 Mon Sep 17 00:00:00 2001 From: darnodo Date: Wed, 12 Nov 2025 18:38:54 +0100 Subject: [PATCH] feat: update datacenter generator documentation to reflect accurate schema and object names --- infrahub/generator.md | 499 +++++++++++++++++++++++++++++------------- 1 file changed, 341 insertions(+), 158 deletions(-) diff --git a/infrahub/generator.md b/infrahub/generator.md index fecdb8f..3952f40 100644 --- a/infrahub/generator.md +++ b/infrahub/generator.md @@ -1,34 +1,37 @@ # Datacenter Generator - Visual Diagrams +**Schema-Accurate Version - Corrected to match actual Infrahub schemas** + +--- ## 1. Generator Concept - High Level ```mermaid graph TB subgraph Input["📥 INPUT"] - DC1[Datacenter: DC1
---
dc_id: 1
bays: 2
dci_enabled: false] - DC2[Datacenter: DC2
---
dc_id: 2
bays: 2
dci_enabled: false] - DCI_Config[DCI Configuration
---
Manual/External
IP: 10.253.254.x] + DC1[InfraDatacenter: DC1
---
dc_id: 1
number_of_bays: 2
dci_enabled: false] + DC2[InfraDatacenter: DC2
---
dc_id: 2
number_of_bays: 2
dci_enabled: false] + DCI_Config[NetworkDCISwitch
---
Manual/External
Loopback0: 10.253.0.1] end subgraph Logic["⚙️ DATACENTER GENERATOR"] - Gen1[DC1 Generator:
Create 11 devices
Border eth12: shutdown] - Gen2[DC2 Generator:
Create 11 devices
Border eth12: shutdown] + Gen1[DC1 Generator:
Create 11 NetworkDevice objects
Border eth12: shutdown] + Gen2[DC2 Generator:
Create 11 NetworkDevice objects
Border eth12: shutdown] end subgraph Output1["📤 DC1 OUTPUT"] - Dev1[11 Device Objects] - Int1[~50 Interface Objects] - IP1[~30 IP Addresses] + Dev1[11 NetworkDevice Objects] + Int1[~50 NetworkInterface Objects] + IP1[~30 IpamIPAddress Objects] end subgraph Output2["📤 DC2 OUTPUT"] - Dev2[11 Device Objects] - Int2[~50 Interface Objects] - IP2[~30 IP Addresses] + Dev2[11 NetworkDevice Objects] + Int2[~50 NetworkInterface Objects] + IP2[~30 IpamIPAddress Objects] end subgraph Manual["🔧 MANUAL DCI SETUP"] - DCIDevice[DCI Device
Loopback: 10.253.0.1
ASN: 65000] + DCIDevice[NetworkDCISwitch
Loopback0: 10.253.0.1
ASN: 65000] UpdateDC1[Update DC1:
dci_enabled: true
dci_remote_dc_id: 2] UpdateDC2[Update DC2:
dci_enabled: true
dci_remote_dc_id: 1] end @@ -56,13 +59,15 @@ graph TB style DCIDevice fill:#ffccbc ``` +--- + ## 2. Datacenter Hierarchy ```mermaid graph TB - Org[Organization] - Site[Site: Paris-DC1
Location: Paris, France] - DC[Datacenter: DC1
dc_id: 1
bays: 2
spines: 3] + Org[OrganizationOrganization] + Site[LocationSite: Paris-DC1
Location: Paris, France] + DC[InfraDatacenter: DC1
dc_id: 1
number_of_bays: 2
spine_count: 3] Org --> Site Site --> DC @@ -73,32 +78,32 @@ graph TB DC --> BayLayer[Bay Layer] DC --> Subnets[IP Subnets] - SpineLayer --> S1[spine1-DC1
ASN: 65100] - SpineLayer --> S2[spine2-DC1
ASN: 65100] - SpineLayer --> S3[spine3-DC1
ASN: 65100] + SpineLayer --> S1[spine1-DC1
NetworkDevice
ASN: 65100] + SpineLayer --> S2[spine2-DC1
NetworkDevice
ASN: 65100] + SpineLayer --> S3[spine3-DC1
NetworkDevice
ASN: 65100] - LeafLayer --> LP1[Leaf Pair 1
ASN: 65101] - LeafLayer --> LP2[Leaf Pair 2
ASN: 65102] + LeafLayer --> LP1[NetworkMLAGDomain: Pair 1
ASN: 65101] + LeafLayer --> LP2[NetworkMLAGDomain: Pair 2
ASN: 65102] - LP1 --> L1[leaf1-DC1
10.1.0.21] - LP1 --> L2[leaf2-DC1
10.1.0.22] - LP2 --> L3[leaf3-DC1
10.1.0.23] - LP2 --> L4[leaf4-DC1
10.1.0.24] + LP1 --> L1[leaf1-DC1
Loopback0: 10.1.0.21] + LP1 --> L2[leaf2-DC1
Loopback0: 10.1.0.22] + LP2 --> L3[leaf3-DC1
Loopback0: 10.1.0.23] + LP2 --> L4[leaf4-DC1
Loopback0: 10.1.0.24] - BorderLayer --> BP[Border Pair
ASN: 65103] + BorderLayer --> BP[NetworkMLAGDomain: Border
ASN: 65103] BP --> B1[borderleaf1-DC1] BP --> B2[borderleaf2-DC1] - BayLayer --> Bay1[Bay 1] - BayLayer --> Bay2[Bay 2] + BayLayer --> Bay1[InfraBay 1] + BayLayer --> Bay2[InfraBay 2] Bay1 --> A1[access1-DC1] Bay2 --> A2[access2-DC1] - Subnets --> Sub1[10.1.0.0/24
Loopback0] - Subnets --> Sub2[10.1.1.0/24
Loopback1] - Subnets --> Sub3[10.1.10.0/24
Spine-Leaf P2P] - Subnets --> Sub4[10.1.20.0/24
Leaf-Access P2P] + Subnets --> Sub1[10.1.0.0/24
IpamIPPrefix
type: loopback] + Subnets --> Sub2[10.1.1.0/24
IpamIPPrefix
type: vtep] + Subnets --> Sub3[10.1.10.0/24
IpamIPPrefix
type: p2p] + Subnets --> Sub4[10.1.20.0/24
IpamIPPrefix
type: p2p] style DC fill:#ffecb3 style LP1 fill:#b3e5fc @@ -107,18 +112,20 @@ graph TB style Bay2 fill:#c8e6c9 ``` +--- + ## 3. Bay-to-Leaf Assignment Logic ```mermaid graph LR - subgraph Bays["🏢 Bays"] + subgraph Bays["🏢 InfraBay"] Bay1[Bay 1
access1-DC1] Bay2[Bay 2
access2-DC1] Bay3[Bay 3
access3-DC1] Bay4[Bay 4
access4-DC1] end - subgraph LeafPairs["🔀 Leaf Pairs - MLAG"] + subgraph LeafPairs["🔀 NetworkMLAGDomain - Leaf Pairs"] LP1[Leaf Pair 1
leaf1-DC1 ↔ leaf2-DC1
ASN: 65101] LP2[Leaf Pair 2
leaf3-DC1 ↔ leaf4-DC1
ASN: 65102] end @@ -149,50 +156,52 @@ graph LR style LP2 fill:#b3e5fc ``` +--- + ## 4. Complete DC1 Physical Topology ```mermaid graph TB subgraph DCI["DCI LAYER - Inter-DC"] - DCID[DCI Switch
10.253.0.1
ASN: 65000] + DCID[NetworkDCISwitch
Loopback0: 10.253.0.1
ASN: 65000] end subgraph Border["BORDER LEAF - DCI Gateway"] - B1[borderleaf1-DC1
10.1.0.31
eth12: shutdown or active] - B2[borderleaf2-DC1
10.1.0.32
eth12: shutdown or active] + B1[borderleaf1-DC1
NetworkDevice
Loopback0: 10.1.0.31
eth12: shutdown or active] + B2[borderleaf2-DC1
NetworkDevice
Loopback0: 10.1.0.32
eth12: shutdown or active] end subgraph Spine["SPINE LAYER - L3 Core"] - S1[spine1-DC1
10.1.0.11
ASN: 65100] - S2[spine2-DC1
10.1.0.12
ASN: 65100] - S3[spine3-DC1
10.1.0.13
ASN: 65100] + S1[spine1-DC1
NetworkDevice
Loopback0: 10.1.0.11
ASN: 65100] + S2[spine2-DC1
NetworkDevice
Loopback0: 10.1.0.12
ASN: 65100] + S3[spine3-DC1
NetworkDevice
Loopback0: 10.1.0.13
ASN: 65100] end subgraph Leaf["LEAF LAYER - Aggregation + VXLAN"] - subgraph Pair1["MLAG Pair 1 - ASN: 65101"] - L1[leaf1-DC1
10.1.0.21
VTEP: 10.1.1.21] - L2[leaf2-DC1
10.1.0.22
VTEP: 10.1.1.21] + subgraph Pair1["NetworkMLAGDomain - Pair 1 - ASN: 65101"] + L1[leaf1-DC1
Loopback0: 10.1.0.21
VTEP: 10.1.1.21] + L2[leaf2-DC1
Loopback0: 10.1.0.22
VTEP: 10.1.1.21] end - subgraph Pair2["MLAG Pair 2 - ASN: 65102"] - L3[leaf3-DC1
10.1.0.23
VTEP: 10.1.1.23] - L4[leaf4-DC1
10.1.0.24
VTEP: 10.1.1.23] + subgraph Pair2["NetworkMLAGDomain - Pair 2 - ASN: 65102"] + L3[leaf3-DC1
Loopback0: 10.1.0.23
VTEP: 10.1.1.23] + L4[leaf4-DC1
Loopback0: 10.1.0.24
VTEP: 10.1.1.23] end end subgraph Access["ACCESS LAYER - Rack/Bay ToR"] - A1[access1-DC1
Bay 1
L2 Switch] - A2[access2-DC1
Bay 2
L2 Switch] + A1[access1-DC1
NetworkDevice
InfraBay 1
L2 Switch] + A2[access2-DC1
NetworkDevice
InfraBay 2
L2 Switch] end subgraph Hosts["HOST LAYER"] - H1[host1-DC1
172.16.100.10] - H2[host2-DC1
172.16.200.10] + H1[host1-DC1
NetworkDevice
172.16.100.10] + H2[host2-DC1
NetworkDevice
172.16.200.10] end - DCID -.Optional DCI.- B1 - DCID -.Optional DCI.- B2 + DCID -.Optional NetworkDCIConnection.- B1 + DCID -.Optional NetworkDCIConnection.- B2 - S1 -.eBGP.- L1 + S1 -.eBGP - NetworkBGPNeighbor.- L1 S1 -.eBGP.- L2 S1 -.eBGP.- L3 S1 -.eBGP.- L4 @@ -213,14 +222,14 @@ graph TB S3 -.eBGP.- B1 S3 -.eBGP.- B2 - L1 ---|MLAG| L2 - L3 ---|MLAG| L4 - B1 ---|MLAG| B2 + L1 ---|MLAG - Vlan4094| L2 + L3 ---|MLAG - Vlan4094| L4 + B1 ---|MLAG - Vlan4094| B2 - L1 -->|eth7| A1 - L2 -->|eth7| A1 - L3 -->|eth7| A2 - L4 -->|eth7| A2 + L1 -->|eth7 - NetworkInterface| A1 + L2 -->|eth7 - NetworkInterface| A1 + L3 -->|eth7 - NetworkInterface| A2 + L4 -->|eth7 - NetworkInterface| A2 A1 -->|eth10| H1 A2 -->|eth10| H2 @@ -239,40 +248,42 @@ graph TB style B2 fill:#f8bbd0 ``` +--- + ## 5. IP Address Generation Flow ```mermaid graph TB - Start[Datacenter Object
dc_id: 1, bays: 2] + Start[InfraDatacenter Object
dc_id: 1, number_of_bays: 2] - Start --> GenSubnets[Generate Subnets
from dc_id] + Start --> GenSubnets[Generate IpamIPPrefix
from dc_id] - GenSubnets --> Sub1[10.1.0.0/24
Loopback0] - GenSubnets --> Sub2[10.1.1.0/24
Loopback1] - GenSubnets --> Sub3[10.1.10.0/24
Spine-Leaf P2P] - GenSubnets --> Sub4[10.1.20.0/24
Leaf-Access P2P] - GenSubnets --> Sub5[10.1.255.0/24
MLAG Peer] - GenSubnets --> Sub6[10.255.0.0/24
Management] + GenSubnets --> Sub1[10.1.0.0/24
prefix_type: loopback
Loopback0 addresses] + GenSubnets --> Sub2[10.1.1.0/24
prefix_type: vtep
Loopback1 VTEP addresses] + GenSubnets --> Sub3[10.1.10.0/24
prefix_type: p2p
Spine-Leaf links] + GenSubnets --> Sub4[10.1.20.0/24
prefix_type: p2p
Leaf-Access links] + GenSubnets --> Sub5[10.1.255.0/24
prefix_type: mlag
MLAG Peer links] + GenSubnets --> Sub6[10.255.0.0/24
prefix_type: management
Management IPs] - Sub1 --> AllocLo0[Allocate Loopback0
to Spines & Leafs] - Sub2 --> AllocLo1[Allocate Loopback1
to Leafs - shared in pairs] + Sub1 --> AllocLo0[Allocate IpamIPAddress
Loopback0 to Spines & Leafs] + Sub2 --> AllocLo1[Allocate IpamIPAddress
Loopback1 to Leafs - shared in pairs] Sub3 --> AllocP2P1[Allocate /31s
for Spine-Leaf links] Sub4 --> AllocP2P2[Allocate /31s
for Leaf-Access links] - Sub5 --> AllocMLAG[Allocate /30s
for MLAG peers] - Sub6 --> AllocMgmt[Allocate Management IPs
to all devices] + Sub5 --> AllocMLAG[Allocate /30s
for MLAG peer links] + Sub6 --> AllocMgmt[Allocate Management IPs
to all devices via template] AllocLo0 --> Spine1IP[spine1: 10.1.0.11/32] AllocLo0 --> Leaf1IP[leaf1: 10.1.0.21/32] - AllocLo1 --> Leaf1VTEP[leaf1-2: 10.1.1.21/32 - shared] + AllocLo1 --> Leaf1VTEP[leaf1-2 shared: 10.1.1.21/32] AllocP2P1 --> Link1[spine1-leaf1: 10.1.10.0/31] AllocP2P2 --> Link2[leaf1-access1: 10.1.20.0/31] - AllocMLAG --> MLAG1[leaf1-2 peer: 10.1.255.1-2/30] + AllocMLAG --> MLAG1[leaf1-2 peer: 10.1.255.1-2/30
via Vlan4094] - AllocMgmt --> Mgmt1[spine1: 10.255.0.11] + AllocMgmt --> Mgmt1[spine1: 10.255.0.11
computed from template] style Start fill:#ffecb3 style Sub1 fill:#e1f5ff @@ -283,41 +294,43 @@ graph TB style Sub6 fill:#e1f5ff ``` +--- + ## 6. Device Generation Flow ```mermaid graph TB - DC[Datacenter: DC1
bays: 2] + DC[InfraDatacenter: DC1
number_of_bays: 2] - DC --> CalcLeafs[Calculate:
leaf_pairs = ceil - bays / 2 - = 1
total_leafs = 1 * 2 = 2] + DC --> CalcLeafs[Calculate:
leaf_pair_count = ceil number_of_bays / 2 = 1
total_leaf_count = 1 * 2 = 2
total_access_count = 2] - CalcLeafs --> GenSpines[Generate Spines
count: 3 - fixed] - CalcLeafs --> GenLeafs[Generate Leafs
count: 4 - computed] - CalcLeafs --> GenBorders[Generate Border Leafs
count: 2 - fixed] - CalcLeafs --> GenAccess[Generate Access
count: 2 - from bays] + CalcLeafs --> GenSpines[Generate Spines
count: spine_count = 3] + CalcLeafs --> GenLeafs[Generate Leafs
count: total_leaf_count = 4] + CalcLeafs --> GenBorders[Generate Border Leafs
count: border_leaf_count = 2
if has_border_leafs: true] + CalcLeafs --> GenAccess[Generate Access
count: total_access_count = 2] - GenSpines --> S1[spine1-DC1] - GenSpines --> S2[spine2-DC1] - GenSpines --> S3[spine3-DC1] + GenSpines --> S1[spine1-DC1
NetworkDevice
role: spine] + GenSpines --> S2[spine2-DC1
NetworkDevice
role: spine] + GenSpines --> S3[spine3-DC1
NetworkDevice
role: spine] - GenLeafs --> LP1[Create MLAG Pair 1] - GenLeafs --> LP2[Create MLAG Pair 2] + GenLeafs --> LP1[Create NetworkMLAGDomain
MLAG-leaf1-2-DC1] + GenLeafs --> LP2[Create NetworkMLAGDomain
MLAG-leaf3-4-DC1] - LP1 --> L1[leaf1-DC1] - LP1 --> L2[leaf2-DC1] - LP2 --> L3[leaf3-DC1] - LP2 --> L4[leaf4-DC1] + LP1 --> L1[leaf1-DC1
role: leaf
mlag_side: left] + LP1 --> L2[leaf2-DC1
role: leaf
mlag_side: right] + LP2 --> L3[leaf3-DC1
role: leaf
mlag_side: left] + LP2 --> L4[leaf4-DC1
role: leaf
mlag_side: right] - GenBorders --> BP[Create Border Pair] - BP --> B1[borderleaf1-DC1] - BP --> B2[borderleaf2-DC1] + GenBorders --> BP[Create NetworkMLAGDomain
MLAG-border-DC1] + BP --> B1[borderleaf1-DC1
role: borderleaf
mlag_side: left] + BP --> B2[borderleaf2-DC1
role: borderleaf
mlag_side: right] - GenAccess --> AssignBays[Assign Bays to Leaf Pairs] + GenAccess --> AssignBays[Assign InfraBay to Leaf Pairs] AssignBays --> A1Config[Bay 1 → Leaf Pair 1
access1-DC1] AssignBays --> A2Config[Bay 2 → Leaf Pair 1
access2-DC1] - A1Config --> A1[access1-DC1] - A2Config --> A2[access2-DC1] + A1Config --> A1[access1-DC1
NetworkDevice
role: access] + A2Config --> A2[access2-DC1
NetworkDevice
role: access] style DC fill:#ffecb3 style LP1 fill:#b3e5fc @@ -325,15 +338,17 @@ graph TB style BP fill:#f8bbd0 ``` +--- + ## 7. Scaling Scenario - Adding Bay 3 ```mermaid graph LR subgraph Current["📦 Current State - 2 Bays"] - CurDC[Datacenter: DC1
bays: 2
leaf_pairs: 1] - CurLP1[Leaf Pair 1
leaf1-2] - CurBay1[Bay 1 → access1] - CurBay2[Bay 2 → access2] + CurDC[InfraDatacenter: DC1
number_of_bays: 2
leaf_pair_count: 1] + CurLP1[NetworkMLAGDomain: Pair 1
leaf1-2] + CurBay1[InfraBay 1 → access1] + CurBay2[InfraBay 2 → access2] CurDC --> CurLP1 CurLP1 --> CurBay1 @@ -345,22 +360,22 @@ graph LR end subgraph Generator["🔄 Generator Logic"] - Check[Check:
bays=3 > pairs*2=2?
YES → Need new pair] - CreatePair[Create Leaf Pair 2
leaf3-DC1, leaf4-DC1] - CreateAccess[Create access3-DC1] - AssignBay[Assign Bay 3 → Pair 2] - AllocIPs[Allocate IPs] - CreateLinks[Create Interfaces] - ConfigBGP[Configure BGP
ASN: 65102] + Check[Check:
number_of_bays=3 > pairs*2=2?
YES → Need new pair] + CreatePair[Create NetworkMLAGDomain
Leaf Pair 2
leaf3-DC1, leaf4-DC1] + CreateAccess[Create NetworkDevice
access3-DC1
role: access] + AssignBay[Assign InfraBay 3 → Pair 2] + AllocIPs[Allocate IpamIPAddress] + CreateLinks[Create NetworkInterface] + ConfigBGP[Configure NetworkBGPConfig
ASN: 65102] end subgraph Result["✅ New State - 3 Bays"] - NewDC[Datacenter: DC1
bays: 3
leaf_pairs: 2] - NewLP1[Leaf Pair 1
leaf1-2
ASN: 65101] - NewLP2[Leaf Pair 2
leaf3-4
ASN: 65102] - NewBay1[Bay 1 → access1] - NewBay2[Bay 2 → access2] - NewBay3[Bay 3 → access3] + NewDC[InfraDatacenter: DC1
number_of_bays: 3
leaf_pair_count: 2] + NewLP1[NetworkMLAGDomain: Pair 1
leaf1-2
ASN: 65101] + NewLP2[NetworkMLAGDomain: Pair 2
leaf3-4
ASN: 65102] + NewBay1[InfraBay 1 → access1] + NewBay2[InfraBay 2 → access2] + NewBay3[InfraBay 3 → access3] NewDC --> NewLP1 NewDC --> NewLP2 @@ -384,6 +399,8 @@ graph LR style Result fill:#c8e6c9 ``` +--- + ## 8. Infrahub Generator Workflow ```mermaid @@ -393,26 +410,27 @@ sequenceDiagram participant Generator participant Validator participant GraphQL - participant Devices + participant Objects - User->>Infrahub: Create Datacenter Object
(name, dc_id, bays, etc.) + User->>Infrahub: Create InfraDatacenter Object
(name, dc_id, number_of_bays, etc.) Infrahub->>Validator: Pre-Generation Validation Validator-->>Infrahub: ✅ Valid Input Infrahub->>Generator: Trigger Generator - Generator->>Generator: Compute Derived Values
(leaf_pairs, subnets, etc.) + Generator->>Generator: Compute Derived Values
(leaf_pair_count, total_leaf_count, etc.) loop For Each Layer - Generator->>Devices: Create Spine Devices - Generator->>Devices: Create Leaf Devices - Generator->>Devices: Create Access Devices + Generator->>Objects: Create NetworkDevice - Spines + Generator->>Objects: Create NetworkDevice - Leafs + Generator->>Objects: Create NetworkDevice - Access + Generator->>Objects: Create NetworkMLAGDomain end loop For Each Device - Generator->>Devices: Create Interfaces - Generator->>Devices: Allocate IP Addresses - Generator->>Devices: Generate BGP Config + Generator->>Objects: Create NetworkInterface + Generator->>Objects: Allocate IpamIPAddress + Generator->>Objects: Generate NetworkBGPConfig end Generator->>Validator: Post-Generation Validation @@ -421,15 +439,17 @@ sequenceDiagram Generator->>GraphQL: Commit All Objects GraphQL-->>Infrahub: Objects Created - Infrahub-->>User: ✅ Datacenter Generated
27 devices, 150 interfaces, 90 IPs + Infrahub-->>User: ✅ Datacenter Generated
11 devices, 50+ interfaces, 30+ IPs ``` +--- + ## 9. Configuration Generation Flow ```mermaid graph TB subgraph Infrahub["📊 Infrahub - Source of Truth"] - DeviceDB[(Device Objects
Interfaces
IPs
BGP Sessions)] + DeviceDB[(NetworkDevice Objects
NetworkInterface
IpamIPAddress
NetworkBGPConfig)] end subgraph Generator["⚙️ Config Generator"] @@ -469,70 +489,233 @@ graph TB style Deployment fill:#ffccbc ``` +--- + ## 10. Complete Data Model Relationships ```mermaid erDiagram - ORGANIZATION ||--o{ SITE : contains - SITE ||--o{ DATACENTER : contains - SITE ||--o{ IP_PREFIX : manages + OrganizationOrganization ||--o{ LocationSite : "contains (Generic)" + LocationSite ||--o{ InfraDatacenter : "contains (Generic)" + LocationSite ||--o{ IpamIPPrefix : "manages (Attribute)" - DATACENTER ||--|{ SUBNET : generates - DATACENTER ||--|{ DEVICE : generates - DATACENTER ||--|{ MLAG_PAIR : generates + InfraDatacenter ||--|{ IpamIPPrefix : "generates (Generic)" + InfraDatacenter ||--|{ NetworkDevice : "generates (Component)" + InfraDatacenter ||--|{ NetworkMLAGDomain : "generates (Generic)" + InfraDatacenter ||--|{ InfraBay : "contains (Generic)" - DEVICE ||--|{ INTERFACE : has - INTERFACE ||--o| IP_ADDRESS : assigned - INTERFACE ||--o| BGP_SESSION : endpoint + NetworkDevice ||--|{ NetworkInterface : "has (Component)" + NetworkInterface ||--o| IpamIPAddress : "assigned (Generic)" + NetworkInterface ||--o| NetworkBGPNeighbor : "endpoint (Generic)" - DEVICE }|--|| ROLE : has - DEVICE }o--o| MLAG_PAIR : member_of + NetworkDevice }|--|| DeviceRole : "has (Attribute)" + NetworkDevice }o--o| NetworkMLAGDomain : "member_of (Attribute)" - MLAG_PAIR ||--|| DEVICE : primary - MLAG_PAIR ||--|| DEVICE : secondary + NetworkMLAGDomain ||--o{ NetworkDevice : "devices (Generic)" + NetworkMLAGDomain ||--|{ NetworkMLAGInterface : "interfaces (Component)" - BGP_SESSION }o--|| INTERFACE : local - BGP_SESSION }o--|| INTERFACE : remote + NetworkBGPConfig }o--|| NetworkDevice : "device (Parent)" + NetworkBGPConfig ||--|{ NetworkBGPPeerGroup : "peer_groups (Component)" + NetworkBGPConfig ||--|{ NetworkBGPNeighbor : "neighbors (Component)" - SUBNET ||--|{ IP_ADDRESS : contains - IP_PREFIX ||--|{ SUBNET : parent + IpamIPPrefix ||--|{ IpamIPAddress : "contains (Generic)" + IpamIPPrefix ||--o| IpamIPPrefix : "parent (Attribute)" - ORGANIZATION { + NetworkDCISwitch ||--|{ NetworkDCIConnection : "connections (Component)" + NetworkDCIConnection }o--|| NetworkDevice : "border_leaf (Attribute)" + + OrganizationOrganization { string name + number asn_base } - SITE { + LocationSite { string name string location + string status } - DATACENTER { + InfraDatacenter { string name - int dc_id - int number_of_bays - int spine_count - string parent_subnet + number dc_id + number number_of_bays + number spine_count + number border_leaf_count + IPNetwork parent_subnet + number bgp_base_asn + boolean dci_enabled + number leaf_pair_count_COMPUTED + number total_leaf_count_COMPUTED + number total_access_count_COMPUTED } - DEVICE { + NetworkDevice { string hostname string role - string mgmt_ip + IPHost management_ip_COMPUTED + string platform + number spine_id + number leaf_id } - INTERFACE { + NetworkInterface { string name - string type - int mtu + string interface_type + boolean enabled + number mtu + string switchport_mode + number channel_id } - IP_ADDRESS { - string address - int prefix_length + IpamIPAddress { + IPHost address + string status } - BGP_SESSION { - int local_asn - int remote_asn + NetworkBGPConfig { + number asn + IPHost router_id + number maximum_paths + number distance_external + number distance_internal + number ebgp_admin_distance } + + NetworkMLAGDomain { + string domain_id + IPHost peer_address + string status + } + + NetworkDCISwitch { + string hostname + IPHost loopback0_ip + IPHost management_ip + } + + NetworkDCIConnection { + string connection_name + string status + IPHost dci_ip + IPHost border_ip + IPNetwork subnet + } +``` + +--- + +## 11. DCI Architecture - NetworkDCISwitch & NetworkDCIConnection + +```mermaid +graph TB + subgraph DCILayer["🌐 DCI Layer - Separate Schema"] + DCI[NetworkDCISwitch
hostname: DCI
loopback0_ip: 10.253.0.1/32
management_ip: 10.255.0.253] + end + + subgraph DC1Border["DC1 Border Leafs"] + B1_DC1[borderleaf1-DC1
NetworkDevice
eth12 interface] + B2_DC1[borderleaf2-DC1
NetworkDevice
eth12 interface] + end + + subgraph DC2Border["DC2 Border Leafs"] + B1_DC2[borderleaf1-DC2
NetworkDevice
eth12 interface] + B2_DC2[borderleaf2-DC2
NetworkDevice
eth12 interface] + end + + subgraph Connections["NetworkDCIConnection Objects"] + Conn1[DCI-to-borderleaf1-DC1
dci_interface: Ethernet1
border_interface: Ethernet12
dci_ip: 10.254.0.1/31
border_ip: 10.254.0.0/31
status: shutdown] + + Conn2[DCI-to-borderleaf2-DC1
dci_interface: Ethernet2
border_interface: Ethernet12
dci_ip: 10.254.0.3/31
border_ip: 10.254.0.2/31
status: shutdown] + + Conn3[DCI-to-borderleaf1-DC2
dci_interface: Ethernet3
border_interface: Ethernet12
dci_ip: 10.254.0.5/31
border_ip: 10.254.0.4/31
status: shutdown] + + Conn4[DCI-to-borderleaf2-DC2
dci_interface: Ethernet4
border_interface: Ethernet12
dci_ip: 10.254.0.7/31
border_ip: 10.254.0.6/31
status: shutdown] + end + + DCI --> Conn1 + DCI --> Conn2 + DCI --> Conn3 + DCI --> Conn4 + + Conn1 -.-> B1_DC1 + Conn2 -.-> B2_DC1 + Conn3 -.-> B1_DC2 + Conn4 -.-> B2_DC2 + + style DCI fill:#ffccbc + style Conn1 fill:#fff9c4 + style Conn2 fill:#fff9c4 + style Conn3 fill:#fff9c4 + style Conn4 fill:#fff9c4 +``` + +**Key DCI Concepts:** +- **NetworkDCISwitch**: Separate schema object (NOT NetworkDevice) +- **NetworkDCIConnection**: Tracks P2P links with dedicated attributes +- **status**: Default is `shutdown`, changes to `active` when `dci_enabled: true` +- **border_interface**: Always Ethernet12 on border leafs +- **Relationship**: `NetworkDCIConnection` → `border_leaf` (Attribute) → `NetworkDevice` + +--- + +## 12. Key Schema Attributes Summary + +### InfraDatacenter Attributes +```yaml +# User Input (Required) +name: string # "DC1" +dc_id: number # 1 +number_of_bays: number # 2 (default) +parent_subnet: IPNetwork # "10.0.0.0/8" + +# Configuration (With Defaults) +spine_count: number # 3 (default) +border_leaf_count: number # 2 (default) +bgp_base_asn: number # 65000 (default) +spine_asn: number # Auto: bgp_base_asn + (dc_id * 100) +mlag_domain_id: string # "MLAG" (default) +mtu: number # 9214 (default) +has_border_leafs: boolean # true (default) +dci_enabled: boolean # false (default) +dci_remote_dc_id: number # Optional + +# Computed (Read-Only) +leaf_pair_count: number # ceil(number_of_bays / 2) +total_leaf_count: number # leaf_pair_count * 2 +total_access_count: number # number_of_bays +``` + +### NetworkDevice Attributes +```yaml +hostname: string # "spine1-DC1" +role: dropdown # spine, leaf, borderleaf, access, host +platform: string # "cEOS" (default) +management_ip_template: string # Template for IP generation +management_ip: IPHost # Computed from template +spine_id: number # For spines +leaf_id: number # For leafs +mlag_side: dropdown # left (odd), right (even) +``` + +### NetworkInterface Types +```yaml +interface_type: dropdown + - ethernet # Physical interfaces + - loopback # Loopback0, Loopback1 + - port_channel # Note: underscore, not hyphen! + - vlan # SVIs + - vxlan # VXLAN tunnels + - management # Management interface +``` + +### IpamIPPrefix Types +```yaml +prefix_type: dropdown + - pool # General pool + - loopback # Loopback0 addresses + - vtep # Loopback1 VTEP addresses + - p2p # Point-to-point links + - management # Management network + - tenant # Tenant/VLAN networks + - mlag # MLAG peer links ``` \ No newline at end of file